def load_stock_links(self):
        """ Read stock links into the model """
        links = self.__get_session().query(dal.AssetClassStock).all()
        for entity in links:
            # log(DEBUG, f"adding {entity.symbol} to {entity.assetclassid}")
            # mapping
            stock: Stock = Stock(entity.symbol)
            # find parent classes by id and assign children
            parent: AssetClass = self.model.get_class_by_id(entity.assetclassid)
            if parent:
                # Assign to parent.
                parent.stocks.append(stock)
                # Add to index for easy reference
                self.model.stocks.append(stock)
def load_stock_links ( self ) : links = self . __get_session ( ) . query ( dal . AssetClassStock ) . all ( ) for entity in links : stock : Stock = Stock ( entity . symbol ) parent : AssetClass = self . model . get_class_by_id ( entity . assetclassid ) if parent : parent . stocks . append ( stock ) self . model . stocks . append ( stock )
Read stock links into the model