# Equity management

Once a position has been opened, a trader can add or remove equity. Equity is the sum between the initial margin and a trader's P\&L. The table below summarises the impact of each action on the long and short positions.

<table><thead><tr><th width="150"> </th><th>Long position</th><th>Short position</th></tr></thead><tbody><tr><td>Add equity</td><td>Remove money from the borrowing position, i.e. the trader could recover part of the interest paid in advance</td><td>Add money to the lending position, i.e. the trader will get extra income</td></tr><tr><td>Remove equity</td><td>Add money to the borrowing position, i.e. the trader will pay the interest on the removed equity amount</td><td>Remove money from the  lending position, i.e. the trader will get less income from the lent amount</td></tr></tbody></table>

{% hint style="warning" %}
The following examples do take into account potential liquidation for low collaterisation ratios. They are indicative to better understand the impact of equity management.&#x20;
{% endhint %}

{% hint style="warning" %}
In this section, the collatisation ratio for borrowing $$CR\_{borrow}$$ refers to the one on the underlying borrowing protocol and not on the expirabel position itself.
{% endhint %}

## Long position

Below we will consider the numerical example of a long position opened in [position opening](/exchange/protocol/protocol-pricing/position-opening.md) where:

* $$S\_{L}=100.10 : DAI$$
* the trader has posted $$50 :DAI$$ as margin
* the price to open the long position is $$P\_{O,L} = 100.59 : DAI$$
* $$0.9929 : ETH$$have been lent, i.e. the equivalent of $$0.9929 \*99.90 = 99.19:DAI$$
* the debt (principal + interest) is $$D=50.59 : DAI$$.

Remembering the concept of flash swaps used in the protocol (see the [borrowing and lending](/exchange/protocol/borrowing-and-lending.md) section), where the zero-coupon bond for lending $$ETH$$ is used as collateral to borrow $$DAI$$, we find a collaterisation ratio for borrowing of $$CR\_{borrow}=\dfrac{99.19}{50.50}=196.07 %$$.

### Add equity

When equity is added to a position, it is used to repay earlier some debt and hence increase the collaterisation ratio for borrowing $$CR\_{borrow}$$ of the borrowed $$DAI$$. Taking the example of the long position which has been opened, and supposing that the spot price remains the same, let's say a trader wants to add $$20 :DAI$$ at $$T=0.2$$ when $$r\_{Q,l}=9%$$:&#x20;

* the debt recovered is $$20\*{(1+0.09)}^{0.2}=20.35:DAI$$
* The remaining debt is $$D=50.59-20=30.24: DAI$$
* and the new collaterisation ratio for borrowing would be $$CR\_{borrow}=\dfrac{99.19}{30.24}=327.99%$$.

### Remove equity

Since the initial posted $$DAI$$was used to buy the required $$ETH$$, this equity is no more available and a trader cannot simply withdraw it. Hence, if a trader wants to remove some equity to decrease the collaterisation ratio $$CR\_{borrow}$$, the protocol will simply borrow the required $$DAI$$ directly at a fixed rate on an underlying fixed rate protocol. Taking the example of the long position which has been opened, and supposing that the spot price remains the same, let's say a trader wants to remove $$10 :DAI$$ at $$T=0.2$$ when $$r\_{Q,b}=10%$$:&#x20;

* the extra debt (principal + interest) is $$10\*{(1+0.1)}^{0.2}=10.19:DAI$$
* the total debt will become $$D=50.59+10.19=60.78: DAI$$
* and the new collaterisation ratio for borrowing would be $$CR\_{borrow}=\dfrac{99.19}{60.78}=163.19%$$.

{% hint style="info" %}
The mechanism used in Contango to remove equity implies that a trader can remove an amount of equity higher than the initial posted margin. This allows a trader to get out some equity, or crystallise the P\&L, without having to partially close a position.
{% endhint %}

## Short Position

Below we will consider the numerical example of a short position opened in [position opening](/exchange/protocol/protocol-pricing/position-opening.md) where:

* $$S\_{S}=99.90 : DAI$$
* the trader has posted $$50 :DAI$$ as margin
* the price to open the short position is $$P\_{O,S} = 102.70 : DAI$$
* $$0.9924: ETH$$ have been borrowed, i.e. the equivalent of $$0.9924\*99.90 = 99.14 :DAI$$
* the lent amount (principal + interest) is $$L=152.70 : DAI$$.

Remembering the concept of flash swaps used in the protocol (see the [borrowing and lending](/exchange/protocol/borrowing-and-lending.md) section), where the zero-coupon bond for lending $$DAI$$ is used as collateral to borrow $$ETH$$, we find a collaterisation ratio for borrowing of $$CR\_{borrow}=\dfrac{152.70}{99.14}=154.02 %$$.

### Add equity

Adding equity is equivalent to lend more $$DAI$$, i.e. add more collateral for the debt and increase the collaterisation ratio. Taking the example of adding $$30 :DAI$$ at $$T=0.2$$ when $$r\_{Q,l}=9%$$:&#x20;

* the new lent amount at expiry (principal + interest) is $$30\*{(1+0.09)}^{0.2}=30.52:DAI$$
* the total lent amount is now $$L=152.70+30.52=183.22:DAI$$
* and the new collaterisation ratio for borrowing would be $$CR\_{borrow}=\dfrac{183.22}{99.14}=184.81%$$.

### Remove equity

Removing equity is equivalent to remove money from the lending position. Taking the example of removing $$10 :DAI$$ at $$T=0.2$$ when $$r\_{Q,b}=10%$$:&#x20;

* the lent amount to remove (principal + interest) is $$50\*{(10+0.1)}^{0.2}=10.19:DAI$$
* the remaining total amount is $$L=152.70-10.19=142.51:DAI$$
* and the new collaterisation ratio for borrowing would be $$CR\_{borrow}=\dfrac{142.51}{99.14}=143.74%$$.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://contango-2.gitbook.io/exchange/protocol/equity-management.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
