Profit and Loss

What is PnL

Profit and Loss, often abbreviated as PnL, in the context of providing liquidity, refers to the financial outcome that results from the difference in the value of tokens at two distinct points in time: the initial moment when the liquidity is added and the subsequent moment when the liquidity is removed.

Actions

Adding Liquidity

In the process of adding liquidity, a user decides to deposit tokens to the liquidity pool. Liquidity providers receive LP tokens (liquidity provider tokens) in return for locking in their tokens.

Deposited tokens are worth something, and based on that we calculate the average value of received LP tokens. If you had LP tokens before, we blend the old and new averages and remember the all-time average.

Removing Liquidity

Removing liquidity is a process of redeeming received LP tokens back into the deposited tokens. By doing this, the user receives back their portion of the tokens locked in the liquidity pool.

Received tokens have some value, and based on that we calculate the average value of redeemed LP tokens.

Realized PnL

Profit or loss of each removing liquidity action is the difference between average value of received LP tokens and average value of redeemed LP tokens. Realized PnL is the sum of these profits or losses.

Unrealized PnL

Without actually removing liquidity, we calculate what would be your profit or loss if you removed all your liquidity. That is an unrealized PnL.

More in-depth explanation

For each pool:

  • For the user’s initial adding liquidity action, we use the value of deposited tokens (at the time of the deposit) and calculate the average cost of received LP tokens (by dividing value of deposited tokens by the number of received LP tokens). We then store the number of received LP tokens and average cost of LP tokens.

  • For each subsequent adding liquidity action, we calculate the average cost of newly received LP tokens. Then we update the stored number of received LP tokens and average cost of LP tokens (by adding newly received LP tokens to the stored number of received LP tokens and by multiplying the stored number of received LP tokens and average cost of LP tokens, adding value of deposited tokens, and dividing everything with updated number of received LP tokens).

  • For each removing liquidity action, cost of deposited LP tokens is the stored average cost of LP tokens times the number of deposited LP tokens. Profit or loss for this action is the difference between the cost of deposited LP tokens and the value of received tokens (at the time of receiving). We update the number of received LP tokens (by reducing the number of deposited LP tokens from the stored number of received LP tokens).

  • Realized PnL for each pool is the sum of PnL for each removing liquidity action.

Your total PnL is the sum of PnL of each pool.

What impacts PnL

PnL in WingRiders liquidity pools is affected by everything that affects removing liquidity, which is explained in https://docs.wingriders.com/actions/removing-liquidity

It is important to note that the PnL calculation on WingRiders currently does not include the rewards earned from yield farming.

Last updated