For a typical transaction of CFD, we have a set of states :
is the state at the time which the position is opened.
is the state at the time which the position is closed.
is the state of each moment during the holding period of position.
For each transaction with a given set , trader deposit initial margin at and withdraw the remaining equity at .
The amount of remaining equity is determined by , , and , which can be described as follows:
means the state that the liquidation is triggered.
To illustrate, if the liquidation is not triggered during the holding period of position, then shall be a function of , and , while if the liquidation is triggered during the holding period of position, then .
Since , , and are always known for any given moment of a position, can be calculated accordingly.
The calculation process of remaining equity is called contract calculation.