☰
Login
Signup
Home
›
Python client
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
12.8K
All Categories
111
Node JS client
35
Go client
748
.Net API client
350
Kite Publisher
530
.Net / VBA / Excel (3rd party)
420
Algorithms and Strategies
940
Java client
979
API clients
392
PHP client
3.6K
Python client
325
Mobile and Desktop apps
1.3K
Market data (WebSockets)
3.1K
General
In this Discussion
June 2022
ashwinjain1
June 2022
sujith
June 2022
SRIJAN
order_margins not working for BANKNIFTY22JUNFUT
ashwinjain1
June 2022
in
Python client
order_margins is not returning the correct margins for the first 100 units of BANKNIFTY22JUNFUT. Details below -
Order Quantity - 25 (1 lot)
kite.order_margins([{"variety":kite.VARIETY_REGULAR, "exchange":kite.EXCHANGE_NFO, "tradingsymbol":"BANKNIFTY22JUNFUT", "transaction_type":kite.TRANSACTION_TYPE_BUY, "quantity":25, "product":kite.PRODUCT_NRML, "order_type":kite.ORDER_TYPE_MARKET}])
Out[51]:
[{'type': 'equity',
'tradingsymbol': 'BANKNIFTY22JUNFUT',
'exchange': 'NFO',
'span': 0,
'exposure': 0,
'option_premium': 0,
'additional': 0,
'bo': 0,
'cash': 0,
'var': 0,
'pnl': {'realised': 0, 'unrealised': 0},
'leverage': 1,
'total': 0
}]
Order Quantity - 50 (2 lots)
kite.order_margins([{"variety":kite.VARIETY_REGULAR, "exchange":kite.EXCHANGE_NFO, "tradingsymbol":"BANKNIFTY22JUNFUT", "transaction_type":kite.TRANSACTION_TYPE_BUY, "quantity":50, "product":kite.PRODUCT_NRML, "order_type":kite.ORDER_TYPE_MARKET}])[0]
Out[52]:
{'type': 'equity',
'tradingsymbol': 'BANKNIFTY22JUNFUT',
'exchange': 'NFO',
'span': 0,
'exposure': 0,
'option_premium': 0,
'additional': 0,
'bo': 0,
'cash': 0,
'var': 0,
'pnl': {'realised': 0, 'unrealised': 0},
'leverage': 1,
'total': 0
}
Order Quantity - 75 (3 lots)
kite.order_margins([{"variety":kite.VARIETY_REGULAR, "exchange":kite.EXCHANGE_NFO, "tradingsymbol":"BANKNIFTY22JUNFUT", "transaction_type":kite.TRANSACTION_TYPE_BUY, "quantity":75, "product":kite.PRODUCT_NRML, "order_type":kite.ORDER_TYPE_MARKET}])[0]
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
DEBUG:urllib3.connectionpool:
https://api.kite.trade:443
"POST /margins/orders HTTP/1.1" 200 None
Out[53]:
{'type': 'equity',
'tradingsymbol': 'BANKNIFTY22JUNFUT',
'exchange': 'NFO',
'span': 0,
'exposure': 0,
'option_premium': 0,
'additional': 0,
'bo': 0,
'cash': 0,
'var': 0,
'pnl': {'realised': 0, 'unrealised': 0},
'leverage': 1,
'total': 0
}
Order Quantity - 100 (4 lots)
kite.order_margins([{"variety":kite.VARIETY_REGULAR, "exchange":kite.EXCHANGE_NFO, "tradingsymbol":"BANKNIFTY22JUNFUT", "transaction_type":kite.TRANSACTION_TYPE_BUY, "quantity":100, "product":kite.PRODUCT_NRML, "order_type":kite.ORDER_TYPE_MARKET}])[0]
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
DEBUG:urllib3.connectionpool:
https://api.kite.trade:443
"POST /margins/orders HTTP/1.1" 200 None
Out[54]:
{'type': 'equity',
'tradingsymbol': 'BANKNIFTY22JUNFUT',
'exchange': 'NFO',
'span': 936.2699999999895,
'exposure': 0,
'option_premium': 0,
'additional': 0,
'bo': 0,
'cash': 0,
'var': 0,
'pnl': {'realised': 0, 'unrealised': 0},
'leverage': 1,
'total': 936.2699999999895
}
Order Quantity - 125 (5 lots)
kite.order_margins([{"variety":kite.VARIETY_REGULAR, "exchange":kite.EXCHANGE_NFO, "tradingsymbol":"BANKNIFTY22JUNFUT", "transaction_type":kite.TRANSACTION_TYPE_BUY, "quantity":125, "product":kite.PRODUCT_NRML, "order_type":kite.ORDER_TYPE_MARKET}])[0]
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
DEBUG:urllib3.connectionpool:
https://api.kite.trade:443
"POST /margins/orders HTTP/1.1" 200 None
Out[55]:
{'type': 'equity',
'tradingsymbol': 'BANKNIFTY22JUNFUT',
'exchange': 'NFO',
'span': 126750.95999999999,
'exposure': 18012.163250000005,
'option_premium': 0,
'additional': 0,
'bo': 0,
'cash': 0,
'var': 0,
'pnl': {'realised': 0, 'unrealised': 0},
'leverage': 1,
'total': 144763.12325
}
Tagged:
Python Client
Margins API Call
wrong calculations of margins
order_margins
SRIJAN
June 2022
edited June 2022
It's working perfectly fine for me.
You might be having open short positions .
Margin Calculation API considers existing positions as well.
https://kite.trade/docs/connect/v3/margins/#margin-calculation
sujith
June 2022
@ashwinjain1
,
You may also check if you have any pending orders.
ashwinjain1
June 2022
@SRIJAN
@sujith
This helped. Thank you very much.
This discussion has been closed.
You might be having open short positions .
Margin Calculation API considers existing positions as well.
https://kite.trade/docs/connect/v3/margins/#margin-calculation
You may also check if you have any pending orders.