Skip to content

fix(trading): reconcile protection fills and spot residuals - #377

Merged
brokermr810 merged 44 commits into
mainfrom
test
Nov 13, 2026
Merged

brokermr810 merged 44 commits into
mainfrom
test

Conversation

@brokermr810

Copy link
Copy Markdown
Collaborator

Summary

  • attribute native stop-loss, take-profit, and trailing child fills across supported crypto venues
  • project triggered protection fills as independent exits without contaminating entry progress
  • classify verified non-tradable spot exit residuals and exclude them from active exposure
  • expose residual state through position APIs and runtime health
  • add migration, unit, regression, and PostgreSQL transaction coverage

Validation

  • Ruff passed
  • focused trading regression: 58 passed
  • schema, cleanup, and position sync regression: 41 passed
  • PostgreSQL transaction integration: 32 passed
  • frontend ESLint and production build passed (frontend change pushed separately)

Closes #369
Closes #370

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 14 commits November 6, 2026 15:07
#362 normalized the Binance protection orders, but Bitget (UTA and
classic) and Bybit still sent percentage-derived prices with str(), e.g.
stopLoss=77951.14749999999 for a 2.5% stop on a 76049.9 short. Those are
off the contract tick, so the venue rejects the protection order.

Run the stop-loss, take-profit and trailing activation prices (and the
Bybit trailingStop distance) through each client's _normalize_price, the
same way #362 does for Binance, and raise when the result falls below the
minimum.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: aliassar <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@brokermr810
brokermr810 merged commit 1a82e54 into main Nov 13, 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

3 participants