API to get total margin amount

s.swaroop
Hi, I am writing some logic and want to stick to my maximum funds available. For that I need to know the margin requirement for derivative trades so that I can decide if I can buy another lot or not. Because my code trades both options and futures, and margin requirement changes based on that, I need to know the correct margin requirement at the run time to be able to make a correct decision.

I don't want to place an order and wait for it to get rejected because of low balance. It can be disastrous for me in cases where I need to place 2 trades and one get accepted and other gets rejected. So I need to know the total margin needed before I place the order.

Is there any API available to pass in the set of positions and get the approximate margin requirement ? Pretty much what gets shown in the zerodha margin calculator ? Or any other solution you can think of ?
  • sujith
    You can get margins data from API and calculate it at your end.
    You can know more about endpoints here.
  • s.swaroop
    Thanks a lot. This is helpful. However, I don't see any API to get margin requirement for option selling though. Also what if I want to place a NIFTY18JANFUT BUY and NIFTY18JAN10500PE BUY - as this is a hedged position, the margin requirement should be less. How do I get this reduced margin value ?
  • sujith
    Hi,
    You can check out this thread.
Sign In or Register to comment.