Skip to content

docs: add depth level params to attached order docs - #1189

Merged
hogan-yuan merged 2 commits into
longbridge:mainfrom
shinexia:feature-limit-depth-level
Oct 15, 2026
Merged

hogan-yuan merged 2 commits into
longbridge:mainfrom
shinexia:feature-limit-depth-level

Conversation

@shinexia

Copy link
Copy Markdown
Contributor

No description provided.

@shinexia
shinexia marked this pull request as draft July 29, 2026 07:05
Sync profit_taker_depth_level/stop_loss_depth_level request params and
limit_depth_level response field for attached orders across en/zh-CN/zh-HK.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@shinexia
shinexia force-pushed the feature-limit-depth-level branch from e2d0d64 to fcbfe69 Compare July 29, 2026 08:40
# Conflicts:
#	docs/en/docs/trade/order/history_orders.mdx
#	docs/en/docs/trade/order/order_detail.mdx
#	docs/en/docs/trade/order/today_orders.mdx
#	docs/zh-CN/docs/trade/order/history_orders.mdx
#	docs/zh-CN/docs/trade/order/order_detail.mdx
#	docs/zh-CN/docs/trade/order/today_orders.mdx
#	docs/zh-HK/docs/trade/order/history_orders.mdx
#	docs/zh-HK/docs/trade/order/order_detail.mdx
#	docs/zh-HK/docs/trade/order/today_orders.mdx
@hogan-yuan
hogan-yuan marked this pull request as ready for review October 15, 2026 02:37
hogan-yuan added a commit to longbridge/openapi-go that referenced this pull request Oct 15, 2026
Ports longbridge/openapi#607, which follows
[longbridge/developers#1189](longbridge/developers#1189).

## Changes

- `SubmitAttachedParams` and `ReplaceAttachedParams` gain
`ProfitTakerDepthLevel` and `StopLossDepthLevel` (`int32`, not sent when
`0`). Each is the bid/ask depth level used for the take-profit or
stop-loss limit order's submitted price, and only applies when
`ActivateOrderType` is `LIT`.
- `AttachedOrderDetail` gains `LimitDepthLevel` (`int32`, `0` when not
set), read from `attached_orders[].limit_depth_level` in `TodayOrders`,
`HistoryOrders` and `OrderDetail`. A JSON `null` reads as `0`.

## Verification

- `go build ./...`, `go vet ./trade/...` and `go test ./trade/...` pass.
- `trade/attached_depth_level_test.go` goes through the real `util.Copy`
and `encoding/json` path. It checks:
- the depth levels reach `attached_params` on submit and replace, and
are omitted when zero
  - `limit_depth_level` values of `3`, `0` and `null` on a response

## Note

The docs examples show `attached_type_display`, `trigger_status` and
`tag` in `attached_orders` as integers. This SDK, like the Rust core,
reads them as strings, so one of the two is wrong. See the note on
longbridge/openapi#607.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@hogan-yuan
hogan-yuan merged commit 1678704 into longbridge:main Oct 15, 2026
2 checks passed
hogan-yuan added a commit to longbridge/openapi that referenced this pull request Oct 15, 2026
Follows
[longbridge/developers#1189](longbridge/developers#1189),
which documents depth levels for attached (take-profit / stop-loss)
orders.

## Changes

| Spec | SDK |
|---|---|
| Submit / replace order `attached_params.profit_taker_depth_level` /
`stop_loss_depth_level` (int32, valid when `activate_order_type` is
`LIT`) | `SubmitAttachedParams` / `ReplaceAttachedParams` gain both
fields; omitted from the request when unset |
| `today_orders` / `history_orders` / `order_detail`
`attached_orders[].limit_depth_level` (int32) |
`AttachedOrderDetail.limit_depth_level`; `0`, `null` or a missing field
read as unset, matching `Order.limit_depth_level` |

All six layers, per the checklist in `CLAUDE.md`:

- **Rust:** `profit_taker_depth_level(i32)` /
`stop_loss_depth_level(i32)` builders and
`AttachedOrderDetail.limit_depth_level: Option<i32>`. A small
`int32_opt_null_or_0_is_none` deserializer keeps the new response field
tolerant of `null`.
- **C:** `const int32_t *` fields **appended at the end** of
`CSubmitAttachedParams`, `CReplaceAttachedParams` and
`CAttachedOrderDetail` (header regenerated by cbindgen).
- **C++:** `std::optional<int32_t>` on the three types plus both
conversion directions.
- **Java:** `setProfitTakerDepthLevel(Integer)` /
`setStopLossDepthLevel(Integer)` on both params classes and
`AttachedOrderDetail.getLimitDepthLevel()`, with the JNI layer to match.
- **Node.js:** `profitTakerDepthLevel?` / `stopLossDepthLevel?` and `get
limitDepthLevel(): number | null`. `index.d.ts` was regenerated;
`index.js` is unchanged.
- **Python:** `profit_taker_depth_level` / `stop_loss_depth_level`
keyword arguments on both params classes and
`AttachedOrderDetail.limit_depth_level`, plus the `openapi.pyi` stub.

Go SDK counterpart: longbridge/openapi-go#132.

## Verification

- `cargo test -p longbridge --lib`: 73 passed. New tests cover the
request serialization of both params types (omitted when unset), and
`limit_depth_level` for `0`, `3`, `null` and a missing field.
- `cargo clippy --all --all-features`: no new warnings. `cargo +nightly
fmt --all` was applied.
- `cargo build -p longbridge-c`, `clang++ -fsyntax-only` on
`cpp/src/trade_context.cpp`, `cargo build -p longbridge-java` + `mvn
compile`, `cargo check -p longbridge-python`, and `npm run build:debug`.
- Not verified against a live order with attached orders.

## Note: possible docs/SDK mismatch, out of scope here

The docs example in #1189 (and the existing docs) shows
`attached_type_display`, `trigger_status` and `tag` in `attached_orders`
as **integers**, e.g. `"attached_type_display": 2`. Both the Rust and Go
SDKs parse these as **strings** (`STOP_LOSS`, `NOT_USED`, `Normal`), and
the docs example fails to deserialize as written. One of them is wrong.
It should be checked against a real response that has attached orders.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
hogan-yuan added a commit that referenced this pull request Oct 15, 2026
Port #1189 into the API Reference spec:
attached_params.profit_taker_depth_level / stop_loss_depth_level on
submit_order and replace_order (trilingual text from the merged docs).
hogan-yuan added a commit that referenced this pull request Oct 15, 2026
…er (#1257)

Adds the /docs/api API Reference: an openapi.yaml-driven renderer covering the REST endpoints and WebSocket commands with trilingual (en / zh-CN / zh-HK) content, multi-language raw-HTTP request samples, Try-it, search, and machine-readable .md pages plus llms.txt / llms-full.txt entries.

Also restores six operations that were lost when generated modules shared a path (order_detail, cancel_order, list_watchlist_groups, delete_watchlist_group, list_topic_replies, list_grid_orders), keeps action verbs in endpoint names so endpoints sharing a resource noun stay distinguishable, and ports the time-condition order (#1289), DelayedNotReported (#1263) and attached-order depth level (#1189) docs into the spec.
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.

2 participants