PNL (profit and loss) is a measure of the capital gains accrued between opening and closing a position. It is calculated based on the difference in USD value between your margin deposit (when opening a position) and your payouts (when closing a position).

Said another way, it is the percent gain / loss you would earn by closing your entire position now. On dYdX, PNL is calculated relative to the quote currency of the pair your position was in. This means for longs, PNL also includes how much your margin deposit has gained/lost value.

For example, if your margin deposit was 1 ETH when ETH is worth $300, and your payout was 1.2 ETH when ETH is worth $400, then your PNL would be:

(1.2 ETH * $400/ETH) / (1 ETH * $300/ETH) - 100% = +60%

Why did my position open with negative PNL?

When calculating PNL for open positions, dYdX uses the state of the current orderbook to determine an estimated PNL based on what we expect your real payout to be when closing the position. Because there is always a spread in the orderbook, you would lose money by rapidly opening and then closing margin positions unless the price is moving extremely quickly in your direction.

This effect is more pronounced in higher leverage trades since your margin-deposit is relatively smaller to the spread of the orderbook when making the opening and closing trades. You should expect to open a position at a negative PNL at a percentage around:

(Spread Percentage) x (Leverage) %

Why is PNL not calculated for non-margin trades?

Since non-margin trades occur within your main account, it is harder to figure out what your PNL on each trade is. This is because you may be comparing that trade to any number of other trades at any other point in time (rather than just a single opening trade). You are also able to deposit and withdraw from your main account at-will which further complicates the calculation. Ultimately there is no clear expectation for what a PNL for each trade would even mean.

Why does my Payout not seem to match my PNL?

This is a common question regarding long positions. It has to do with the fact that we calculate PNL in real dollar value (USD), whereas margin deposits (and payouts) for long positions are given in ETH.

In our example calculation above, for example, the payout amount of ETH is only 1.2x the amount of margin deposit ETH. However, the PNL is 60% since the value of ETH increased while more ETH was earned through leverage.

Did this answer your question?