Position opening

Pricing with margin

Formulas

The formulas below present the price at which a trader could open a long position at a price PO,LP_{O,L} or a short position at a price PO,SP_{O,S} with an initial margin MM (other notations have been introduced in theoretical pricing).

SidePrice to open a position

Long

PO,L=SLāˆ—(1+rQ,b1+rB,l)Tāˆ’Māˆ—[(1+rQ,b)Tāˆ’1]P_{O,L}=S_{L}*{ \bigg( \dfrac{1+r_{Q,b}}{1+r_{B,l}} \bigg) }^T - M *[{(1+r_{Q ,b })}^T -1]

Short

PO,S=SSāˆ—(1+rQ,l1+rB,b)T+Māˆ—[(1+rQ,l)Tāˆ’1]P_{O,S}=S_{S}*{ \bigg( \dfrac{1+r_{Q,l}}{1+r_{B,b}} \bigg) }^T + M *[{(1+r_{Q , l})}^T -1]

Contango protocol provides a price improvement compared to the theoretical formulas presented in theoretical pricing:

  • Since Māˆ—[(1+rQ,b)Tāˆ’1]>0M *[{(1+r_{Q ,b })}^T -1] > 0, the price to open a long position is at a lower price, i.e. more favourable to the trader.

  • Since Māˆ—[(1+rQ,l)Tāˆ’1]>0M *[{(1+r_{Q , l})}^T -1] > 0, the price to open a short position is at a higher price, i.e. more favourable to the trader.

Example

Let's consider a contract on ETHDAI expiring in 3 months (T=1T=1) and where the traders posts 50ā€…DAI50 \:DAI as margin:

  • Given one could borrow DAI at a yearly fixed rate of rQ,b=10.10%r_{Q,b}=10.10\%ā€‹, lend ETH at a yearly fixed rate rB,l=2.90%r_{B,l}=2.90\%and buy ETH on the spot market at SL=100.10ā€…DAIS_{L}=100.10\:DAI then the price at which a trader could open a long a position is:

PO,L=100.10āˆ—(1+0.10101+0.0290)0.25āˆ’50āˆ—[(1+0.1010)0.25āˆ’1]=100.59ā€…DAIP_{O,L}=100.10*{ \bigg( \dfrac{1+0.1010}{1+0.0290} \bigg) }^{0.25} - 50 *[{(1+{0.1010})}^{0.25} -1] = 100.59 \: DAIā€‹

  • Given one could borrow ETH at a yearly fixed rate of rB,b=3.10%r_{B,b}=3.10\%ā€‹, lend DAI at a yearly fixed rate of rQ,l=9.90%r_{Q,l}=9.90\%and sell ETH on the spot market at SS=99.90ā€…DAIS_{S}=99.90\:DAI then the price at which a trader could open a short position is:

PO,S=99.90āˆ—(1+0.09901+0.0310)0.25+50āˆ—[(1+0.0990)0.25āˆ’1]=102.70ā€…DAIP_{O,S}=99.90*{ \bigg( \dfrac{1+0.0990}{1+0.0310} \bigg) }^{0.25} + 50 *[{(1+{0.0990})}^{0.25} -1] = 102.70\: DAIā€‹

Demonstration

Long

Let's consider that a trader wants to buy 1 expirable (the numerical values are taken from the above example). In this demonstration, we will present the steps to replicate the cash flows of a expirable position. Let's figure out the price of the expirable, i.e. the DAI money needed, to get 1 ETH at expiry:

1. To receive 1 ETH at expiry, the trader needs to lend 1(1+rB,l)Tā€…ETH\dfrac{1}{(1+r_{B,l})^T} \: ETH, i.e. 0.9929ā€…ETH0.9929 \: ETH

2. To get that ETH, the trader first swaps SL(1+rB,l)Tā€…DAI\dfrac{S_{L}}{(1+r_{B,l})^T} \: DAI, i.e. 99.39ā€…DAI99.39 \: DAI.

3. Since the trader has already some margin, she only needs to borrow SL(1+rB,l)Tāˆ’Mā€…DAI\dfrac{S_{L}}{(1+r_{B,l})^T} - M \: DAI, i.e. 49.39ā€…DAI49.39 \: DAI.

4. The debt DD the trader owes at expiry (principal + interest) is: D=[SL(1+rB,l)Tāˆ’M]āˆ—(1+rQ,b)Tā€…DAID = [\dfrac{S_{L}}{(1+r_{B,l})^T} - M] * {(1+r_{Q , b})}^T \: DAI, i.e. D=50.59ā€…DAID=50.59 \: DAI.

5. Hence, the money needed to receive 1 ETH at expiry is the sum of the debt and the margin provided: [SL(1+rB,l)Tāˆ’M]āˆ—(1+rQ,b)T+Mā€…DAI[\dfrac{S_{L}}{(1+r_{B,l})^T} - M] * {(1+r_{Q , b})}^T + M \: DAI or SLāˆ—(1+rQ,b1+rB,l)Tāˆ’Māˆ—[(1+rQ,b)Tāˆ’1]ā€…DAIS_{L}*{ \bigg( \dfrac{1+r_{Q,b}}{1+r_{B,l}} \bigg) }^T - M *[{(1+r_{Q ,b })}^T -1] \: DAI, i.e. 100.59ā€…DAI100.59 \: DAI.

