# Pertes et Profits (P\&L) et comment il est calculé

{% embed url="<https://youtu.be/zcF1lrOCVV8>" %}

The **Profit and Loss (PnL)** indicator reflects the Profit or Loss of a position. PnL is calculated in 2 different ways, depending on if a position is still currently Open or if it has already been Closed.

For **open** positions Realized PnL and Unrealized PnL are taken into account. The potential profit from the deal refers to the Unrealized PnL. Realized PNL in open positions equals already paid commissions (i.e. [trade fees and funding](/help-center/fr/margex/trading-conditions/margex-fees.md)).

* *PnL is not reflected in Open positions. It can be calculated by adding Realized PnL + Unrealized PnL.*
* *Calculating Unrealized PnL of Open positions requires the use of AskPrice and BidPrice, while calculating Unrealized PnL of Closed positions requires the use of ClosePrice*

Below are examples of calculation of PnL in Open Positions and in Closed Positions:

<details>

<summary><strong>Comment calculer le PnL dans les positions OUVERTES</strong></summary>

Les formules générales pour calculer le PnL des positions OUVERTES :

PnL = PnL Réalisé + PnL Non Réalisé, où :

* PnL Réalisé = -OpenOrderCommission - Funding, où
  * OpenOrderCommission = (MarginCol \* Leverage) \* frais Maker ou Taker %
  * Funding = (MarginCol \* Leverage) \* FundingFeeRate %
* PnL Non Réalisé (Long) = MarginCol \* Leverage \* (CurrentAsk - OpenPrice) / OpenPrice
* PnL Non Réalisé (Short) = MarginCol \* Leverage \* (OpenPrice - CurrentBid) / OpenPrice

Remarque : CloseOrderCommission n’est PAS incluse dans le PnL tant que la position n’a pas été clôturée.

**EXEMPLE :**

Paramètres d’une position OUVERTE :

* Direction : Long
* Taille de l’ordre : 0.1 BTC
* Effet de levier : x100 (-> Marge = 0.001 BTC)
* Ordre d’ouverture : Limit
* Frais de funding facturés : 1 fois

**Tout d’abord**, nous devons calculer OpenOrderCommission et Funding :

OpenOrderCommission = (MarginCol \* Leverage) \* MakerFee% = (0.001 \* 100) \* 0.019% = 0.000019

* Funding = (MarginCol \* Leverage) \* FundingFeeRate% = (0.001 \* 100) \* 0.12% = 0.00012

**Ensuite**, nous devons calculer le PnL Réalisé et le PnL Non Réalisé :

* PnL Réalisé = -OpenOrderCommission - Funding = -0.000019 - 0.00012 = -0.000139
* PnL Non Réalisé (Long) = MarginCol \* Leverage \* (AskPrice - OpenPrice) / OpenPrice = (0.001 \* 100) \* (11000 - 10000) / 10000 = 0.01

**Enfin**, la dernière étape consiste à calculer le PnL. Comme indiqué ci-dessus, le PnL Réalisé = -0.000139 et le PnL Non Réalisé = 0.01 ;

* PnL (Long) = PnL Réalisé + PnL Non Réalisé = -0.000139 + 0.01 = 0.009861

</details>

<details>

<summary>Comment calculer le PnL dans les positions CLÔTURÉES</summary>

Les formules générales pour calculer le PnL des positions CLÔTURÉES :

PnL = PnL Réalisé + PnL Non Réalisé - CloseOrderCommission, où :

* PnL Réalisé = -OpenOrderCommission - Funding, où
  * OpenOrderCommission = (MarginCol \* Leverage) \* frais Maker ou Taker %
  * Funding = (MarginCol \* Leverage) \* FundingFeeRate %
* PnL Non Réalisé (Long) = MarginCol \* Leverage \* (ClosePrice - OpenPrice) / OpenPrice
* PnL Non Réalisé (Short) = MarginCol \* Leverage \* (OpenPrice - ClosePrice) / OpenPrice
* CloseOrderCommission = (MarginCol \* Leverage) \* TakerFee %

**EXEMPLE :**

Paramètres d’une position CLÔTURÉE :

* Direction : Long
* Taille de l’ordre : 0.1 BTC
* Effet de levier : x100 (-> **Marge = 0.001 BTC**)
* Ordre d’ouverture : Market
* Ordre de clôture : Market
* Frais de funding facturés : 1 fois

**Premièrement**, nous devons calculer la CloseOrderCommission :

CloseOrderCommission = (MarginCol \* Leverage) \* TakerFee = (0.001 \* 100) \* 0.06% = 0.00006

**Deuxièmement**, nous devons calculer le PnL Réalisé et le PnL Non Réalisé :

* PnL Réalisé = -OpenOrderCommission - Funding = -((MarginCol \* Leverage) \* TakerFee%) - ((MarginCol \* Leverage) \* FundingFeeRate%) = -((0.001 \* 100) \* 0.06%) - ((0.001 \* 100) \* 0.12%) = -(0.1 \* 0.06%) - (0.1 \* 0.12%) = -0.00006 - 0.00012 = -0.00018
* PnL Non Réalisé (Long) = MarginCol \* Leverage \* (ClosePrice - OpenPrice) / OpenPrice = 100 \* 0.001 \* (11000 - 10000) / 10000 = 0.01

**Enfin**, la dernière étape consiste à calculer le PnL. Comme indiqué ci-dessus, le PnL Non Réalisé = 0.01, le PnL Réalisé = -0.00018 et la CloseOrderCommission = 0.00006 :

* **PnL** = PnL Réalisé + PnL Non Réalisé - CloseOrderCommission = -0.00018 + 0.01 - 0.00006 = 0.00976

</details>

{% hint style="success" %}
Le PnL pour les positions ouvertes et fermées est calculé automatiquement et reflété dans les sections Positions ouvertes et Historique des positions de la page [Trade](https://margex.com/app/trade) pour votre commodité.
{% endhint %}


---

# 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://help.margex.com/help-center/fr/leverage-trading-guide/how-leverage-works/pnl-calculation.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.
