Files
John Seong 616c54d79e feat(platform): standardize exchange inputs with ISO 10383 MIC codes (#7351)
* feat(platform): standardize exchange inputs with ISO 10383 MIC codes

Add Exchange type in provider utils that standardizes exchange inputs across
providers using ISO 10383 Market Identifier Codes (MIC).

Similar to the Country type from PR #7333, this allows providers to accept:
- ISO 10383 MIC codes (e.g., 'XNAS', 'XNYS')
- Exchange acronyms (e.g., 'NASDAQ', 'NYSE')
- Full exchange names (e.g., 'New York Stock Exchange')
- lower_snake_case names (e.g., 'new_york_stock_exchange')

The Exchange class inherits from str (storing the MIC code) while providing
access to mic, acronym, name, country, and city properties.

Example usage in FMP equity screener demonstrates provider integration pattern:
- exchange: Exchange | None with validator for provider-specific validation
- Maps Exchange.acronym to FMP's expected lowercase exchange codes

Addresses part of #6969

* refactor(platform): use ExchangeData TypedDict for proper typing

- Add ExchangeData TypedDict with explicit field types (consistent with CountryData)
- Update function signatures and class attributes to use ExchangeData
- Add _last_updated metadata to exchange_data.json
- Add Wikipedia reference URL to docstring

Aligns Exchange implementation with Country pattern from PR #7352.

* fix: add missing major exchanges including Cboe (XCBO, XCBT)

* refactor: expand to full ISO 10383 MIC list (2,272 active MICs)

Address review feedback to include all active MICs, not just curated majors.

- Expand exchange_data.json from 66 to 2,272 active MICs (operating + segments)
- Remove country and city fields (out of scope for this PR)
- Add scripts/update_exchange_data.py to regenerate from official ISO 20022
  CSV source using stdlib only (no external dependencies)
- Use first-write-wins lookup with operating MICs ordered before segments
  to resolve acronym collisions (e.g. LSE -> XLON, not XPVT)
- Update tests to reflect simplified data model

* feat: add city, country, and website fields to exchange data

* refactor: move update_exchange_data.py to provider utils

* style: fix black formatting in update_exchange_data.py

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
2026-02-25 19:17:02 +00:00
..