feat(order_object): add native support for CONDITIONAL orders#77
feat(order_object): add native support for CONDITIONAL orders#77deividuvi wants to merge 2 commits intox10xchange:starknetfrom
Conversation
|
Context / Motivation In several trading flows (e.g. stop-loss, break-even, trailing exits), orders need to be created after an initial position is already open. The current implementation in order_object.py hard-codes OrderType.LIMIT when instantiating NewOrderModel, which prevents creating OrderType.CONDITIONAL orders through the same path — even though the exchange natively supports them. What this change does This patch removes the hard-coded order type and allows NewOrderModel to accept and propagate any order type supported by the exchange (including CONDITIONAL), without altering existing behavior for limit/market orders. Why it helps This makes the SDK compatible with a broader class of strategies (e.g. post-entry SLs, trailing stops, risk-management automation) while remaining backward-compatible with existing usage. Here you can see the sample code of the original file with the hardcode limitation: |
|
Hi! I resolved the merge conflicts with the latest Everything should now be aligned with the current codebase, including TPSL handling and conditional orders support. Could you please take another look? |
|
hey. thx for the update! we will review it shortly. pls note that we're in the process of reworking the SDK (which also includes adding support for missing order type), so if we will identify misalignments between your PR and new approach/structure it might be easier for us to push our own implementation to avoid unnecessary iterations. |
|
Hi Alex, no worries. I´ll be happy to use your version when available. Keep it up! |
Summary
This PR adds first-class support for CONDITIONAL orders to the Python SDK by extending
order_object.py.The goal is to make conditional / stop orders a native SDK feature instead of relying on TPSL workarounds.
Changes
OrderType.CONDITIONALsupportOrderConditionalTriggerParamfor conditional trigger configurationcreate_order_object()to:Motivation
Conditional orders are the primary mechanism used by the Extended exchange UI for stop-loss and protective exits.
Without native support, SDK users must rely on TPSL parent orders, which introduces complexity and edge cases.
This change enables:
Notes
order_object.py