def test_logging_indices(self): ft.debug(ft.df_indices, [ft.Idx.AEX, ft.Idx.DOW], col='high') print('\nstop logging level debug') df = ft.info(ft.df_indices, [ft.Idx.AEX, ft.Idx.DOW], col='high') print() print(df.tail()) print('no more logging') ft.df_indices([ft.Idx.AEX, ft.Idx.DOW]) print('end of function')
def test_abs_daily_change(self): vf = ft.ValueFrame(ft.df_indices([ft.Idx.AEX, ft.Idx.DOW])) df = vf.abs_daily_change() self.assertIsInstance(df, pd.DataFrame) self.assertEqual(0, df.DOW['2019-01-21']) # print(df) df = vf.abs_daily_change(start='2019-02-28', end='2020-01-31')
def test_last_index(self): vf = ft.ValueFrame(ft.df_indices([ft.Idx.AEX, ft.Idx.DOW])) last = vf.last_index() self.assertIsInstance(last, str) self.assertEqual('2019-03-01', last) last = vf.last_index(as_string=False) self.assertIsInstance(last, pd.Timestamp)
def test_first_index(self): vf = ft.ValueFrame(ft.df_indices([ft.Idx.AEX, ft.Idx.DOW])) first = vf.first_index() self.assertIsInstance(first, str) self.assertEqual('2019-01-02', first) first = vf.first_index(as_string=False) self.assertIsInstance(first, pd.Timestamp)
def test_indices(self): df = ft.df_indices([ft.Idx.AEX, ft.Idx.DOW], col='high') self.assertIsInstance(df.index, pd.DatetimeIndex) self.assertListEqual(list(df.columns), ['AEX', 'DOW'])
def test_rel_change(self): vf = ft.ValueFrame(ft.df_indices([ft.Idx.AEX, ft.Idx.DOW])) df = vf.rel_change() self.assertIsInstance(df, pd.DataFrame) self.assertEqual(df.DOW['2019-01-18'], df.DOW['2019-01-21'])
def test_last(self): vf = ft.ValueFrame(ft.df_indices([ft.Idx.AEX, ft.Idx.DOW])) self.assertIsInstance(vf.last(), pd.DataFrame)
def test_construction_with_multiple(self): vf = ft.ValueFrame([ft.df_indices(ft.Idx.DOW), ft.df_indices(ft.Idx.AEX)]) self.assertListEqual(list(vf.df.columns), ['DOW', 'AEX'])
def test_display_rel_change(self): vf = ft.ValueFrame(ft.df_indices([ft.Idx.AEX, ft.Idx.DOW])) vf.display_rel_change()