-
Notifications
You must be signed in to change notification settings - Fork 52
Description
I am trying to get the liquidation price of an order, I have implemented the same formula given in the docs
Close Price (Short) = P × (1 + (M × V / W))
Close Price (Long) = P × (1 − (M × V / W))
But the prices I am getting are different not even in 1-5% delta
https://docs.dydx.exchange/?json#liquidations
Here P( Oracle Price), V( Equity), M ( Maintenance margin fraction) the 3 i am getting from the getMarket and getAccount API's itself.
for W: i am using the below formula (https://docs.dydx.exchange/?json#portfolio-margining)
Total Maintenance Margin Requirement = Σ abs(Si × Pi × Mi)
Where
S is the size of the position (positive if long, negative if short)
P is the oracle price for the market
M is the maintenance margin fraction for the market
I am taking this data from getPositions API where I am only using the positions which are open i.e "Position.status == OPEN "