I've had incidents with IB where realized profit was way off.....earlier this week I bought an ETF....then 3 days later I bought some more of the same ETF....then a 2 days after that I sold half of the position, and then sold the remaining shares the following day.
The trade was profitable, but IB "realized profit" said I had lost $5500 on it. Second time I have experienced this type of error. Usually happens when I buy the same security twice without liquidating and then liquidate the positions on different days.