Repository navigation
cli: Honor --count in rank - #336
Merged
Merged
Conversation
GET /v1/quote/market/rank/list takes no page-size parameter (only key and need_article), so the `size` we forwarded was dropped and `rank --key` always printed the whole board (typically 50 rows) regardless of --count. Stop sending `size` and truncate `lists` to --count locally, for both the JSON and table output.
hogan-yuan
added a commit
that referenced
this pull request
Oct 26, 2026
Bump `0.30.0` → `0.31.0` for release. ## Included since v0.30.0 - **Longbridge US accounts** (#337): `assets`, `portfolio`, `positions`, `cash-flow`, `exchange-rate`, `order` (today and `--history`) and `order detail` call the US asset and order APIs for US accounts, built on longbridge SDK 5.3.0. Their `--format json` output keeps the AP keys and shape; US-only fields are marked `(US only)` in `--schema`, and `check --format json` reports `dc_region`. - **`order executions` on US accounts** (#337): history comes from `/v1/trade/execution/history`, which is not filtered by execution time and can lag across days; `side` is filled from the account's orders and shows `Unknown` when it can't be resolved. - **AP-only commands and `serve` methods** (#337): `fund-positions` and `margin-ratio` on a US account fail before sending a request and name the alternative; `serve` gains `trade.us_query_orders` and `trade.us_order_detail`. - **Safer US cancel / replace** (#337): the preview refuses to issue a confirmation code when the order can't be fetched, and US order ids must be digits. - **`rank --count`** (#336) is honored. Tag `v0.31.0` after merge to trigger the release build. 🤖 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.
Problem
longbridge rank --key <key> --count Nignores--count(alias--limit, default 20) and always prints the whole board:rank --key hot_all-us --count 2 --format jsonreturns 50 rows on 0.29.0, and the code onmainis unchanged.Root cause
GET /v1/quote/market/rank/listhas no page-size parameter; it accepts onlykeyandneed_article(per the API reference; the Rust and Go SDKs'rank_listexpose no size either). Thesizewe forwarded was dropped, and the response was printed as-is.Fix
Stop sending
size; truncateliststo--countlocally before rendering, so both--format jsonand the table honor it.Verification
test_truncate_rank_lists.rank --key hot_all-us --count 2 --format json→ 2 rows (was 50)rank --key hot_all-us --format json→ 20 rows (the documented default; was 50)rank --key hot_all-us --count 3→ 3-row tablecargo clippyreports the same 49 pre-existing pedantic errors before and after this change (local clippy 0.1.99); none are in the changed lines.Same issue was fixed in longbridge-mcp in longbridge/longbridge-mcp#169.
🤖 Generated with Claude Code