Derify Protocol Documents
English
Search
K

Contract Calculation

For a typical transaction of CFD, we have a set of states
S\mathbb{S}
:
S={Sopen,,St,,Sclose}\mathbb{S}=\{S_{open},\cdots,S_t,\cdots,S_{close}\}
  • SopenS_{open}
    is the state at the time which the position is opened.
  • ScloseS_{close}
    is the state at the time which the position is closed.
  • StS_t
    is the state of each moment
    tt
    during the holding period of position.
For each transaction with a given set
S\mathbb{S}
, trader deposit initial margin
mm
at
SopenS_{open}
and withdraw the remaining equity
ee
at
ScloseS_{close}
.
The amount of remaining equity
ee
is determined by
mm
,
SopenS_{open}
,
ScloseS_{close}
and
SliquidationS_{liquidation}
, which can be described as follows:
e={f(m,Sopen,Sclose),SliquidationS0,SliquidationSe=\begin{cases} \boldsymbol{f}(m,S_{open},S_{close}),&S_{liquidation}\notin\mathbb{S}\\ \\ 0,&S_{liquidation}\in\mathbb{S} \end{cases}
  • SliquidationS_{liquidation}
    means the state that the liquidation is triggered.
To illustrate, if the liquidation is not triggered during the holding period of position, then
ee
shall be a function of
mm
,
SopenS_{open}
and
ScloseS_{close}
, while if the liquidation is triggered during the holding period of position, then
e=0e=0
.
Since
mm
,
SopenS_{open}
,
ScloseS_{close}
and
SliquidationS_{liquidation}
are always known for any given moment of a position,
ee
can be calculated accordingly.
The calculation process of remaining equity
ee
is called contract calculation.