Repository navigation
feat(trade): add estimate_multileg_available_quantity (POST /v1/trade/estimate/multileg) - #603
Open
hogan-yuan wants to merge 9 commits into
Open
hogan-yuan wants to merge 9 commits into
hogan-yuan wants to merge 9 commits into
Conversation
…/estimate/multileg) Pre-trade estimate for a US multi-leg option combination: max tradable quantity and margin impact. Because the request carries a legs array it is a POST with a JSON body (RESTful), unlike the scalar single-leg estimate which is GET+query. Rust core async + blocking.
This was referenced Oct 9, 2026
Align the doc comments in every layer (Rust, C, C++, Java, Node.js, Python) with what the gateway actually returns: - max_open_qty: the server returns i64::MAX when the legs don't form the given strategy; treat that as no usable estimate. - unit_margin: net debit at market for debit combos, margin requirement for credit/short combos (was "margin required per combination unit"). - initial/maintenance_margin_change: scale with submitted_quantity and are 0 for debit combos. - submitted_price: still required for limit types, but the estimate is computed from market prices so it doesn't change the result. - Leg order does not matter. Also allow clippy::too_many_arguments on the async Python method, matching the rest of the Python bindings.
Resolve conflicts in CHANGELOG.md, c/src/trade_context/context.rs, nodejs/src/trade/context.rs and rust/src/trade/context.rs. Agent: rust-maintainer
Member
Author
|
Merged Resolved files:
Checks: 🤖 Noop (rust-maintainer) · AI agent acting for @your-github |
hogan-yuan
added a commit
to longbridge/longbridge-terminal
that referenced
this pull request
Nov 5, 2026
Resolve conflicts in Cargo.toml, Cargo.lock and src/cli/trade.rs. Pin longbridge to c4e91b1b1 (longbridge/openapi#603 with main merged in), which carries estimate_multileg on top of 5.3.0. Agent: rust-maintainer
hogan-yuan
added a commit
to longbridge/longbridge-mcp
that referenced
this pull request
Nov 5, 2026
Resolve conflicts in Cargo.toml, Cargo.lock and src/tools/mod.rs. Pin longbridge / longbridge-proto to c4e91b1b1 (longbridge/openapi#603 with main merged in), which carries estimate_multileg on top of 5.3. Agent: rust-maintainer
# Conflicts: # CHANGELOG.md # c/src/trade_context/context.rs # c/src/trade_context/types.rs # nodejs/src/trade/context.rs # python/src/trade/context.rs # python/src/trade/context_async.rs # rust/src/trade/context.rs
hogan-yuan
added a commit
to longbridge/longbridge-mcp
that referenced
this pull request
Dec 4, 2026
Resolve conflicts in Cargo.toml, Cargo.lock and README.md by keeping main. Drop the git pin on the unreleased longbridge SDK: the estimate tool now POSTs /v1/trade/estimate/multileg through the HTTP client until the SDK method (longbridge/openapi#603) ships. Add the ja locale entry and bump the published tool counts to 205.
This branch has not been deployed
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
New
TradeContext.estimate_multileg_available_quantity— a pre-trade estimate of a US multi-leg option combination's maximum tradable quantity and margin impact (max_open_qty,unit_margin,initial_margin_change,maintenance_margin_change).Request:
side,order_type,submitted_quantity,strategy(MultiLegStrategy),legs(each symbol + a reserved side), optionalsubmitted_price.RESTful note
The single-leg
estimate_max_purchase_quantityis aGETwith scalar query params. This one carries alegsarray — which cannot be encoded in a query string — so it is aPOSTwith a JSON body, consistent with the multi-leg submit endpoint (POST /v1/trade/order/multileg).Layers
Rust core (async + blocking) + C, C++, Java, Node.js, Python. Each builds;
longbridge.h,index.d.ts,openapi.pyiregenerated/updated. Go is a separate PR; CLI/MCP are follow-ups.