If I added cash or increased the amount I owned manually into my trading account, I would like to see that change before I make a trade decision.  The code below is what I am using to check my current portfolio but its giving incorrect values during live trading.  Is there a better way to achieve what I am trying to do for crypto currencys?  It works great in a backtest envoirment but when I debug/print the currentweight during live trading its a negative value.

symbol = str(bar.Symbol) # Check current portfolio for changes if self.Securities[symbol].Invested: currentweight = self.Securities[symbol].Holdings.HoldingsValue/self.Portfolio.TotalPortfolioValue else: currentweight = 0.0

 

Author