docs: add attached order (take-profit/stop-loss) params docs and orde… - #1092
Merged
Conversation
shinexia
force-pushed
the
feature-attached-order
branch
4 times, most recently
from
June 17, 2026 06:28
d10f3b7 to
33a3c97
Compare
shinexia
force-pushed
the
feature-attached-order
branch
from
June 30, 2026 11:12
33a3c97 to
4cf7911
Compare
sunli829
marked this pull request as draft
July 6, 2026 06:44
shinexia
force-pushed
the
feature-attached-order
branch
from
July 20, 2026 09:14
96eb1bc to
10b6cb5
Compare
4 tasks
shinexia
force-pushed
the
feature-attached-order
branch
from
July 29, 2026 06:29
10b6cb5 to
4ed573f
Compare
shinexia
marked this pull request as ready for review
July 29, 2026 06:32
sunli829
added a commit
to longbridge/openapi-go
that referenced
this pull request
Jul 29, 2026
## Summary Ports the attached order (take-profit / stop-loss) feature added to the Rust/Python/Node.js/Java/C/C++ SDKs in [longbridge/openapi#549](longbridge/openapi#549) (docs: [longbridge/developers#1092](longbridge/developers#1092)). PR #549 is still open/unmerged upstream at the time of this PR. - New types: `AttachedOrderType` (`ProfitTaker` / `StopLoss` / `Bracket`), `AttachedOrderDetail`, `SubmitAttachedParams`, `ReplaceAttachedParams` - `SubmitOrder` / `ReplaceOrder`: new `AttachedParams` field - `Order` / `OrderDetail`: new `AttachedOrders []AttachedOrderDetail` field - New `TradeContext.OrderDetailAttached(orderId)` / `CancelOrderAttached(orderId)` methods — query/cancel an attached sub-order by its own order ID. Added as separate methods rather than changing `OrderDetail`/`CancelOrder`'s existing signatures, since Go has no method overloading or default parameters (other SDKs did this via optional/default params or `impl Into<Options>`; Go's closest precedent is the C SDK's separate `lb_trade_context_cancel_order_attached` function). - `GetTodayOrders`: new `OrderId` and `IsAttached` fields (`OrderId` was previously missing entirely even though the API already supported it) — combined, treats `OrderId` as an attached sub-order ID and returns that sub-order as an `Order` entry - New example: `examples/submit_order_with_attached` ## Breaking change `OrderDetail.ChargeDetail` is now `*OrderChargeDetail` (was a value type), since the server returns `null` for this field on attached sub-orders. Matches the same breaking change made upstream across all 6 languages. ## Note for reviewers `AttachedOrderDetail`'s `AttachedTypeDisplay`, `TriggerStatus`, and `Tag` fields are implemented as typed string enums (e.g. `"PROFIT_TAKER"`, `"DEACTIVE"`, `"Normal"`), matching the upstream Rust struct definitions (tested end-to-end per PR #549's description). However, the `longbridge/developers` docs PR's JSON example shows these same three fields as raw integers instead. Since both source PRs are still open/unreviewed, this is unconfirmed against a live API response — if the wire format turns out to be numeric, JSON unmarshaling of these three fields will fail. Worth verifying against a real sandbox response before this ships. ## Test plan - [x] `go build ./...` and `go vet ./trade/...` - [x] Verified the `jinzhu/copier`-based JSON→domain-type conversion (nested pointer structs, slices of new struct types, nil-safety for `ChargeDetail`/`AttachedParams`) via a temporary round-trip test, since this doesn't touch live credentials - [x] `examples/submit_order_with_attached` builds and vets cleanly in the `examples` module - [ ] Not tested against a live API response (no sandbox credentials in this session) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
No description provided.