def test_not_implemented_get_value(self): past_prices = transforms.get_past_prices( refresh_period=10, window_length=20, compute_only_full=True ) past_prices.get_value()
def test_intialize_get_past_prices(self): past_prices = transforms.get_past_prices(refresh_period=10, window_length=20, compute_only_full=True) self._check_intialized_transform(past_prices) eq_(past_prices.compute_transform_value({'price': 5.32}), 5.32) eq_(past_prices.refresh_period, 10) eq_(past_prices.window_length, 20)
def test_intialize_get_past_prices(self): past_prices = transforms.get_past_prices( refresh_period=10, window_length=20, compute_only_full=True ) self._check_intialized_transform(past_prices) eq_(past_prices.compute_transform_value({'price': 5.32}), 5.32) eq_(past_prices.refresh_period, 10) eq_(past_prices.window_length, 20)
def initialize(self, configuration): # window gives the number of data points that are extracted # from historical data # to estimate the expected returns and covariance matrix. self.window = configuration.get('window', trading_days_per_year) self.refresh_rate = configuration.get('refresh', 10) #TODO Automatically find out # Apple, Google, GE, Microsoft, Amazon self.market_cap = [479.51, 377.58, 272.76, 300.86, 180.96] self.cap_wts = \ np.array(self.market_cap) / sum(np.array(self.market_cap)) self.only_full = configuration.get('only_full', True) self.price_transform = transforms.get_past_prices( refresh_period=self.refresh_rate, window_length=self.window, compute_only_full=self.only_full)
def initialize(self, properties): # Interactive, mobile, hipchat, database and commission middlewares for middleware in common_middlewares(properties, self.identity): self.use(middleware) report_mails = properties.get('reports') if report_mails: self.use(mail.Report(report_mails).send_briefing) self.buy_trigger = properties.get('buy_trigger', 30) self.sell_trigger = properties.get('sell_trigger', 70) self.period = properties.get('period', 14) # RSI Signal self.rsi = ta.RSI(timeperiod=self.period) # Quotes loopback for managers self.prices_transform = transforms.get_past_prices( #refresh_period=10, window_length=properties.get('window', 40), compute_only_full=properties.get('only_full'))
def initialize(self, config): self.price_transform = transforms.get_past_prices( #refresh_period=10, window_length=config.get('window', 40), compute_only_full=config.get('only_full', True))
def test_not_implemented_get_value(self): past_prices = transforms.get_past_prices(refresh_period=10, window_length=20, compute_only_full=True) past_prices.get_value()