I'm working on building a python class structure that makes it easier to swap out strategies and risk models while using multi-timeFrames techniques. I've been off in my own code world for a few months, and I came back and went to run it and hit an Attribute error I'm unfamiliar with. 

During the algorithm initialization, the following exception has occurred: AttributeError : 'ForexHolding' object has no attribute 'TotalMargin' at Initialize in main.py:line 39 at __init__ in SymbolBox.py:line 37 at __init__ in TradeManagment.py:line 13 :: self.TotalMargin = self.symbol.TotalMargin /5 AttributeError : 'ForexHolding' object has no attribute 'TotalMargin'


I found these two links, but I'm still having a hard time seeing which classes I should be indexing through/ what part of the API I'm incorrectly calling. 



It centers around the QC portfolio. The code below is going to be slightly broken up, I'm including the code in each class that produces the error. It's during __init__ so the rest of the code seems unecessary. 

    class Main

        self.symbols = ['EURUSD','NZDUSD']

        for i in self.symbols:

            sym = self.AddSecurity(SecurityType.Forex, i, Resolution.Hour,leverage= 100).Symbol
            self.allTicks[sym] = SymbolBox(i, sym, self.timeFrames, self)


    class SymbolBox

        def __init__(self, symbol,sym, timeFrames, QCAlgorithm):

            inits all variables and classes needed by each symbol to trade.
            Handles all day for each Symbol inside its' respecive class.

            self.tick = symbol
            self.s = sym
            self.algo = QCAlgorithm
            self.symbol = QCAlgorithm.Portfolio[sym]

            self.TM = TradeManagment(QCAlgorithm,sym)


    class TradeManagment

        def __init__(self,QcAlgo,symbol):

            self.algo = QcAlgo
            self.symbol = QcAlgo.Portfolio[symbol]
            #symbol is pulling only the string, not the class. Need to decide how to place
            self.TotalMargin = self.symbol.TotalMargin /5

My leading theory so far is that when I call self.AddSecurity().Symbol in main I'm pulling out and storing one call too deep into the class and getting the wrong variable?