feat: add calendar spreads to MultiLegStrategy - #589
Open
sunli829 wants to merge 1 commit into
Open
Conversation
`MultiLegStrategy` gains `CalendarCallSpread` (`7`) and `CalendarPutSpread` (`8`) — calendar (horizontal) spreads, accepted by `TradeContext.submit_multileg` and reported back on the `multi_leg` field of `today_orders` / `history_orders` / `order_detail` and the order-changed push. Both variants are appended after `Strangle`, so the discriminants of the existing variants are unchanged. Without them the SDK parsed the two new server values as `Unknown` and could not submit either strategy. Propagated to all six layers: Rust, C, C++ (incl. both `convert()` directions), Java (JNI + `MultiLegStrategy.java`), Node.js, and Python (incl. the `openapi.pyi` stub). `longbridge.h` and `index.d.ts` regenerated. Documented in longbridge/developers#1251.
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.
Follows longbridge/developers#1251, which documents two new values on the multi-leg strategy enum.
MultiLegStrategygains:CalendarCallSpread— wire value7CalendarPutSpread— wire value8Calendar (horizontal) spreads. Accepted by
TradeContext.submit_multileg, and reported back on themulti_legfield oftoday_orders/history_orders/order_detailand the order-changed push.Both variants are appended after
Strangle, so the discriminants of the existing variants are unchanged — this is additive, not a breaking change. Without them the SDK parsed the two new server values asUnknownand had no way to submit either strategy.Layers touched
rust/src/trade/types.rs(with the#[strum(to_string = …, serialize = "7"/"8")]mapping)c/src/trade_context/enum_types.rscpp/include/types.hpp,cpp/src/convert.hpp(bothconvert()directions)java/src/types/enum_types.rs,java/javasrc/…/trade/MultiLegStrategy.javanodejs/src/trade/types.rspython/src/trade/types.rs,python/pysrc/longbridge/openapi.pyic/csrc/include/longbridge.h,nodejs/index.d.tsVerification
cargo clippy --all --all-featuresandcargo +nightly fmt --all— clean (only the pre-existinglongbridge-nodejswarnings)cargo build -p longbridge-c/-p longbridge-java/-p longbridge-python— passnpm run build:debug— pass;index.d.tsregeneratedconvert.hpp(g++ -std=c++17 -fsyntax-only); bothconvert()overloads resolve the new variants. Full CMake build not run.cargo test:"7"/"8"and"CalendarCallSpread"/"CalendarPutSpread"parse to the new variants, andto_string()yields the string names. The temporary test file is not part of this PR.java/javasrcwas not compiled — no JDK on this machine. The change there is two enum constants; the Rust JNI half does build.🤖 Generated with Claude Code