I initiated a position with 240 quantities of BANKNIFTY, and the initial margin requirement was around ₹7.5 lakhs. Over the course of a few days, as the price moved and I made some adjustments to my position (still hedged with 4 legs), the margin requirement increased to around ₹9.5 lakhs.
I want to cap the margin at ₹9 lakhs going forward. How can I monitor the margin using the basket_order_margins() function (or any other method) to keep my position within this cap?
Additionally, based on my understanding, the basket_order_margins() function provides the initial and final margins required to initiate a trade, rather than the margin for an existing position. Is there a way to monitor or adjust the margin for ongoing positions effectively?
For better understanding, I will make adjustments once i am aware that positions' margin requirement is near 9 lakh. My question, how to fetch my margin requirement for the existing position?
In the basket order margin, the final margin indicates the margin that would be blocked after the position is initiated. That should address your requirement, isn't it? Margins are charged on a portfolio basis, they’re not the total of margins on individual positions so it is not possible to break this margin and find position-wise margin. So if you have a few other open positions this basket order final margin may help but may not be very accurate.