feat(trade): add multi-leg option order support - #575
Draft
sunli829 wants to merge 2 commits into
Draft
Conversation
sunli829
marked this pull request as draft
August 18, 2026 02:44
sunli829
force-pushed
the
feat/trade-submit-multileg
branch
from
August 18, 2026 06:57
c361943 to
98cf17b
Compare
Add `TradeContext.submit_multileg` (POST /v1/trade/order/multileg) for submitting multi-leg option combination orders (vertical spreads, straddles, strangles, collars, etc.), where all legs are placed together as a single strategy order. Expose multi-leg strategy information on order queries and the order push: `Order`, `OrderDetail`, and `PushOrderChanged` gain an optional `multi_leg` field (`MultiLegInfo`), present only for multi-leg option combination orders. Adds the `MultiLegStrategy`, `MultiLegPosition`, and `ContractDirection` enums. Implemented across all SDK layers: Rust core, C, C++, Java, Node.js, and Python (incl. the openapi.pyi stub). Also document in CLAUDE.md the full list of SDK layers that must be kept in sync when adding an API or type. Ref: longbridge/developers#1212
The field was dropped from the multi-leg `legs` definition in the API docs (longbridge/developers#1215), so the server does not return it. Removed across all six SDK layers (Rust, C, C++, Java, Node.js, Python) and from the unreleased changelog entry that listed it.
sunli829
force-pushed
the
feat/trade-submit-multileg
branch
from
August 18, 2026 07:17
98cf17b to
ee490a2
Compare
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
Implements the multi-leg option order feature from longbridge/developers#1212 across all six SDK layers (Rust core, C, C++, Java, Node.js, Python).
New API
TradeContext.submit_multileg→POST /v1/trade/order/multileg— submit a multi-leg option combination order (vertical spreads, straddles, strangles, collars, etc.) whose legs are placed together as a single strategy order. Takesside,order_type,submitted_quantity,strategy(MultiLegStrategy), a list of legs (symbol+ratio_quantity), and optionalsubmitted_price/remark/client_request_id; returns the existingSubmitOrderResponse.New response field
Order(today_orders/history_orders),OrderDetail(order_detail), and thePushOrderChangedorder-changed event gain an optionalmulti_legfield (MultiLegInfo), present only for multi-leg option combination orders — carryingstrategy,strategy_name,multileg_id,code, and the combinationlegs(each withsymbol,side,position,ratio_quantity,strike_price,expire_date,contract_direction,contract_size).MultiLegStrategy,MultiLegPosition,ContractDirection.Layers & verification
cargo check/clippy --all --all-featuresclean;cargo +nightly fmtcargo build -p longbridge-c(regenerateslongbridge.h)g++ -std=c++17 -fsyntax-onlyagainst regenerated headercargo build -p longbridge-java+ fulljavaccompilenpm run build:debug(regeneratesindex.d.ts/index.js)cargo check;openapi.pyistub updated by handNotes
CLAUDE.mdthe full list of SDK layers that must be kept in sync when adding an API or type (previously missing C++ and Java).🤖 Generated with Claude Code
@