Today I lost 50k+ just because kite.basket_order_margins(basket) said margin is enough but when order was placed, I got margin errors for as little as 10K. I had even reduced 2 lots margin (~4L) from my original margin.
How to manage margin? Assume I have 10L. basket_order_margins() returns 9L margin is required for my basket. Should I rely on 9L? Because apparently, it's highly unreliable API.
I follow below steps to handle margin: 1. Fetch available margin using kite.margins() 2. Use 90% of available margin 3. Create basket and check basket margin using kite.basket_order_margins() 4. Execute only if basket margin <= 90% of available margin
@akhilesh_singla, you are considering "initial" margin or "final" margin. The initial margin is required while placing a basket order. If you compare the initial margin with the available margin and see the issue, please share the order details that you added to the basket to assist further.
I follow below steps to handle margin:
1. Fetch available margin using kite.margins()
2. Use 90% of available margin
3. Create basket and check basket margin using kite.basket_order_margins()
4. Execute only if basket margin <= 90% of available margin
Please refer to the kite connect documentation, the basket margin section.
The final margin is the total margin with the spread benefit.