Why is realized profit negative on futures api?

I created two limit orders (long) on a pair which seemed to be fine, but the realized profit came as negative.
The first was a buy of 1.8 BTC @ 449.64 and the second was a sell of 1.8 BTC @ 451.91. Shouldn’t the realized profit be near 4 USDT instead of -14 USDT?

And maybe a related question, where do the values of “a” (ask notional) and “b” (bids notional) come from?

Hi. Could you help checking:

  1. if the upper buy order really matches the sell order
  2. if the the PnL calculated by following the formula in this article fits the number https://www.binance.com/en/support/faq/360036498511
  1. I’m pretty sure it matches, as they were created by a bot, but is there a way to check that just to be sure? To contextualize, the bot creates many limit orders in both buy and sell sides, so maybe that threw Binance off?

  2. The PNL does not match the one calculated using the formula nor the one using the calculator (screenshot below), which were the same.

image

Hi. I tested it for several times and probably your entry price is not the BUY order price. Here is an example, there is no other position and open orders in this account, and rp 0.01830000 = ( 507.80 - 507.19) * 0.03.

  • Sorry for missing another question, ask notional and bid notional are related to the total quantity and price of the open orders under same position at that moment. It’s not relevant to the order just changed to the filled status.
{
   "o":{
      "s":"BCHUSDT",
      "S":"BUY",
      "o":"LIMIT",
      "f":"GTC",
      "q":"0.030",
      "p":"507.20",
      "ap":"507.19000",
      "sp":"0",
      "x":"TRADE",
      "X":"FILLED",
      "l":"0.030",
      "z":"0.030",
      "L":"507.19",
      "n":"0.00608628",
      "N":"USDT",
      "b":"0",
      "a":"0",
      "m":false,
      "R":false,
      "wt":"CONTRACT_PRICE",
      "ot":"LIMIT",
      "ps":"LONG",
      "cp":false,
      "rp":"0",
       ...
   }
   ...
}


{
   "o":{
      "s":"BCHUSDT",
      "S":"SELL",
      "o":"LIMIT",
      "f":"GTC",
      "q":"0.030",
      "p":"507.80",
      "ap":"507.80000",
      "sp":"0",
      "x":"TRADE",
      "X":"FILLED",
      "l":"0.030",
      "z":"0.030",
      "L":"507.80",
      "n":"0.00304680",
      "N":"USDT",
      "b":"0",
      "a":"0",
      "m":true,
      "R":true,
      "wt":"CONTRACT_PRICE",
      "ot":"LIMIT",
      "ps":"LONG",
      "cp":false,
      "rp":"0.01830000",
      ...
   }
   ...
}