Short

Let's consider a trader who wants to sell 1 expirable (the numerical values are taken from the example above). This means she would give 1 ETH at expiry, let's figure out the steps and how much money she would need to receive at expiry:

1. The trader will give 1 ETH at expiry to reimburse a debt. Hence the trader borrows 1(1+rB,b)Tā€…ETH\dfrac{1}{(1+r_{B,b})^T} \: ETH, i.e. 0.9924ā€…ETH0.9924 \: ETH.

2. The trader swaps the ETH to get SS(1+rB,b)Tā€…DAI\dfrac{S_{S}}{(1+r_{B,b})^T} \: DAI, i.e. 99.14ā€…DAI99.14 \: DAI.

3. The trader lends the DAI from the swap and her margin. At expiry the trader receives an amount L=[SS(1+rB,b)T+M]āˆ—(1+rQ,l)Tā€…DAIL=[\dfrac{S_{S}}{(1+r_{B,b})^T} + M] *{(1+r_{Q , l})}^T \: DAI, i.e. L=152.70ā€…DAIL=152.70 \: DAI.

4. The amount of money the trader will receive at expiry, which is also the price of the expirable, is the difference between the amount L and the margin: [SS(1+rB,b)T+M]āˆ—(1+rQ,l)Tāˆ’Mā€…DAI[\dfrac{S_{S}}{(1+r_{B,b})^T} + M] *{(1+r_{Q , l})}^T - M \: DAI or SSāˆ—(1+rQ,l1+rB,b)T+Māˆ—[(1+rQ,l)Tāˆ’1]ā€…DAIS_{S}*{ \bigg( \dfrac{1+r_{Q,l}}{1+r_{B,b}} \bigg) }^T + M *[{(1+r_{Q , l})}^T -1] \: DAI, i.e. 102.70ā€…DAI102.70 \: DAI.

Pricing with margin ratio

Formulas

Given the margin ratio MRMR:

  • the margin for a long position could be expressed as M=MRāˆ—PO,LM = MR*P_{O,L}, e.g. if the price to open a long position is PO,L=100ā€…DAIP_{O,L}=100 \:DAI and if the trader wants a margin ratio of 50%, then the required margin is M=50ā€…DAIM=50 \:DAI

  • the margin for a short position could be expressed as M=MRāˆ—PO,SM = MR*P_{O,S}, e.g. if the price to open a short position is PO,S=100ā€…DAIP_{O,S}=100 \:DAI and if the trader wants a margin ratio of 50%, then the required margin is M=50ā€…DAIM=50 \:DAI

Replacing the margin MM in the main pricing formula to open a position, we find new expressions depending on the collaterisation ratio MRMR :

SidePrice to open a position

Long

PO,L=SLāˆ—(1+rQ,b1+rB,l)Tāˆ—11+MRāˆ—[(1+rQ,b)Tāˆ’1]P_{O,L}=S_{L}*{ \bigg( \dfrac{1+r_{Q,b}}{1+r_{B,l}} \bigg) }^T * \dfrac{1}{1+MR*[{(1+r_{Q ,b })}^T -1]}

Short

PO,S=SSāˆ—(1+rQ,l1+rB,b)Tāˆ—11āˆ’MRāˆ—[(1+rQ,l)Tāˆ’1]P_{O,S}=S_{S}*{ \bigg( \dfrac{1+r_{Q,l}}{1+r_{B,b}} \bigg) }^T * \dfrac{1}{1-MR*[{(1+r_{Q ,l })}^T -1]}

Example

Let's consider a contract on ETHDAI expiring in 3 months (T=1T=1) where the trader puts a 50%50\%MR:

  • Given one could borrow DAI at a yearly fixed rate of rQ,b=10.10%r_{Q,b}=10.10\%, lend ETH at a yearly fixed rate rB,l=2.90%r_{B,l}=2.90\% and buy ETH on the spot market at SL=100.10ā€…DAIS_{L}=100.10\:DAIthen the price at which a trader could open a long a position is:

PO,L=100.10āˆ—(1.10101.0290)0.25āˆ—11+0.5āˆ—[(1.1010)0.25āˆ’1]=100.68ā€…DAIP_{O,L}=100.10*{ \bigg( \dfrac{1.1010}{1.0290} \bigg) }^{0.25} * \dfrac{1}{1+0.5*[{(1.1010)}^{0.25} -1]}=100.68\:DAI

  • Given one could borrow ETH at a yearly fixed rate of rB,b=3.10%r_{B,b}=3.10\%, lend DAI at a yearly fixed rate of rQ,l=9.90%r_{Q,l}=9.90\%, and sell ETH on the spot market at SS=99.90ā€…DAIS_{S}=99.90\:DAI then the price at which a trader could open a short position is:

PO,S=99.90āˆ—(1.09901.0310)0.25āˆ—11āˆ’0.5āˆ—[(1.0990)0.25āˆ’1]=100.31ā€…DAIP_{O,S}=99.90*{ \bigg( \dfrac{1.0990}{1.0310} \bigg) }^{0.25} * \dfrac{1}{1-0.5*[{(1.0990)}^{0.25} -1]}=100.31\:DAI

Last updated