Repository navigation
Support native trailing stop protection - #429
Closed
PranavHariharan19 wants to merge 1 commit into
Closed
PranavHariharan19 wants to merge 1 commit into
PranavHariharan19 wants to merge 1 commit into
Conversation
|
Collaborator
|
Thanks for the contribution! We incorporated your changes into [PR #430](#430), preserving your original authorship in commit We also added validation, delayed-fill handling, protection-status checks, and regression coverage across the affected trading paths. I’m closing this PR as superseded by #430 to keep the related fixes together. Your contribution is included—thank you for identifying and fixing the original issue! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Enables exchange-native trailing stop protection for Quick Trade orders. Previously, while
native_protection.pysupported trailing stops across venues (such as BinanceTRAILING_STOP_MARKET, Bitgettrailing_stop, Bybitv5/position/trading-stop, and OKXmove_order_stop), the Quick Trade order routing layer (quick_trade.py) omitted parsingtrailing_stop_pctandtrailing_activation_pctfrom request payloads. Furthermore,attach_quick_trade_protection()aborted immediately whenevertp_price <= 0 and sl_price <= 0, silently dropping standalone trailing protection requests.This PR wires trailing stop parameters through the Quick Trade workflow, deferred fill worker, and Agent V1 endpoints so users can submit and attach exchange-native trailing stops.
Related issue
Changes
attach_quick_trade_protection()inbackend_api_python/app/services/quick_trade/orders.pyto accepttrailing_stop_pctandtrailing_activation_pct, adjust the early-exit guard to allow standalone trailing stops, and forward parameters intoNativeProtectionRequest.place_order()inbackend_api_python/app/routes/quick_trade.pyto extracttrailing_stop_pct/trailingStopPctandtrailing_activation_pct/trailingActivationPct, forward them toattach_quick_trade_protection(), record them in order metadata, and recognize them inquick_trade_protection_status()._place_live_order()inbackend_api_python/app/routes/agent_v1/quick_trade.pyto parse and forward trailing stop parameters.PendingOrderWorker._sync_one_quick_trade_order()inbackend_api_python/app/services/pending_order_worker.pyto pass stored trailing protection parameters when attaching native protection to deferred fills.backend_api_python/tests/test_quick_trade_trailing_protection.py.Test plan
docker compose up -d --buildpytest tests/test_quick_trade_*.py tests/test_native_protection.py -q— 258 passed)API documentation (if routes/schemas changed)
docs/api/openapi.yaml(cd backend_api_python && python scripts/export_openapi.py)docs/agent/agent-openapi.jsonif/api/agent/v1routes changedScreenshots (if UI change)
N/A (Backend order protection handling and parameter routing)
Roadmap contribution (if applicable)