예제 #1
0
 def testNormalizeDataBasic(self):
     """Test the normalize data function with basic inputs"""
     data = np.random.rand(3, 100)
     ndata = normalizeData(data)
     assert np.shape(ndata) == (3, 99), "Normalize Data gave incorrect shape"
     for nd, d in izip(ndata, data):
         assert close_enough(nd, rateOfReturn(d)), "Normalize Data did not use Rate of Return function correctly"
예제 #2
0
 def testNormalizeDataWithSelectedDivisor(self):
     """Test the normalize data function with a selected RateOfReturn divisor row"""
     data = np.random.rand(3, 100)
     data[2] += 100
     ndata = normalizeData(data, ror_divisor_row=2)
     assert np.shape(ndata) == (3, 99), "Normalize Data gave incorrect shape"
     for nd, d in izip(ndata, data):
         assert close_enough(
             nd, rateOfReturn(d, data[2][0:-1])
         ), "Normalize Data did not use Rate of Return with divisor function correctly"
예제 #3
0
 def testNormalizeDataWithVolume(self):
     """Test the normalize data function with a selected RateOfReturn divisor row"""
     data = np.random.rand(3, 100)
     data = np.array(data.tolist() + np.random.randint(100, 10000, (1, 100)).tolist())
     ndata = normalizeData(data, volume_row=3)
     assert np.shape(ndata) == (4, 99), "Normalize Data gave incorrect shape"
     for nd, d in izip(ndata[0:3], data[0:3]):
         assert close_enough(nd, rateOfReturn(d)), "Normalize Data did not use Rate of Return correctly"
     assert close_enough(
         ndata[3], normalizeVolume(data[3][1:])
     ), "Normalize Data did not use Normalize Volume correctly"