Skip to content

Fix P/L calculations#29

Merged
Graeme22 merged 3 commits into
tastyware:mainfrom
autojake:fix/pnl-quantity
May 26, 2026
Merged

Fix P/L calculations#29
Graeme22 merged 3 commits into
tastyware:mainfrom
autojake:fix/pnl-quantity

Conversation

@autojake

Copy link
Copy Markdown
Contributor

Total P/L for equity options and futures options was not multiplied by pos.quantity, positions with more than one contract showed per-contract P/L instead of total. Also fixed operator precedence in the equity and cryptocurrency (for completeness only at least at this time) P/L formulas where the direction multiplier m was only applied to the cost basis instead of the whole expression, producing incorrect values for short positions.

Follows up on #27 which fixed the related pnl_day and BWD calculations. Many thanks!

@Graeme22 Graeme22 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening! I think a couple expressions are still incorrect. As you can see, I haven't had time to test the CLI very extensively 🥲

Comment thread ttcli/portfolio.py Outdated
Comment thread ttcli/portfolio.py Outdated
autojake and others added 2 commits May 26, 2026 10:21
Correct order of ops

Co-authored-by: Graeme Holliday <graeme.holliday@pm.me>
correct order of ops

Co-authored-by: Graeme Holliday <graeme.holliday@pm.me>
@Graeme22 Graeme22 merged commit 8d619c2 into tastyware:main May 26, 2026
1 check passed
@Graeme22

Copy link
Copy Markdown
Member

Thanks!

@autojake autojake mentioned this pull request May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants