Beispiel #1
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)
Beispiel #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')
Beispiel #3
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)
Beispiel #4
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'])
Beispiel #5
0
 def test_last(self):
     vf = ft.ValueFrame(ft.df_indices([ft.Idx.AEX, ft.Idx.DOW]))
     self.assertIsInstance(vf.last(), pd.DataFrame)
Beispiel #6
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'])
Beispiel #7
0
 def test_construction_with_one(self):
     vf = ft.ValueFrame(ft.df_index(ft.Idx.DOW))
     self.assertListEqual(list(vf.df.columns), ['close', 'open', 'high', 'low', 'volume', 'change'])
Beispiel #8
0
 def test_display_rel_change(self):
     vf = ft.ValueFrame(ft.df_indices([ft.Idx.AEX, ft.Idx.DOW]))
     vf.display_rel_change()