Hi guys, I hope you're doing great. 

I would like to know if there is a function that would help me get the current value of an individual asset on my Portfolio. Basically the purpose of this would be to Liquidate the asset if it has reached my Take Profit or my Stop Loss. I found a way to do this but affecting the entire Portfolio. Meaning that if at least one asset made my Portfolio loss 1% it would Liquidate all of the transactions. 

class VerticalParticleRegulators(QCAlgorithm): def Initialize(self): """ Initialization Code """ #Initial Portfolio Value self.MaxPortfolioValue = self.Portfolio.TotalPortfolioValue def OnData(self, data): #Real Time take profit and trailing Stop. currentPortfolioValue = self.Portfolio.TotalPortfolioValue #Determine Take Profit if currentPortfolioValue > self.MaxPortfolioValue: if (currentPortfolioValue - self.MaxPortfolioValue)/self.MaxPortfolioValue > 0.02: self.Liquidate() #Specify the new Maximum portfolio value self.MaxPortfolioValue = currentPortfolioValue #Determine Stop Loss else: if (self.MaxPortfolioValue - currentPortfolioValue)/self.MaxPortfolioValue > 0.01: self.Liquidate() #Specify the new Maximum portfolio value self.MaxPortfolioValue = currentPortfolioValue

I tried doing the following:

currentPortfolioValue = {} currentPortfolioValue["EURUSD"] = self.Portfolio["EURUSD"].TotalPortfolioValue

However I'm getting the following error:

During the algorithm initialization, the following exception has occurred: AttributeError : 'ForexHolding' object has no attribute 'TotalPortfolioValue' at Initialize in main.py:line 83 :: self.MaxPortfolioValue[symbol] = self.Portfolio[symbol].TotalPortfolioValue AttributeError : 'ForexHolding' object has no attribute 'TotalPortfolioValue'

Which makes sense as I shouldn't be requesting the Total Porfolio Value from a single asset.