You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Scope proposal: fix OKX protection IDs and full ADL close classification #438
In QuantDinger v6.0.7, two OKX perpetual-swap cases can be reproduced with mocked exchange responses:
Protection order IDs. Invoke the native protection path with a synthetic entry ID such as qdentry123 and capture the request to POST /api/v5/trade/order-algo. Stop-loss, take-profit, and trailing-stop requests can contain hyphens in algoClOrdId. OKX requires an ASCII alphanumeric ID of at most 32 characters and can reject the protection request with 51000: Parameter algoClOrdId error.
Full ADL closes. Return an otherwise matching close fill and an OKX position-history record with type: "6". OKX documents this as ADL with the position fully closed. Both OKX close-history paths only recognize type: "5" as ADL, so the full close is recorded as exchange_native_close and misses handling gated on exchange_adl.
Generate deterministic, alphanumeric OKX protection IDs of at most 32 characters, with distinct IDs across protection roles and entry attempts. Preserve the identifier returned by the exchange for binding and reconciliation.
Classify OKX types 5 and 6 as exchange_adl in both close-history paths. Preserve liquidation and ordinary-close classifications and leave historical records as stored.
Use mocked tests for request payloads, retry stability, distinct IDs, and the ADL and ordinary-close cases. No exchange credentials or live orders are needed for the tests.
Could a maintainer confirm this scope before an implementation PR, and indicate whether you would prefer one PR or two?
Steps to reproduce
Use the two numbered mocked cases in the description. No live orders are required.
Thanks for the precise report. Both defects are fixed in commit 44a5781 on test, included in PR #439.
OKX stop-loss, take-profit, and trailing protection IDs now hash the complete entry identity and role into deterministic ASCII alphanumeric IDs of at most 32 characters. Roles and entry attempts remain distinct, retries are stable, and exchange-returned identifiers remain authoritative for reconciliation.
Both OKX close-history paths now recognize types 5 and 6 as exchange_adl. Ordinary closes and liquidation classifications remain intact; historical trades are not rewritten.
We also audited native protection IDs and forced-close classification across the other supported venues.
The combined offline regression suite for the changed test modules passed: 467 passed, 1 skipped, covering mocked protection payloads, stable/distinct IDs, ADL classification, and forced-close reconciliation. No exchange credentials or live orders were used in these tests.
Closing this report as addressed by the published fix. PR #439 tracks the merge and CI review; the fix is currently on test, not yet merged into main or released.
Activity
brokermr810 commentedon Dec 4, 2026
Thanks for the precise report. Both defects are fixed in commit 44a5781 on
test, included in PR #439.5and6asexchange_adl. Ordinary closes and liquidation classifications remain intact; historical trades are not rewritten.The combined offline regression suite for the changed test modules passed: 467 passed, 1 skipped, covering mocked protection payloads, stable/distinct IDs, ADL classification, and forced-close reconciliation. No exchange credentials or live orders were used in these tests.
Closing this report as addressed by the published fix. PR #439 tracks the merge and CI review; the fix is currently on
test, not yet merged intomainor released.