Repository navigation
Add contingent orders support: OCO, OTO and OTOCO order lists - #85
Merged
Merged
Conversation
Places contingent order sets through the spot order list endpoints, maps list driven expirations to cancellations, reports the pending orders once the working order fills and rebuilds the contingencies of open orders from their order list. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
5 of 11 tasks
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The prices are within the allowed range around the average price, and the brokerage finds the test orders of its order events through the algorithm transactions. The trigger tests use a working limit order which fills right away. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Each order of the list is sent with a client order id made of its lean order id and a suffix unique to the placement, the reports are matched by it instead of by side and price. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…st expiries failed to parse Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
3 of 4 tasks
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.
Description
Places contingent order sets through the spot order list endpoints (OCO, OTO and OTOCO):
eR, likeOCO_TRIGGER) is mapped apart from the futures one (er): the names only differ in case and it was read as the futures enum, failing to parse the report.OrderContingency.Trigger/Relate.Related Issue
Requires QuantConnect/Lean#9828, which adds contingent orders to Lean. This PR builds against it, so CI will pass once it's merged and released.
Motivation and Context
Support for Lean contingent orders (OCO, OTO, OUO, brackets) using the brokerage's native functionality, so the sets are placed atomically and managed on the brokerage side.
Requires Documentation Change
The supported contingent order shapes of this brokerage, see its brokerage model in Lean.
How Has This Been Tested?
BrokerageTestscontingent orders suite (BinanceBrokerageTests.ContingentOrders.cs):PERCENT_PRICE_BY_SIDEof the average price, otherwise the lists are rejected (-1013), which is reported as invalid.PERCENT_PRICE_BY_SIDEwith the shared fixture prices, a buy stop at the high price is beyond the allowed range; the contingent tests cover stop limit orders on both sides.Types of changes
Checklist:
bug-<issue#>-<description>orfeature-<issue#>-<description>🤖 Generated with Claude Code