I added cash by wire to my IB account and the performance summary in the live trading page considered the deposit as a gain.
It's a bug, isn'it?
I added cash by wire to my IB account and the performance summary in the live trading page considered the deposit as a gain.
It's a bug, isn'it?
Will similar to this as a workaround do for now? PnL in the custom chart should be right.
# You can modify this to an integer, total cash input minus any withdrawals
manual_cash = c.portfolio.starting_cash
Basically context.portfolio.pnl is context.portfolio.portfolio_value minus context.portfolio.starting_cash, so you can custom chart context.portfolio.portfolio_value minus whatever_cash_starting_plus_added_less_withdrawn as a hardcoded number, manually.
How could they address that? Maybe if we could replace the initial_capital variable they use, like set_cash_input(120000) in initialize. It would require that we restart. Or maybe they could adjust their initial_capital variable based on the stored value of context.portfolio.cash after close compared to context.portfolio.cash when warming up in the morning, so long as our cash transfers to-and-from the account are done outside of market hours.