Skip to content

feat(trade): add multi-leg option order support - #575

Draft
sunli829 wants to merge 2 commits into
mainfrom
feat/trade-submit-multileg
Draft

feat(trade): add multi-leg option order support#575
sunli829 wants to merge 2 commits into
mainfrom
feat/trade-submit-multileg

Conversation

@sunli829

@sunli829 sunli829 commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

@

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_multilegPOST /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. Takes side, order_type, submitted_quantity, strategy (MultiLegStrategy), a list of legs (symbol + ratio_quantity), and optional submitted_price / remark / client_request_id; returns the existing SubmitOrderResponse.

New response field

  • Order (today_orders / history_orders), OrderDetail (order_detail), and the PushOrderChanged order-changed event gain an optional multi_leg field (MultiLegInfo), present only for multi-leg option combination orders — carrying strategy, strategy_name, multileg_id, code, and the combination legs (each with symbol, side, position, ratio_quantity, strike_price, expire_date, contract_direction, contract_size).
  • New enums: MultiLegStrategy, MultiLegPosition, ContractDirection.

Layers & verification

Layer Verification
Rust core cargo check / clippy --all --all-features clean; cargo +nightly fmt
C cargo build -p longbridge-c (regenerates longbridge.h)
C++ g++ -std=c++17 -fsyntax-only against regenerated header
Java cargo build -p longbridge-java + full javac compile
Node.js npm run build:debug (regenerates index.d.ts / index.js)
Python cargo check; openapi.pyi stub updated by hand

Notes

  • Also documents in CLAUDE.md the 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
@

@sunli829
sunli829 marked this pull request as draft August 18, 2026 02:44
@sunli829
sunli829 force-pushed the feat/trade-submit-multileg branch from c361943 to 98cf17b Compare August 18, 2026 06:57
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
sunli829 force-pushed the feat/trade-submit-multileg branch from 98cf17b to ee490a2 Compare August 18, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant