Closed
Conversation
Extract general position functionality into new base classes: - PositionBase: base frozen dataclass for a single position - PositionsBase: base frozen dataclass for a collection of positions - ConsolidatedBase: base class for consolidated multi-instrument results - ChartPositionsBase: base OHLC chart with position overlay - PositionsGuiBase: base GUI for interactive position analysis - distributed_rtrns: chart function for return distribution These base classes parallel the existing trends subpackage pattern and enable downstream packages (e.g. inv) to extend with domain-specific position logic. https://claude.ai/code/session_01TnPAQhPW1RpEYuKuQFwqmY
Rename properties on PositionBase and PositionsBase to be timeframe agnostic: - sessions -> bars - open_date -> open_bar - close_date -> close_bar - max_date -> max_bar - open_dates -> open_bars - close_dates -> close_bars - max_dates -> max_bars Update all docstrings to use "bar" terminology instead of "session"/"daily". https://claude.ai/code/session_01TnPAQhPW1RpEYuKuQFwqmY
Owner
Author
|
Not implemented. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a new
positionsmodule that provides base classes for representing, analyzing, and visualizing financial positions. The module enables tracking of individual positions taken in financial instruments and aggregating results across multiple instruments.Key Changes
PositionBase: A frozen dataclass representing a single position with:
CaseBaseandCaseSupportsChartAnalyPositionsBase: A container for all positions in a single instrument over an analysis period with:
ConsolidatedBase: A summary class for consolidating position results across multiple instruments with:
ChartPositionsBase: An OHLC chart with position overlays showing:
PositionsGuiBase: An interactive GUI for displaying and analyzing positions with:
Implementation Details
lineproperty provides a special series representation with duplicate indices for session opens to capture both entry and session-end pricesmarket_analyinfrastructure (cases, charts, formatters, GUIs)https://claude.ai/code/session_01TnPAQhPW1RpEYuKuQFwqmY