Skip to content

feat(risk): portfolio unrealized PnL diagnostics helper - #197

Merged
Pigbibi merged 1 commit into
mainfrom
feat/portfolio-risk-diagnostics
Jul 8, 2026
Merged

feat(risk): portfolio unrealized PnL diagnostics helper#197
Pigbibi merged 1 commit into
mainfrom
feat/portfolio-risk-diagnostics

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • 新增 risk/portfolio_diagnostics.pycompute_unrealized_pnl_pct()extract_portfolio_risk_diagnostics()
  • PortfolioSnapshot 持仓 cost basis 计算未实现盈亏占比;支持 metadata 覆盖
  • 透传 metadata.consecutive_losses(平台侧维护)

Test plan

  • python3 -m unittest tests.test_portfolio_diagnostics
  • CI green

依赖

  • 任务 8b:IBKR strategy_runtime._enrich_portfolio_metadata 将依赖本 PR 合并后 bump pin

Made with Cursor

Expose compute_unrealized_pnl_pct and extract_portfolio_risk_diagnostics
for platform runtime metadata enrichment (task 8b).

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@cursor

cursor Bot commented Jul 8, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@chatgpt-codex-connector

This comment has been minimized.

@Pigbibi
Pigbibi merged commit 2de7f25 into main Jul 8, 2026
2 checks passed
@Pigbibi
Pigbibi deleted the feat/portfolio-risk-diagnostics branch July 8, 2026 16:21
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.

1 participant