basket_order_margins API doesnt return accurate margins for an expiry contract after 920AM

I have posted this query as a ticket in Support Portal at

Posting it here hoping for a better resolution.

When I am trying to fetch margin required for a basket combination using basket_order_margins API, I observe that margin returned is inaccurate beyond 920AM and only for an expiry contract. I say inaccurate on the basis of margin shown for the same combination in kite console.

Pasting the relevant code used to fetch margin and the margin returned. Tested yesterday on BN contract(expiry) around 945AM

tradingsymbol_CE = 'BANKNIFTY2420745900CE'
tradingsymbol_PE = 'BANKNIFTY2420746100PE'

exchange = kite.EXCHANGE_NFO
quantity = 15

margin_requirement_arr = []
margin_requirement_arr.append({'variety': kite.VARIETY_REGULAR, 'tradingsymbol': tradingsymbol_CE,
'exchange': exchange, 'transaction_type': kite.TRANSACTION_TYPE_SELL,
'quantity': quantity, 'order_type': kite.ORDER_TYPE_MARKET,
'product': kite.PRODUCT_MIS})

margin_requirement_arr.append({'variety': kite.VARIETY_REGULAR, 'tradingsymbol': tradingsymbol_PE,
'exchange': exchange, 'transaction_type': kite.TRANSACTION_TYPE_SELL,
'quantity': quantity, 'order_type': kite.ORDER_TYPE_MARKET,
'product': kite.PRODUCT_MIS})

print("\nBasket Combination:")
print("SELL\t%s\tQty:%d" % (tradingsymbol_CE, quantity), flush=True)
print("SELL\t%s\tQty:%d" % (tradingsymbol_PE, quantity), flush=True)

margin_per_lot = kite.basket_order_margins(margin_requirement_arr)



Basket Combination:
SELL BANKNIFTY2420745900CE Qty:15
SELL BANKNIFTY2420746100PE Qty:15
{'initial': {'type': '', 'tradingsymbol': '', 'exchange': '', 'span': 23513.39999999944, 'exposure': 27661.788409091532, 'option_premium': 0, 'additional': 0, 'bo': 0, 'cash': 0, 'var': 0, 'pnl': {'realised': 0, 'unrealised': 0}, 'leverage': 0, 'charges': {'transaction_tax': 0, 'transaction_tax_type': '', 'exchange_turnover_charge': 0, 'sebi_turnover_charge': 0, 'brokerage': 0, 'stamp_duty': 0, 'gst': {'igst': 0, 'cgst': 0, 'sgst': 0, 'total': 0}, 'total': 0}, 'total': 51175.18840909097},

From the outset, the margin value is not correct.

When checked the same in kite, margin is around 1.2lac. Refer Screenshot.

please look into this.

When I probed further into the contents of response, I observed that 'span_margin' is fixed at the same value for any combination of basket around the time and beyond. Whereas I see it different for different combinations when checked before 920AM or when checked for an non-expiry contract anytime during the day.

Is this intended behaviour?
Sign In or Register to comment.