Track index spot values
Indices (NIFTY 50, BANKNIFTY, SENSEX) aren't tradable instruments themselves — you can't buy "NIFTY" directly — but you need their spot value constantly for option-chain ATM calculation, strategy signals, and sizing.
Index instrument tokens live under the NSE/BSE exchange, with instrument_type = EQ-like but not tradable
nse_df = kite.instruments("NSE")
nifty_row = nse_df[nse_df.tradingsymbol == "NIFTY 50"].iloc[0]
print(nifty_row["instrument_token"]) # 256265, a well-known constant
Common well-known index tokens (verify against your own instrument dump, these can vary):
INDEX_TOKENS = {
"NIFTY 50": 256265,
"NIFTY BANK": 260105,
"SENSEX": 265, # BSE
}
Fetching spot LTP
spot = kite.ltp(["NSE:NIFTY 50"])["NSE:NIFTY 50"]["last_price"]
Note the space in "NIFTY 50" — index trading symbols often contain spaces, unlike equity/F&O symbols. Always resolve via the instrument master rather than guessing the exact string.
Index vs futures spot — they diverge
The index spot value and the near-month futures price are *not* the same — futures trade at a premium/discount to spot (basis) reflecting cost of carry and market sentiment. If your strategy logic conflates "NIFTY price" (spot) with "NIFTY futures price," you'll compute wrong P&L or wrong ATM strikes near expiry when basis can swing meaningfully.
def get_basis(kite, spot_token: int, fut_token: int) -> float:
spot_price = kite.ltp([f"NSE:{spot_token}"]) # illustrative, adjust key format
fut_price = kite.ltp([f"NFO:{fut_token}"])
return fut_price - spot_price