How to get total margin required for a basket of orders

omkarkondhekar
omkarkondhekar edited November 2020 in API clients
Hello All,

Trying to figure out the total margin requirement for the basket of orders. REST call to https://api.kite.trade/margins/orders provided the margin for individual orders but not overall margin as orders sent in argument consisted of both buy and sell to qualify for margin benefit under new SEBI rules.

Here is what is sent:
payload = [{"exchange": "NFO",
"tradingsymbol": "BANKNIFTY20N1928200PE",
"transaction_type": "BUY",
"variety": "regular",
"product": "NRML",
"order_type": "MARKET",
"quantity": 25,
"price": 0,
"trigger_price": 0},
{"exchange": "NFO",
"tradingsymbol": "BANKNIFTY20N1928300PE",
"transaction_type": "SELL",
"variety": "regular",
"product": "NRML",
"order_type": "MARKET",
"quantity": 25,
"price": 0,
"trigger_price": 0},
{"exchange": "NFO",
"tradingsymbol": "BANKNIFTY20N1928300CE",
"transaction_type": "SELL",
"variety": "regular",
"product": "NRML",
"order_type": "MARKET",
"quantity": 25,
"price": 0,
"trigger_price": 0},
{"exchange": "NFO",
"tradingsymbol": "BANKNIFTY20N1928400CE",
"transaction_type": "BUY",
"variety": "regular",
"product": "NRML",
"order_type": "MARKET",
"quantity": 25,
"price": 0,
"trigger_price": 0}]

Here is what is received:
{'data': [{'additional': 0,
'bo': 0,
'cash': 0,
'exchange': 'NFO',
'exposure': 0,
'option_premium': 11131.25,
'pnl': {'realised': 0, 'unrealised': 0},
'span': 0,
'total': 11131.25,
'tradingsymbol': 'BANKNIFTY20N1928200PE',
'type': 'equity',
'var': 0},
{'additional': 0,
'bo': 0,
'cash': 0,
'exchange': 'NFO',
'exposure': 14386.125000000002,
'option_premium': 0,
'pnl': {'realised': 0, 'unrealised': 0},
'span': 134402.5,
'total': 148788.625,
'tradingsymbol': 'BANKNIFTY20N1928300PE',
'type': 'equity',
'var': 0},
{'additional': 0,
'bo': 0,
'cash': 0,
'exchange': 'NFO',
'exposure': 14394.374999999998,
'option_premium': 0,
'pnl': {'realised': 0, 'unrealised': 0},
'span': 140,
'total': 14534.374999999998,
'tradingsymbol': 'BANKNIFTY20N1928300CE',
'type': 'equity',
'var': 0},
{'additional': 0,
'bo': 0,
'cash': 0,
'exchange': 'NFO',
'exposure': 0,
'option_premium': 11506.25,
'pnl': {'realised': 0, 'unrealised': 0},
'span': 0,
'total': 11506.25,
'tradingsymbol': 'BANKNIFTY20N1928400CE',
'type': 'equity',
'var': 0}],
'status': 'success'}

Here is what is sent:
payload = [{'exchange': 'CDS',
'tradingsymbol': 'USDINR20N1375.25PE',
'transaction_type': 'BUY',
'variety': 'regular',
'product': 'NRML',
'order_type': 'MARKET',
'quantity': 1,
'price': 0,
'trigger_price': 0},
{'exchange': 'CDS',
'tradingsymbol': 'USDINR20N1375.5PE',
'transaction_type': 'SELL',
'variety': 'regular',
'product': 'NRML',
'order_type': 'MARKET',
'quantity': 1,
'price': 0,
'trigger_price': 0},
{'exchange': 'CDS',
'tradingsymbol': 'USDINR20N1375.5CE',
'transaction_type': 'SELL',
'variety': 'regular',
'product': 'NRML',
'order_type': 'MARKET',
'quantity': 1,
'price': 0,
'trigger_price': 0},
{'exchange': 'CDS',
'tradingsymbol': 'USDINR20N1375.75CE',
'transaction_type': 'BUY',
'variety': 'regular',
'product': 'NRML',
'order_type': 'MARKET',
'quantity': 1,
'price': 0,
'trigger_price': 0}]

Here is what is received:
{'data': [{'additional': 0,
'bo': 0,
'cash': 0,
'exchange': 'CDS',
'exposure': 0,
'option_premium': 0,
'pnl': {'realised': 0, 'unrealised': 0},
'span': 0,
'total': 0,
'tradingsymbol': 'USDINR20N1375.25PE',
'type': 'equity',
'var': 0},
{'additional': 0,
'bo': 0,
'cash': 0,
'exchange': 'CDS',
'exposure': 560.2124999999999,
'option_premium': 0,
'pnl': {'realised': 0, 'unrealised': 0},
'span': 2457.46,
'total': 3017.6724999999997,
'tradingsymbol': 'USDINR20N1375.5PE',
'type': 'equity',
'var': 0},
{'additional': 0,
'bo': 0,
'cash': 0,
'exchange': 'CDS',
'exposure': 560.2124999999999,
'option_premium': 0,
'pnl': {'realised': 0, 'unrealised': 0},
'span': 0,
'total': 560.2124999999999,
'tradingsymbol': 'USDINR20N1375.5CE',
'type': 'equity',
'var': 0},
{'additional': 0,
'bo': 0,
'cash': 0,
'exchange': 'CDS',
'exposure': 0,
'option_premium': 0,
'pnl': {'realised': 0, 'unrealised': 0},
'span': 0,
'total': 0,
'tradingsymbol': 'USDINR20N1375.75CE',
'type': 'equity',
'var': 0}],
'status': 'success'}

Please help
Sign In or Register to comment.