Hey everyone. I'm stuck while backtesting my algo. I can't seem to get an accurate, current, updated value for Portfolio.Cash.

After placing a MarketOrder with 50% of the cash in my portfolio. The order seem to fill fine. I've put a breakpoint in OnOrderEvent, and it looks like it has filled properly.

Shortly thereafter I place another MarketOrder with the remaining cash in my portfolio. But for some reason Portfolio.Cash is not correct, it's value seems to have only subtracted the transaction fee. The first order did not get subtracted. 

It looks like things are behaving in a synchronous manner with the MarketOrder. Is there some lag with when Portfolio.Cash updates? Do I need to force an update?

Thanks!

Author