1inch Network All you need to know Web3 DeFi

How 1inch calculates portfolio PnL

1inch Network-photo

by 1inch Network

• 1 min read

In this post, we will take a close look at the method of calculating profits and losses (PnL) used in the 1inch Wallet’s recent upgrade.

For crypto traders and investors, accurate and up-to-date portfolio information is vital. Therefore, in the 1inch Wallet’s recently released new version for Android, the Portfolio feature was added. It allows users to run complete wallet-driven asset management, monitor real-time and overall token performance and optimize their investments, also displaying a full picture of their portfolio activity at any time.

In the Portfolio feature, 1inch employs a formula for calculating a user’s PnL over any specific period of time. To facilitate calculations, three elements are required: a complete transaction history, the traded asset’s price for each transaction and the asset’s current value in USD.

And this is the formula:

PnL= Current Value − Inflow Value + Outflow Value

Current Value is the current worth of the user’s asset.

Inflow Value is the total amount the user invested.

Outflow Value is the total amount the user withdrew.

ROI= PnL / Inflow Value

Let’s consider a real-world example.

Meet Bob, a blockchain trader. Bob made 3 trades:

On January 1, 2023, he bought 100 tokens at $1 each.

On March 10, 2023, he bought another 50 tokens at $2 each.

On May 12, 2023, he sold 60 tokens at $2.5 each.

Now, let's help Bob calculate his PnL and ROI.

Suppose, the token’s current price is $1.5. Here's how Bob’s PnL is calculated:

Current Value: (100 + 50 - 60) * 1.5 = $135

Inflow Value: 100 * 1 + 50 * 2 = $200

Outflow Value: 60 * 2.5 = $150

PnL = 135 - 200 + 150 = $85

ROI = 85 / 200 = 42.5%

In simple terms, Bob invested $200, withdrew $150 and could withdraw another $135, making his total $285. His current gain is $85.

ROI tells traders how much they earned per dollar invested. In this example, Bob gained $1.425 for each dollar he invested.

Stay tuned to learn more about 1inch’s tech!

1inch Network-photo

1inch Network

Share the article

Copy done!
Copy done!