Exchange Input Component
The Exchange class is a special type of string object. It behaves and evaluates like a string, but is extended with input validators and output formatters.
Use this class for functions with an 'exchange' parameter, or to convert between MICs, exchange acronyms or names.
Import
from openbb_core.provider.utils.exchange_utils import Exchange
Usage
Initialize the class with any of the accepted inputs:
- 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")
>>> e = Exchange("nasdaq")
>>> str(e)
'XNAS'
>>> e.mic
'XNAS'
>>> e.acronym
'NASDAQ'
>>> e.name
'NASDAQ - ALL MARKETS'
Properties
- mic : str - ISO 10383 Market Identifier Code.
- acronym : str - Exchange acronym/short name.
- name : str - Full exchange name.
Updating Definitions
If the definitions have become stale, you can refresh them in the environment with the update script.
python -m openbb_core.provider.utils.update_exchange_data