order_margins api

zuser
Hi,
I am facing some issue with calling order_margins api. It's throwing the following error.
kiteconnect.exceptions.InputException: invalid json

API call code is as follow.
kite.order_margins({'order_id':XXXXX,'exchange':'NFO', 'tradingsymbol':'XXXXXXXX','transaction_type':'SELL','variety':'regular','product':'MIS','order_type':'MARKET','quantity':75,'price':0,'trigger_price':0})

Any example code here would help.
Thanks.
  • sujith
    You can print the exception message to know the exact error message. You can check out the exception structure here.
  • Alogji
    @zuser example code (Based on available margin, how many option lots of both PE and CE can be shorted/written)


  • zuser
    Thanks @Algoji.
    I am able to get the margin info. However the margin of all live trades aren't summing upto the total used margin! :(
  • Alogji
    Alogji edited May 3
    It is dynamic, so it keeps changing. I have manually verified it when market hours got over. Then number you get using the code exactly matches with margin required for a basket.
  • rakeshr
    However the margin of all live trades aren't summing upto the total used margin!
    It is dynamic, so it keeps changing.
    Yes, that's correct. You can use margin APIs to get an idea of the approx margin required(unless there is huge volatility in the next second and it decreases or increases drastically).
Sign In or Register to comment.