Skip to content

fix(fundamental): send comparison_symbols as a query array (gateway now accepts it) - #581

Merged
hogan-yuan merged 1 commit into
mainfrom
fix/valuation-comparison-symbols
Sep 14, 2026
Merged

hogan-yuan merged 1 commit into
mainfrom
fix/valuation-comparison-symbols

Conversation

@hogan-yuan

@hogan-yuan hogan-yuan commented Aug 28, 2026

Copy link
Copy Markdown
Member

Background

PR #562 switched valuation_comparison's request parameter from
comparison_counter_ids to comparison_symbols, but the gateway did not support
it at the time, so a temporary stopgap was added (the SDK locally converted the
symbol back to a counter-id and kept sending the legacy comparison_counter_ids).

Now

The gateway now accepts comparison_symbols, but only in the standard HTTP
array format
(repeated key comparison_symbols=A&comparison_symbols=B, or
[]), not a JSON array string. Measured:

Format Test env
comparison_symbols=["9988.HK","3690.HK"] (JSON string) ❌ 500
comparison_symbols=9988.HK&comparison_symbols=3690.HK (repeated key) ✅ 200
comparison_symbols[]=... (bracket) ✅ 200

Changes

  • Remove the stopgap (symbol_to_counter_id shim + local comparison_counter_ids conversion).
  • Change the query field to comparison_symbols: Option<Vec<String>>, serialized by qs into repeated keys — which is exactly what the gateway expects.
  • Public API signature unchanged (it has always taken Option<Vec<String>> of user symbols).

Verification

  • cargo clippy --all --all-features 0 errors, cargo +nightly fmt clean.
  • Test env, real SDK: 700.HK + 2/3/4 comparison symbols; returns the subject plus all comparison peers, symbols all in user-symbol form ✅
  • Production, real SDK (openapi.longbridge.com, re-tested 2026-09-14): 700.HK + 2/3/4 comparison symbols all ✅ 200, returning the subject plus every comparison peer, symbols all in user-symbol form (not counter-ids), with PE/PB/market-cap fields populated. The code 13 previously returned by production no longer reproduces.

✅ Release order (blocker resolved)

The gateway fix was only on the test env; production still returned code 13 for the new format. This PR had to wait until the gateway production deployment shipped before merge/release.

The gateway's new-format fix is now live in production and has been re-verified (see Verification above). The previous merge/release blocker is satisfied, so this PR can be merged/released normally.

…ow accepts it)

The gateway now supports the comparison_symbols parameter on
GET /v1/quote/compare/valuation, expecting a standard HTTP array
(repeated keys: comparison_symbols=A&comparison_symbols=B), not a JSON
array string. Drop the temporary stopgap that converted the peer symbols
to counter-ids and sent the legacy comparison_counter_ids parameter;
pass the user symbols straight through as Option<Vec<String>>, which the
qs serializer emits as repeated keys. Removes the symbol_to_counter_id
shim added for the stopgap.

Verified live on staging (2/3/4 peers return the stock plus all peers).
Note: the gateway fix is on staging first; production still answers this
new format with code 13 until its rollout lands.
@hogan-yuan
hogan-yuan merged commit f2c8b94 into main Sep 14, 2026
56 checks passed
@hogan-yuan
hogan-yuan deleted the fix/valuation-comparison-symbols branch September 14, 2026 03:08
@hogan-yuan hogan-yuan mentioned this pull request Sep 14, 2026
hogan-yuan added a commit that referenced this pull request Sep 14, 2026
Release **v5.0.0**.

Bumps the workspace version `4.5.0` → `5.0.0` and closes out the
`[Unreleased]`
CHANGELOG section as `[5.0.0] - 2026-09-14`. Major bump: this release
carries
breaking API changes across every language binding.

Base includes everything on `main` through #581 (the
`comparison_symbols`
switch, verified live against production) and #591 (`history_executions`
paging).

### Breaking changes (7)

- Removed `GridContext.submit_strategy_questionnaire` (`POST
/v1/record/questionnaire`) and `SubmitStrategyQuestionnaireOptions`
across all bindings.
- `WarrantStatus` gains an `Unknown` variant (first variant) — shifts
the ordinal of existing variants in C/C++/Java/Node.js/Python.
- `WarrantInfo.expiry_date` is now optional (empty server dates no
longer fail the whole `warrant_list`).
- `FundamentalContext.industry_rank` takes typed `IndustryRankIndicator`
/ `IndustryRankSortType` (+ `Market`) instead of three free-form
strings.
- `FundamentalContext.us_financial_statement` takes a typed
`FinancialStatementKind` instead of a free-form `kind` string.
- Write methods on `AlertContext` (`add`/`update`/`delete`) and
`SharelistContext`
(`delete`/`add_securities`/`remove_securities`/`sort_securities`) now
return `()` / `void` / `Promise<void>`.
- `FundamentalContext.ratings` (`GET /v1/quote/ratings`) is temporarily
unavailable (server-side 暂不开放) — commented out across all bindings;
`StockRatings` types retained.

Added (7), Changed (14), and Fixed (12) are detailed in `CHANGELOG.md`.

### Changelog housekeeping

Consolidated the interleaved duplicate `[Unreleased]` section headers
(`Breaking changes` ×2, `Fixed` ×3) into one section each, ordered
Breaking → Added → Changed → Fixed, and removed 4 duplicate Fixed
entries
(the C/C++ null-pointer, C++ `AssetContext`, and C `lb_statement_item_t`
items
each appeared twice). No entry content was dropped other than the
duplicates.
Added one new entry for #581 under Changed.

### To publish after merge

1. Fast-forward the `release` branch to the merge commit: `git push
origin <merge-sha>:release` (triggers the Release workflow → crates.io /
PyPI / npm / Maven Central / S3).
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.

1 participant