Skip to content

fix(trading): correct ownership snapshots, broker retries, and native protection - #439

Merged
brokermr810 merged 160 commits into
mainfrom
test
Dec 4, 2026
Merged

brokermr810 merged 160 commits into
mainfrom
test

Conversation

@brokermr810

Copy link
Copy Markdown
Collaborator

Stock ownership dialogs could appear empty despite broker holdings because equity strategies selected the wrong account or allocation bucket. Broker client outages could also produce a new failed exit and email on each evaluation. This change fixes those paths alongside #438 and US symbol-directory synchronization.

Changes

  • Normalize supported equity-broker account snapshots to spot, including dynamic mixed universes, while retaining strategy ledger asset classes and tenant/credential/side isolation. Reject incomplete, malformed, or unsupported snapshots before writes and preserve valid broker current prices.
  • Apply a durable 60-second cooldown to zero-fill, pre-submit client connection failures and deduplicate outage notifications. Changed quantities and worker restarts do not bypass the cooldown; uncertain submissions still require reconciliation.
  • Generate stable role-specific native protection IDs within venue limits for Binance, OKX, Bitget, Bybit, and Gate. Recognize both OKX partial and full ADL, avoid classification from arbitrary client IDs, and use HTX native close timestamps.
  • Recognize Nasdaq directory exchange codes F/M and skip test issues before validation, preserving fail-safe catalog reconciliation.
  • Update English and Chinese trading safety documentation.

Validation

  • Combined regression suite for every changed test module: 467 passed, 1 skipped.
  • Ownership/account/broker regression suite: 249 passed.
  • Ruff, documentation validation, and diff checks passed. Mocked exchange responses only; no live orders submitted.
  • Companion mobile commit OpenByteInc/QuantDinger-Mobile@c101566 adds an explicit ownership failure state with retry and clears stale rows. Mobile: 294 unit tests, production build, and isolated component layout checks at phone/desktop widths and light/dark themes passed.

Deployment and limits

Deploy the API and trading/evaluator workers together. No schema migration or historical order/position rewrite is required. Existing protection IDs remain unchanged; ambiguous orders must not be replayed. The credential-only ownership dialog still does not support independent Gate stock/Bitget Reality wallets or non-USDT crypto spot pairs; it now reports unavailability instead of false zero inventory. Their trading endpoints are unchanged. Run a catalog sync after deployment for directory corrections.

Fixes #438

tianhe added 30 commits November 1, 2026 17:17
Signed-off-by: TIANHE <[email protected]>

# Conflicts:
#	backend_api_python/app/routes/community.py
Signed-off-by: TIANHE <[email protected]>

# Conflicts:
#	docs/trading/LIVE_TRADING_SAFETY.md
#	docs/trading/LIVE_TRADING_SAFETY_CN.md
Signed-off-by: TIANHE <[email protected]>

# Conflicts:
#	docs/trading/LIVE_TRADING_SAFETY.md
#	docs/trading/LIVE_TRADING_SAFETY_CN.md
@sonarqubecloud

sonarqubecloud Bot commented Dec 4, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Dec 4, 2026

Copy link
Copy Markdown

@brokermr810
brokermr810 merged commit c0fa5c1 into main Dec 4, 2026
15 checks passed
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.

Scope proposal: fix OKX protection IDs and full ADL close classification

6 participants