Implementation:AI4Finance Foundation FinGPT resolve symbol
| Knowledge Sources | |
|---|---|
| Domains | Finance, Data_Acquisition |
| Last Updated | 2026-10-18 00:00 GMT |
Overview
Concrete tool for resolving user ticker symbols to market-specific price and news provider symbols provided by the FinGPT Forecaster.
Description
The resolve_symbol function maps a user-entered ticker (e.g., "RELIANCE") to a `MarketSymbol` dataclass with three fields: `display` (for UI), `price` (for yfinance), and `provider` (for Finnhub). For US markets, all three are the same. For Indian markets (NSE/BSE), the price symbol gets a `.NS`/`.BO` suffix for yfinance, and the provider gets an `NSE:`/`BSE:` prefix for Finnhub.
Usage
Import this function when you need to resolve tickers for multi-market support:
- Forecaster inference: Resolving user-input tickers for the Gradio demo.
- Multi-market support: Handling US, India NSE, and India BSE tickers.
Code Reference
Source Location
- Repository: FinGPT
- File: fingpt/FinGPT_Forecaster/market_symbols.py
- Lines: L1-36
Signature
@dataclass(frozen=True)
class MarketSymbol:
display: str
price: str
provider: str
def resolve_symbol(
symbol: str,
market: str = "US",
) -> MarketSymbol
Import
from market_symbols import resolve_symbol, MarketSymbol
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| symbol | str | Yes | User ticker (e.g., "AAPL", "RELIANCE", "NSE:RELIANCE") |
| market | str | No | Market type: "US", "INDIA_NSE", "INDIA_BSE" (default "US") |
Outputs
| Name | Type | Description |
|---|---|---|
| return value | MarketSymbol | Dataclass with display, price, provider fields |
Usage Examples
Resolve US and Indian Tickers
from market_symbols import resolve_symbol
# US market
us = resolve_symbol("AAPL", market="US")
# MarketSymbol(display='AAPL', price='AAPL', provider='AAPL')
# India NSE
nse = resolve_symbol("RELIANCE", market="INDIA_NSE")
# MarketSymbol(display='NSE:RELIANCE', price='RELIANCE.NS', provider='NSE:RELIANCE')
# India BSE
bse = resolve_symbol("RELIANCE", market="INDIA_BSE")
# MarketSymbol(display='BSE:RELIANCE', price='RELIANCE.BO', provider='BSE:RELIANCE')