def __init__(self, alpha: float or list or None = EMA_ALPHA): """ Data Pipeline constructor. """ self.alpha = alpha self.ema = load_ema(alpha=alpha) self._scaler = StandardScaler()
def __init__(self, use_arctic=False, z_score=True, alpha=None): """ Simulator constructor :param use_arctic: If TRUE, Simulator creates a connection to Arctic, Otherwise, no connection is attempted :param z_score: If TRUE, normalize data with z-score, ELSE use min-max scaler """ self._scaler = StandardScaler() if z_score else MinMaxScaler() self.cwd = os.path.dirname(os.path.realpath(__file__)) self.ema = load_ema(alpha=alpha) try: if use_arctic: print('Attempting to connect to Arctic...') self.arctic = Arctic(MONGO_ENDPOINT) self.arctic.initialize_library(ARCTIC_NAME, lib_type=TICK_STORE) self.library = self.arctic[ARCTIC_NAME] print('Connected to Arctic.') else: self.arctic = self.library = None except Exception as ex: self.arctic = self.library = None print('Unable to connect to Arctic database') print(ex)
def __init__(self, window=INDICATOR_WINDOW, alpha=None): """ Indicator constructor :param window: (int) rolling window used for indicators :param alpha: (float) decay rate for EMA; if NONE, raw values returned """ self.window = window self.all_history_queue = deque(maxlen=self.window) self.ema = load_ema(alpha=alpha) self._value = None
def __init__(self, z_score=True, alpha=None): """ Simulator constructor :param z_score: If TRUE, normalize data with z-score, ELSE use min-max scaler """ self._scaler = StandardScaler() if z_score else MinMaxScaler() self.cwd = os.path.dirname(os.path.realpath(__file__)) self.ema = load_ema(alpha=alpha) self.alpha = alpha self.db = Database(sym='None', exchange='None', record_data=False)