Beispiel #1
0
 def test_cmf_invalid_data(self):
     self.close_data.append(1)
     period = 6
     with self.assertRaises(Exception) as cm:
         chaikin_money_flow.chaikin_money_flow(self.close_data, self.high_data, self.low_data, self.volume, period)
     expected = ("Error: mismatched data lengths, check to ensure that all input data is the same length and valid")
     self.assertEqual(str(cm.exception), expected)
Beispiel #2
0
def cmf(dataframe, period=14) -> ndarray:
    from pyti.chaikin_money_flow import chaikin_money_flow

    return chaikin_money_flow(dataframe['close'], dataframe['high'],
                              dataframe['low'], dataframe['volume'], period)
Beispiel #3
0
 def test_cmf_invalid_period(self):
     period = 128
     with self.assertRaises(Exception) as cm:
         chaikin_money_flow.chaikin_money_flow(self.close_data, self.high_data, self.low_data, self.volume, period)
     expected = "Error: data_len < period"
     self.assertEqual(str(cm.exception), expected)
Beispiel #4
0
 def test_cmf_period_10(self):
     period = 10
     cmf = chaikin_money_flow.chaikin_money_flow(self.close_data, self.high_data, self.low_data, self.volume, period)
     np.testing.assert_array_equal(cmf, self.cmf_period_10_expected)