☰
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
13.8K
All Categories
0
Incidents
154
Node JS client
40
Go client
793
.Net API client
378
Kite Publisher
537
.Net / VBA / Excel (3rd party)
457
Algorithms and Strategies
993
Java client
1.1K
API clients
404
PHP client
4K
Python client
346
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.3K
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.