Lean.Brokerages.InteractiveBrokers icon indicating copy to clipboard operation
Lean.Brokerages.InteractiveBrokers copied to clipboard

Lean logs have 'UnrealisedPnL' and 'RealisedPnl' backwards

Open tmills86 opened this issue 9 months ago • 1 comments

Expected Behavior

Lean logs should be showing UnrealisedPnl and RealisedPnl in their respective columns.

Actual Behavior

The logs have these two swapped. An example of the output I'm getting on my server looks like this:

2024-05-08T13:44:01.4882395Z TRACE:: InteractiveBrokersBrokerage.HandlePortfolioUpdates(): Contract: FUT MNQ USD , ConId: 620730945, Position: 0, MarketPrice: 18119.859375, MarketValue: 0, AverageCost: 0, UnrealisedPnl: 87.06, RealisedPnl: 0, AccountName: U########

As you can see, my position is 0, but I'm getting an UnrealisedPnl of 87.06, when this should be in the RealisedPnl column.

Reproducing the Problem

Take any position on interactive brokers and then close it. The UnrealisedPnl and RealisedPnl columns will be swapped.

System Information

Ubuntu 22.04.4 LTS

Checklist

  • [x] I have completely filled out this template
  • [x] I have confirmed that this issue exists on the current master branch
  • [x] I have confirmed that this is not a duplicate issue by searching issues
  • [x] I have provided detailed steps to reproduce the issue

tmills86 avatar May 09 '24 00:05 tmills86