User Order Updates Returning Garbage

Hi,

I am using a wrapper in C# which is known to work (Binance.Net), and have run into an issue. When subscribing to user USDT Futures updates, every time I create or sell a futures contract, I get 3 responses within the function, all of which seem to mean nothing meaningful. The UnrealizedPnL and RealizedPnL values are either 0 or something completely garbage, and I can’t seem to figure out what they actually are telling me. Some of the responses have both values as 0 even though that shouldn’t make sense since they’re position updates and thus should have either unrealized PnL or realized PnL.

Sorry if I’m not making a whole lot of sence, this is still fairly new to me.

Here is the snippet of code thats giving me issues:

            data =>
        {
            //This is where the problem is
            foreach (var balance in data.UpdateData.Positions) {
                Console.WriteLine(balance.UnrealizedPnl);
                Console.WriteLine(balance.RealizedPnL);
                continue;

                if (balance.EntryPrice != 0) {
                    //This is the kind of thing we want to listen for
                    if (balance.PositionAmount != 0)
                        Console.WriteLine("Detected new OPEN position: " + balance.Symbol + " (position size): $" + (balance.PositionAmount * balance.EntryPrice).ToString()); //Working
                    else
                        Console.WriteLine("PnL of " + balance.RealizedPnL);
                }
            }
        },

The, for example, leverage adjustment call works absolutely flawlessly.

Please note that I do understand how bad the code is, its just temporary for debugging purpouses. I’m just trying to grab the values being sent back to me to eliminate any possible obvious meaning,

Hi. Could you provide those 3 responses you got to help us better understand the issue?
I guess “create or sell” a futures contract means that you may either “buy or sell” a contract based on the update. If so, when there is a BUY order, RealizedPnL is for sure 0 because the buy price is the entry price.

I ended up figuring it out. The “problem” was that I was reading it wrong. It is cumulative PnL, not per trade.