feat(order_object): add native support for CONDITIONAL orders#77
feat(order_object): add native support for CONDITIONAL orders#77deividuvi wants to merge 1 commit 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: |
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