Position closing
Once a position is open, a trader could choose to close it before expiry. If that's the case, the protocol needs to exit the lending position, which at expiry would have represented an amount
(principal + interest), and repay the owed debt, which at expiry would have represented an amount
(principal + interest).
The table below presents the price at which a trader could close a long position at a price
or a short position at a price
(other notations have been introduced in theoretical pricing).
Side | Price to close a position |
---|---|
Long | |
Short | |
Let's consider the close of the long and short positions presented in the numerical example in position opening:
- A trader wants to immediately close the long position with an open price. Given one could borrow ETH at a yearly fixed rate of and lend DAI at a yearly fixed rate, and given the total debt to reimburse at expiry is, the price at which a trader could immediately close the position is:
- A trader wants to immediately close the short position with an entry price. Given one could lend ETH at a yearly fixed rate of and borrow DAI at a yearly fixed rate, and given the total money to get back from lending (principal + interest) is, the price at which a trader could immediately close the position is:
Let's consider a trader who wants to immediately close a long position of
(numerical applications rely on the above example):
1. The protocol gets back the base currency which was lent,
, i.e.
.
2. This base currency is swapped back to the quote currency,
, i.e.
.
3. The protocol buys back the debt
, today worth
, i.e.
.
4. For closing the position earlier, the trader will get back money on the debt,
or
, i.e.
.
5. Hence the money the trader gets back for closing the long position is
, i.e
.
Let's consider a trader who wants to immediately close a short position of
(numerical applications rely on the above example):
1. The protocol needs
to close the debt, i.e.
.
2. Hence the protocol needs
to close the debt, i.e.
.
3. On the other hand, the protocol gets back
from lending, i.e.
.
4. The money lost in lending for closing the position earlier is
or
, i.e.
.
5. Hence the money the trader gets back for closing the short position is
, i.e.
.
Last modified 10mo ago