Skip to content

feat: full counter_id directory + public counter module#537

Merged
huacnlee merged 3 commits into
mainfrom
update-us-etf-list
Jun 4, 2026
Merged

feat: full counter_id directory + public counter module#537
huacnlee merged 3 commits into
mainfrom
update-us-etf-list

Conversation

@huacnlee

@huacnlee huacnlee commented Jun 4, 2026

Copy link
Copy Markdown
Member

Summary

  1. Refresh & extend the embedded counter directories (from the instrument-management export):
    • US-ETF.csv: 4574 → 7250 entries (drops 14 misclassified non-ETF entries)
    • New US-IX.csv (648 index entries) and US-WT.csv (17693 warrant entries)
  2. Reimplement symbol_to_counter_id with the complete special-set lookup: ETF + IX + WT directories, leading-dot US indexes (.DJI.USIX/US/.DJI), HK leading-zero stripping (00700.HKST/HK/700; A-share codes keep zeros: 000001.SZST/SZ/000001)
  3. Expose the public longbridge::counter modulesymbol_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

Why

The outdated embedded ETF dictionary caused newer ETFs (e.g. DRAM.US) to resolve to ST/US/DRAM instead of ETF/US/DRAM, breaking ETF-specific APIs like etf_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: clean
  • Verified end-to-end against staging via the CLI: constituent DRAM.US returns all allocation groups

🤖 Generated with Claude Code

huacnlee and others added 3 commits June 4, 2026 14:33
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>
@huacnlee huacnlee changed the title fix: refresh embedded US ETF list feat: full counter_id directory + public counter module Jun 4, 2026
@huacnlee huacnlee merged commit 89e4436 into main Jun 4, 2026
56 checks passed
@huacnlee huacnlee deleted the update-us-etf-list branch June 4, 2026 06:45
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