Derify Protocol Documents
English
Search…
⌃K

Position Restriction

The risk ratio
VratioV_{ratio}
is key value to risk control.
The system does not allow position changes that may lead to high risk ratio, i.e., the risk ratio
VratioV_{ratio}'
after any position changes shall be lower than the Risk Threshold
θ\theta
, otherwise the position change order cannot be executed[1].
Assuming that the risk ratio at given moment is
VratioV_{ratio}
and the position changed is
Δp\Delta p
, the risk ratio after the position change
VratioV_{ratio}'
is calculated as follows:
Vratio={Xc+Yc+ΔpXallYall+Δp,position increaseXc+YcΔpXallYallΔp,position decreaseV_{ratio}'=\begin{cases} \dfrac{X_c+Y_c+\Delta p}{X_{all}-Y_{all}+|\Delta p|},&\text{position increase}\\ \\ \dfrac{X_c+Y_c-\Delta p}{X_{all}-Y_{all}-|\Delta p|},&\text{position decrease} \end{cases}
  • Δp\Delta p
    is positive if the position changed is long, or negative if short.
Then the relationship between
θ\theta
and
VratioV_{ratio}'
can be described as follows:
θVratioθ,θ(0,1)-\theta\leq V_{ratio}'\leq\theta,\quad\theta\in(0,1)
Expand the formula:
{θXc+Yc+ΔpXallYall+Δpθ,θ(0,1),position increaseθXc+YcΔpXallYallΔpθ,θ(0,1),position decrease\begin{cases} -\theta\leq\dfrac{X_c+Y_c+\Delta p}{X_{all}-Y_{all}+|\Delta p|}\leq\theta,&\theta\in(0,1),&\text{position increase}\\ \\ -\theta\leq\dfrac{X_c+Y_c-\Delta p}{X_{all}-Y_{all}-|\Delta p|}\leq\theta,&\theta\in(0,1),&\text{position decrease} \end{cases}
Thus, the formula for restriction on position changed
Δp\Delta p
:
{Δpθ(XallYall)XcYc1θ,Δp>0,position increaseΔpθ(XallYall)XcYc1θ,Δp<0,position increaseΔpθ(XallYall)+Xc+Yc1+θ,Δp>0,position decreaseΔpθ(XallYall)+Xc+Yc1+θ,Δp<0,position decrease\begin{cases} \Delta p\leq\dfrac{\theta*(X_{all}-Y_{all})-X_c-Y_c}{1-\theta},&\Delta p>0,&\text{position increase}\\ \\ \Delta p\geq\dfrac{-\theta*(X_{all}-Y_{all})-X_c-Y_c}{1-\theta},&\Delta p<0,&\text{position increase}\\ \\ \Delta p\leq\dfrac{\theta*(X_{all}-Y_{all})+X_c+Y_c}{1+\theta},&\Delta p>0,&\text{position decrease}\\ \\ \Delta p\geq\dfrac{-\theta*(X_{all}-Y_{all})+X_c+Y_c}{1+\theta},&\Delta p<0,&\text{position decrease} \end{cases}
If the position changed
Δp\Delta p
failed to satisfy the formula above, the contemplated position change cannot be executed.
Position restriction ensures the risk ratio
VratioV_{ratio}
shall always be lower than a given risk threshold.
Risk threshold
θ\theta
is a changeable constant and can be adjusted via DAO community voting.
[1] Except for liquidation.