P1.1: Report each account's status to the master's ledger
Every FirmStats now carries statusVersion 1, the catalog firmId and, once synced, syncedAt (from lastSyncAt), including the no-accounts branch, which is now built by emptyFirmStats(). Each accounts[] entry adds status, reason, balance, floor, accountTypeId, firstFundDate, positiveFunds and brokerStatus, each left out when null or at its default. accountStatus() in platform-client.ts is pure: a missing balance is unknown (cash_missing), never dead; with a balance, dead is exactly the old floor test (legacyDead); then history_pending, locked, live. Only the reporter uses it. The aggregates, totals and every trading decision keep their own dead test, unchanged. The reporter reads history readiness through a new Tradovate peekHistoryReady(), because historyReady() there can start a hold and move the balance baseline. DXTrade exposes accountStatus and registrationTime via brokerAccountMeta(). A throw in the new fields reports the account as unknown instead of losing the report. sendReport skips the socket for a firms payload over 900,000 chars (the master's frame cap is 1,000,000 bytes) and POSTs it, logging once per switch. scripts/check-account-status.mjs proves the legacy invariant over the full matrix and the size budget (worst 228 B added per account, 154 B typical live; 2000 accounts 592,501 B). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8747dd6b08
commit
0c3a36845a
+1
-1
@@ -7,7 +7,7 @@
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "eslint",
|
||||
"check": "node --experimental-strip-types --disable-warning=MODULE_TYPELESS_PACKAGE_JSON --test scripts/check-trading-logic.mjs scripts/check-instruments.mjs"
|
||||
"check": "node --experimental-strip-types --disable-warning=MODULE_TYPELESS_PACKAGE_JSON --test scripts/check-trading-logic.mjs scripts/check-instruments.mjs scripts/check-account-status.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/signalr": "^10.0.11",
|
||||
|
||||
Reference in New Issue
Block a user