cli: Improve JSON output quality across IPO, search, deposits, and news commands#186
Open
cli: Improve JSON output quality across IPO, search, deposits, and news commands#186
Conversation
目标:基于 `docs/api-reference.md` 中的接口,为 `longbridge-terminal` CLI 开发对应的子命令, commit 和 pr 都使用英文 --- ## 🤖 Generated with Endless Co-authored-by: 老袁 Yuan Zhanghong <zhanghong.yuan@longbridge-inc.com>
`crate::openapi::quote().member_id()` returns `Result<i64, longbridge::Error>`, but the helper declared `Result<i64>` (i.e. `anyhow::Result`). Add `.map_err(anyhow::Error::from)` to convert the error type explicitly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
目标:基于 `docs/api-reference.md` 中的接口,为 `longbridge-terminal` CLI 开发对应的子命令, commit 和 pr 都使用英文 --- ## 🤖 Generated with Endless Co-authored-by: 老袁 Yuan Zhanghong <zhanghong.yuan@longbridge-inc.com>
- Fix all new command API paths to use OpenAPI paths (/v1/...) - Remove delete-marked features: pnl-calendar, ipo submit/withdraw - Move search under news/topic subcommands (news search, topic search) - Fix val_str null handling to return "-" consistently - Add fmt_ts() for RFC 3339 timestamp formatting of created_at fields - Fix Pretty mode for single-object commands to use print_json_value - Add empty-array guard in institution-rating --history Pretty output Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add currency column to ipo subscriptions table - Format sub_deadline as RFC 3339 timestamp - Add state_stage "0" => "filing" mapping - Format news search publish_at using RFC 3339 timestamp Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- state_stage 0 => "pending" (confirmed from API docs) - Add time column to topic search using created_at_timestamp Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ws commands - IPO: replace transform_symbol_item with transform_ipo_list_item; convert counter_id→symbol, state_stage/state/sub_state enums→labels, unix ts→RFC 3339; fix wait-listing to use correct ipos response key (was list) - Search: switch news/topic transforms to whitelist approach; add excerpt and URL (.md suffix) to results - Deposits: add DEPOSIT_SKIP to remove noisy fields from JSON; improve Pretty table to show id, type, and state - News/topics/filings: fix unix timestamps in JSON output (use format_datetime) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rename command withdrawal-cards → bank-cards - Fix Pretty output: use correct list key and actual field names - Add swift_code and region columns to Pretty table - Add JSON transform with whitelist fields and status enum labels - Fix deposits JSON/Pretty: format created_at timestamp as RFC 3339 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- `ipo subscriptions`, `ipo wait-listing`, `ipo listed`: now fetch both HK and US endpoints concurrently and display results in separate sections - `ipo calendar`: split Pretty output into HK / US sections; use `fmt_ts_opt` for `sub_date`/`sub_end_date` to show `-` for US IPOs with zero/negative timestamps; format `ipo_date` from YYYYMMDD string or unix timestamp - `ipo us-listed`: align columns with HK listed view - `bank-cards`: rename from `withdrawal-cards`, fix JSON whitelist/status enum, fix Pretty field names and add swift/region columns - `deposits`: format `created_at` as RFC 3339 in both JSON and Pretty - `--limit` → `--count` (with `--limit` alias) on all paginated IPO, ATM, news-search, and topic-search commands Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- US listed: read ipo_date (not listing_date), format amount with format_volume - Calendar: use date-only format (YYYY-MM-DD) for all date columns via fmt_date_opt - HK listed: also use fmt_date_opt for ipo_date consistency - Add fmt_date_opt helper: unix ts > 0 → date only, 0/neg → "-", YYYYMMDD string → YYYY-MM-DD Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The ipo_change field is an absolute price change, not a percentage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both HK and US ipo_change fields are percentage values. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace table layout with key-value format for `ipo detail` Pretty output - Truncate long text fields (Description, Use of Proceeds) to 200 chars - Limit Underwriters to 5 entries with (+N) suffix for extras - Remove unused `fmt_ts_opt` function - Fix `hk_listed_row`/`us_listed_row` clippy warnings Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- `ipo orders` now fetches active orders and history in parallel
- Pretty output shows "── Active ──" and "── History ──" sections
- JSON output: {"orders": [...], "history": [...]}
- Both sections include symbol (counter_id converted), name, qty, status, date
- Remove separate `ipo history` subcommand
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rename `orders` → `order` (list active + history) - Make `order detail <id>` a subcommand (was `order-detail`) - Remove the now-redundant `order <symbol>` (active-order by symbol) - Rewrite `order detail` Pretty output with kv format + timeline table Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fetch eligibility in parallel with profile and timeline; show "Can Subscribe" in the Pretty output. Remove the standalone `ipo eligibility` subcommand. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-loss - Merge `ipo holdings` into `ipo detail`: fetches holdings in parallel with profile/timeline/eligibility; Pretty output shows holdings fields when non-zero; removes standalone `ipo holdings` command - Merge `ipo profit-loss-items` into `ipo profit-loss`: fetches summary and items in parallel; JSON output wraps both under "summary"/"items" keys; Pretty shows summary kv then items table; removes standalone `ipo profit-loss-items` command Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rewrite `financial-statement` Pretty output as a multi-period table: rows = metrics with level-based indentation, columns = up to 5 periods (FY or Q labels), rightmost column shows YoY for the latest period - Format large numbers with B/M/K/T suffixes; format YoY as ±X.X% - Fix CJK alignment using unicode-width for correct terminal column math - Change default `--kind` from non-functional ALL to IS - Remove `order-stats` command (endpoint /v1/asset/trade-analysis removed) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
ipo subscriptions,ipo wait-listing,ipo listed: merged HK + US into single command, displayed in separate sections (── HK ── / ── US ──)ipo calendar: split into HK/US sections; dates with zero/negative timestamps show-instead of invalid 1969 datesbank-cards(renamed fromwithdrawal-cards): JSON whitelist, status enum labels, correct field namesdeposits:created_atformatted as RFC 3339 in JSON and Pretty--limit→--count(with--limitalias) on paginated IPO, ATM, news/topic search commandsTest plan
longbridge ipo subscriptions— shows HK and US sectionslongbridge ipo wait-listing— shows HK and US sectionslongbridge ipo listed— shows HK and US sectionslongbridge ipo calendar— HK/US separated, no 1969 dates for USlongbridge bank-cards— correct fields and status labelslongbridge deposits—created_atis RFC 3339longbridge ipo listed --count 5and--limit 5both work🤖 Generated with Claude Code