Get commodity/currency margins
Equity, commodity (MCX), and currency (CDS) margins are tracked as separate pools on your account — funds in one don't automatically cover orders in another.
equity_margins = kite.margins(segment="equity")
commodity_margins = kite.margins(segment="commodity")
Or fetch both at once:
all_margins = kite.margins()
print(all_margins["equity"]["available"]["cash"])
print(all_margins["commodity"]["available"]["cash"])
F&O uses the equity segment's margin pool
Note: NFO (index/stock F&O) and BFO (BSE F&O) draw from the equity margin segment, not a separate one — only MCX (commodities) and CDS (currency derivatives) have their own pools. This trips people up: funding your "equity" segment is what funds your options trading too.
def get_segment_cash(kite, segment: str) -> float:
"""segment: 'equity' (covers NSE/BSE/NFO/BFO) or 'commodity' (MCX) or 'cds' (currency)."""
return kite.margins(segment=segment)["available"]["cash"]
Practical rule for a multi-strategy bot
If you run strategies across equity/F&O and commodities from the same bot, track available cash per segment, and never let one strategy's sizing logic read the wrong segment's number — that's a silent source of either under-utilized capital or, worse, a strategy that thinks it has room it doesn't.