def test_wma2(self): wma2 = LinearWeightedMovingAverage(inputs=(USEquityPricing.close, ), window_length=10) today = pd.Timestamp("2015") assets = np.arange(5, dtype=np.int64) data = np.arange(50, dtype=np.float64).reshape((10, 5)) out = np.zeros(data.shape[1]) wma2.compute(today, assets, out, data) assert_equal(out, np.array([30.0, 31.0, 32.0, 33.0, 34.0]))
def test_wma1(self): wma1 = LinearWeightedMovingAverage(inputs=(USEquityPricing.close, ), window_length=10) today = pd.Timestamp("2015") assets = np.arange(5, dtype=np.int64) data = np.ones((10, 5)) out = np.zeros(data.shape[1]) wma1.compute(today, assets, out, data) assert_equal(out, np.ones(5))
def test_wma2(self): wma2 = LinearWeightedMovingAverage( inputs=(USEquityPricing.close,), window_length=10 ) today = pd.Timestamp('2015') assets = np.arange(5, dtype=np.int64) data = np.arange(50, dtype=float).reshape((10, 5)) out = np.zeros(data.shape[1]) wma2.compute(today, assets, out, data) assert_equal(out, np.array([30., 31., 32., 33., 34.]))
def test_wma1(self): wma1 = LinearWeightedMovingAverage( inputs=(USEquityPricing.close,), window_length=10 ) today = pd.Timestamp('2015') assets = np.arange(5, dtype=np.int64) data = np.ones((10, 5)) out = np.zeros(data.shape[1]) wma1.compute(today, assets, out, data) assert_equal(out, np.ones(5))