Skip to content

fix(ws): complete Binance USD-M stream routing migration - #422

Merged
brokermr810 merged 124 commits into
mainfrom
test
Nov 28, 2026
Merged

brokermr810 merged 124 commits into
mainfrom
test

Conversation

@brokermr810

Copy link
Copy Markdown
Collaborator

Problem and behavior

Binance USD-M market streams on the legacy fstream root can connect without delivering mark prices, causing ongoing REST fallback. The private execution stream also used the legacy live path and an outdated demo host.

This PR incorporates #421 via cherry-pick of a5c7b82, preserving Prakash Jha's authorship and DCO sign-off, then completes backend routing:

  • Live mark prices: /market/stream?streams=....
  • Live private execution: /private/ws/<listenKey>, preserving raw events and the existing listen-key creation/keepalive lifecycle.
  • Demo/testnet private execution: wss://demo-fstream.binance.com/ws/<listenKey>.
  • Spot streams, the separate WebSocket order-placement API, REST fallback, and execution reconciliation remain unchanged.

Closes #420. Incorporates the fix proposed in #421; no changes were made to that contributor's branch.

Companion frontend changes

Desktop and mobile K-line streams now use /market/ws; depth streams use /public/ws. Both companion commits are already pushed:

Validation

  • Backend focused price-feed, execution-adapter, normalizer, supervisor and late-fill recovery suites: 76 passed.
  • Full backend Ruff checks, backend quality gate, and documentation validation passed.
  • Desktop targeted tests: 27 passed; full lint: 0 errors (existing formatting warnings); production build passed.
  • Mobile targeted tests: 30 passed; production build passed.
  • Regression coverage includes live/demo/testnet and spot URLs, fresh WebSocket prices avoiding REST fallback, and preservation of private fill/fee evidence.
  • Public network smoke probes to mark-price, K-line and depth endpoints were attempted once each but all connections were reset from this workstation. Online delivery is therefore not verified here. Private streams were tested with fixtures, not live credentials.

Deployment and limits

Deploy the backend workers and both frontend builds. No database migration is required. Verify fresh public_websocket prices, candle updates and private execution events after deployment. Correct routing removes one cause of excess REST traffic; it does not lift an active Binance IP ban.

References: routing migration, raw private stream, testnet host.

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

# Conflicts:
#	backend_api_python/app/routes/community.py
tianhe and others added 26 commits November 26, 2026 01:52
Add scoped broker access, HK board-lot metadata, dated-futures manual trading, and credential redaction. Keep automated futures strategies disabled. Persist advertisement settings and generate their OpenAPI contract.

Signed-off-by: TIANHE <[email protected]>
The main tree matches the pre-fix test tree exactly. Record the squash-merge ancestry while preserving the verified broker fixes.

Signed-off-by: TIANHE <[email protected]>
The main tree exactly matches the pre-fix test tree. Record the merged ancestry while preserving the verified fee fixes.

Signed-off-by: TIANHE <[email protected]>
The merged main tree exactly matches the pre-change test tree; preserve the verified HK identity fixes while recording merge ancestry.

Signed-off-by: TIANHE <[email protected]>
Keep completed-session and execution-price freshness checks intact, allow eligible newly listed equities to satisfy declared warmup, and fail over HK candle providers with bounded Tencent cooldown.

Validation: 382 focused Linux regression tests passed; Ruff, backend quality, encoding and version checks passed.
Signed-off-by: TIANHE <[email protected]>
Expose a restart-scoped 1-60 minute quote-age setting with a 16-minute default, align equity receipt expiry, retain provider timestamp and session checks, and document delayed-feed risks.

Validation: 215 focused backend tests passed; Ruff, backend quality, encoding and version checks passed.
Signed-off-by: TIANHE <[email protected]>
The merged main tree exactly matches the pre-change test tree; preserve the verified quote-policy changes while recording merge ancestry.

Signed-off-by: TIANHE <[email protected]>
Signed-off-by: Prakash Jha <[email protected]>
(cherry picked from commit a5c7b82)
Signed-off-by: TIANHE <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@brokermr810
brokermr810 merged commit b749516 into main Nov 28, 2026
15 checks passed
MrRakun35 pushed a commit to MrRakun35/NovaTrade that referenced this pull request Nov 29, 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.

Binance USD-M WebSocket streams send nothing on the legacy fstream paths, so live prices and perp candles always fall back to REST

5 participants