Derify Protocol Documents
English
Search
K

# Position Restriction

The risk ratio
$V_{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
$V_{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
$V_{ratio}$
and the position changed is
$\Delta p$
, the risk ratio after the position change
$V_{ratio}'$
is calculated as follows:
$V_{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}$
• $\Delta p$
is positive if the position changed is long, or negative if short.
Then the relationship between
$\theta$
and
$V_{ratio}'$
can be described as follows:
$-\theta\leq V_{ratio}'\leq\theta,\quad\theta\in(0,1)$
Expand the formula:
$\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
$\Delta p$
:
$\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
$\Delta p$
failed to satisfy the formula above, the contemplated position change cannot be executed.
Position restriction ensures the risk ratio
$V_{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.