예제 #1
0
 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')
예제 #2
0
    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')
예제 #3
0
    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)
예제 #4
0
    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)
예제 #5
0
 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'])
예제 #6
0
 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'])
예제 #7
0
 def test_last(self):
     vf = ft.ValueFrame(ft.df_indices([ft.Idx.AEX, ft.Idx.DOW]))
     self.assertIsInstance(vf.last(), pd.DataFrame)
예제 #8
0
 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'])
예제 #9
0
 def test_display_rel_change(self):
     vf = ft.ValueFrame(ft.df_indices([ft.Idx.AEX, ft.Idx.DOW]))
     vf.display_rel_change()