Skip to content

[codex] fix LongBridge strategy account equity#152

Merged
Pigbibi merged 1 commit into
mainfrom
codex/fix-strategy-total-equity
Jun 10, 2026
Merged

[codex] fix LongBridge strategy account equity#152
Pigbibi merged 1 commit into
mainfrom
codex/fix-strategy-total-equity

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Override LongBridge account-state total_strategy_equity to use strategy-symbol market value plus available cash.
  • Keep the guard scoped to configured strategy symbols.

Root Cause

The shared converter may come from an older pinned QuantPlatformKit release, so platform-side account-state conversion needs the same filtered total-equity guard.

Validation

  • python3 -m py_compile application/runtime_broker_adapters.py
  • Lightweight direct adapter check for filtered strategy equity.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8ffba964fc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +190 to +192
account_state["total_strategy_equity"] = float(account_state["available_cash"]) + sum(
float(value) for value in dict(account_state["market_values"]).values()
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Normalize snapshot symbols before recomputing equity

When resolve_rebalance_plan is given a PortfolioSnapshot whose positions use LongBridge/full market symbols such as SOXL.US, build_account_state_from_portfolio_snapshot filters those positions against self.strategy_symbols like SOXL, so the converted market_values are all zero. This new override then replaces the previous snapshot.total_equity with cash-only equity, causing strategies that request account_state from a broker-symbol snapshot to understate total strategy equity. Strip/normalize the configured suffix before relying on the filtered market_values, or compute the sum from symbols matched to the strategy roots.

Useful? React with 👍 / 👎.

@Pigbibi Pigbibi merged commit 4f9b645 into main Jun 10, 2026
1 check passed
@Pigbibi Pigbibi deleted the codex/fix-strategy-total-equity branch June 10, 2026 20:18
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