Symbol Format
We standardize symbol format across broker, so you dont have to use broker specific symbol formats while switching across broker.
The symbol format that we use is Exchange:Token
. This token can be found in symbol master of most of the brokers.
We use this as a reference to find the correct token & exchange for the symbol.
Exchange format
Exchange Format | Description |
---|---|
NSE | For Cash trading in NSE |
NFO | For Futures and Options trading in NSE |
BSE | For Cash trading in BSE |
BFO | For Futures and Options trading in BSE |
MCX (coming soon) | For Futures and Options trading in MCX |
How to fetch Tokens ?
- You can use the contract-master to fetch the csv file of the tokens.
- Alternatively, you can also login to spark > Trade > WatchList > click on add to search the symbols to find the relevant symbol tokens.
- You can also do the same with our Rest API.
- Use the below code to find tokens using our sdk.
findTokens.py
# For Cash (NSE, BSE)
spk.getTokens("SBIN", "NSE")
# Find expiry dates for Futures
dates = spk.getExpiry("NIFTY", "NFO", "FUT")
dates = dates['data']
print(dates)
# Response : ['2024-05-30', '2024-06-27', '2024-07-25']
# Find expiry dates for Options
dates = spk.getExpiry("NIFTY", "NFO", "OPT")
dates = dates['data']
print(dates)
# Response : ['2024-05-30', '2024-06-06', '2024-06-13', '2024-06-20', '2024-06-27', '2024-07-04', '2024-07-25', '2024-09-26', '2024-12-26', '2025-03-27', '2025-06-26', '2025-12-24', '2026-06-25', '2026-12-31', '2027-06-24', '2027-12-30', '2028-06-29', '2028-12-28']
# Find tokens for FnO (NFO, BFO, MCX)
data = spk.getTokens("NIFTY", "NFO", expiry= dates[0], instrument= "OPT") # instrument = "OPT" for Options, "FUT" for Futures
data = data['data']
# Find for strike 21000 PE
strikeData = [i for i in data if i['strike'] == 21600 and i['symbol'][-2:] == "PE"]
print(strikeData[0])
# Response
# {
# 'token': '56882',
# 'symbol': 'NIFTY30MAY2421600PE',
# 'name': 'NIFTY',
# 'expiry': '2024-05-30',
# 'strike': 21600,
# 'lotsize': 25,
# 'instrumenttype': 'OPTIDX',
# 'exch_seg': 'NFO',
# 'tick_size': 0.05
# }