feat: full counter_id directory + public counter module#537
Merged
Conversation
The embedded ETF dictionary was outdated; newer ETFs (e.g. DRAM.US) were resolved to ST/... instead of ETF/... counter IDs, breaking ETF-specific APIs such as etf_asset_allocation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…7250 entries) Authoritative export also drops 14 previously misclassified non-ETF entries (closed-end funds / BDCs). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…sion Reimplement symbol_to_counter_id with the complete special-set lookup (ETF + IX + WT directories, leading-dot US indexes, HK leading-zero stripping) and expose it as the public longbridge::counter module (symbol_to_counter_id / index_symbol_to_counter_id / counter_id_to_symbol / is_etf), so downstream consumers (CLI / MCP) can drop their own copies of this logic and data. A-share numeric codes keep leading zeros (000001.SZ -> ST/SZ/000001). Co-Authored-By: Claude Opus 4.8 (1M context) <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
US-ETF.csv: 4574 → 7250 entries (drops 14 misclassified non-ETF entries)US-IX.csv(648 index entries) andUS-WT.csv(17693 warrant entries)symbol_to_counter_idwith the complete special-set lookup: ETF + IX + WT directories, leading-dot US indexes (.DJI.US→IX/US/.DJI), HK leading-zero stripping (00700.HK→ST/HK/700; A-share codes keep zeros:000001.SZ→ST/SZ/000001)longbridge::countermodule —symbol_to_counter_id/index_symbol_to_counter_id/counter_id_to_symbol/is_etf— so downstream consumers (CLI / MCP) can drop their own copies of this logic and dataWhy
The outdated embedded ETF dictionary caused newer ETFs (e.g.
DRAM.US) to resolve toST/US/DRAMinstead ofETF/US/DRAM, breaking ETF-specific APIs likeetf_asset_allocation. Centralizing the full directory + conversion in the SDK keeps CLI / MCP / SDK behavior consistent.Verification
cargo test -p longbridge --lib utils::counter: 22 passed (ported from the CLI's test suite + A-share leading-zero case)cargo clippy --all --all-features: cleanconstituent DRAM.USreturns all allocation groups🤖 Generated with Claude Code