def test_shape(self): close = self.app_context.inst_data_mgr.get_series("bar") close.start(self.app_context) sma3 = SMA(close, input_key='close', length=3) sma20 = SMA(close, input_key='close', length=20) sma50 = SMA(close, input_key='close', length=50) sma3.start(self.app_context) sma20.start(self.app_context) sma50.start(self.app_context) rank = Rank([sma3, sma20, sma50], input_key='close') rank.start(self.app_context) self.assertAlmostEqual([1, 3], rank.shape(), 5)
def test_shape(self): close = self.app_context.inst_data_mgr.get_series("bar") close.start(self.app_context) sma3 = SMA(close, input_key='close', length=3) sma20 = SMA(close, input_key='close', length=20) sma50 = SMA(close, input_key='close', length=50) sma3.start(self.app_context) sma20.start(self.app_context) sma50.start(self.app_context) rank = Rank([sma3, sma20, sma50], input_key='close') rank.start(self.app_context) self.assertAlmostEqual([1, 3], rank.shape(), 5)
def test_shape(self): close = self.app_context.inst_data_mgr.get_series("bar") close.start(self.app_context) sma3 = SMA(inputs=close, input_keys='close', length=3) sma20 = SMA(inputs=close, input_keys='close', length=20) sma50 = SMA(inputs=close, input_keys='close', length=50) sma3.start(self.app_context) sma20.start(self.app_context) sma50.start(self.app_context) rank = Rank(inputs=[sma3, sma20, sma50], input_keys='close') rank.start(self.app_context) try: np.testing.assert_almost_equal(np.array([1, 3]), rank.shape(), 5) except AssertionError as e: self.fail(e.message)
def test_shape(self): close = self.app_context.inst_data_mgr.get_series("bar") close.start(self.app_context) sma3 = SMA(close, input_key="close", length=3) sma20 = SMA(close, input_key="close", length=20) sma50 = SMA(close, input_key="close", length=50) sma3.start(self.app_context) sma20.start(self.app_context) sma50.start(self.app_context) rank = Rank([sma3, sma20, sma50], input_key="close") rank.start(self.app_context) try: np.testing.assert_almost_equal(np.array([1, 3]), rank.shape(), 5) except AssertionError as e: self.fail(e.message)