🧮Position PNL

PNL in the context of crypto trading stands for "Profit and Loss." It is a key metric used to evaluate the performance of the position.

In Alfred bot, users can find Unrealized PNL in two scenes - the Wallet and Position Management.

Notice: Users may find the Position info after clicking on a ticker symbol at the wallet scene or inputting the address of a token they have previously purchased.

The PNL calculation formula on the Wallet scene works as follows:

  1. We calculate the Average Buy Price (gas is included in the price):

AVG buy price = (Σ(ETH_spent+Buy_TX_GAS+Approve_TX_GAS)) * ETH_price)/Σ(Tokens amount)

  1. The Current Price is calculated using a mathematical method that takes into account the price impact of selling the entire 100% quantity of tokens. It doesn't include sell taxes.

  2. After that, we calculate the PNL with the following formula:

PNL Amount = Tokens Amount * (Current Price - AVG buy price)

PNL (%) = Current_price/AVG Buy Price * 100

It's essential to note that the PNL displayed in the Position scene differs due to the use of a selling simulation to calculate the Current Price. While simulation provides greater accuracy than a basic mathematical calculation, it's not feasible to integrate this method into the wallet scene due to the substantial costs associated with each simulation.

Last updated