Files
OpenBB/openbb_platform/core
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
..
2025-12-05 03:10:57 +00:00

Open Data Platform by OpenBB

Open Data Platform by OpenBB (ODP) is the open-source toolset that helps data engineers integrate proprietary, licensed, and public data sources into downstream applications like AI copilots and research dashboards.

ODP operates as the "connect once, consume everywhere" infrastructure layer that consolidates and exposes data to multiple surfaces at once: Python environments for quants, OpenBB Workspace and Excel for analysts, MCP servers for AI agents, and REST APIs for other applications.

Overview

The Core extension is used as the basis for building and integrating Open Data Platform Python packages. It provides the necessary classes and structures for standardizing and handling data. It is also responsible for generating a REST API and Python package static assets, which operate independently and interface with various consumption vehicles.

Typically, this library will be used as a project dependency, and extended.

Go to the documentation for information on getting started.

Prerequisites

  • Python >=3.10,<3.14
  • Familiarity with FastAPI and Pydantic.

Installation

Installing through pip:

pip install openbb-core

Note that, the openbb-core is an infrastructural component of the OpenBB Platform. It is not intended to be used as a standalone package.

Build

Build the Python application, with installed extensions, by running:

openbb-build

Key Features

  • Standardized Data Model (Data Class): A flexible and dynamic Pydantic model capable of handling various data structures.
  • Standardized Query Params (QueryParams Class): A Pydantic model for handling querying to different providers.
  • Dynamic Field Support: Enables handling of undefined fields, providing versatility in data processing.
  • Robust Data Validation: Utilizes Pydantic's validation features to ensure data integrity.
  • API Routing Mechanism (Router Class): Simplifies the process of defining API routes and endpoints - out of the box Python and Web endpoints.

Bugs

Report bugs on Github by opening a new issue, or commenting on an already open one, with all the details.

License

This project is licensed under the AGPL-3.0 License - see the LICENSE.md file for details.