INNER CODE UNIT · Python

TrackingModel

dmarienko/QuantTradingResearch · models/helpers.py:53

class TrackingModel:
    def __init__(self, data, index_name, train_date):
        self.data = data
        self.closes = retain_columns_and_join(data, 'close')
        self.index = data[index_name]
        self.index_closes = self.index.close
        self.X_price = self.closes[self.closes.columns[~self.closes.columns.str.match(index_name)]]
        self.Y_price = self.closes[index_name]
        self.X_ret, self.Y_ret = prices_to_returns(self.X_price), prices_to_returns(self.Y_price)
        self.train_date = pd.Timestamp(train_date)
        self.selection = None
        
    def select(self, selection):
        n = copy.copy(self)
        n.selection = set(n.data.keys()) & set(selection)
        return n
        
    def get_data(self, mode='prices', where='all data'):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…