Where can I find margin calculation formula?

I know Kite has basket margins API, but calling API for every price change (I'm using React) is far from ideal solution.

Is there any formula that returns the approx margin required for hedge position or guide me where I can find it?

I don't need exact price, a broad approx, for example, I just need to know if it will take 1 lac or 1.5 lakh.
This discussion has been closed.