示例#1
0
 def test_mm_2(self):
     s = 'test_series|mm 2'
     df = zealot(s)
     self.assertEqual(df['min_2'][1], 3.0)
     self.assertEqual(df['min_2'][2], 1.0)
     self.assertEqual(df['min_2'][3], 1.0)
     self.assertEqual(df['min_2'][4], 1.0)
     self.assertEqual(df['max_2'][1], 6.0)
     self.assertEqual(df['max_2'][2], 4.0)
     self.assertEqual(df['max_2'][3], 3.0)
     self.assertEqual(df['max_2'][4], 3.0)
示例#2
0
    def test_starter(self):
        s = 'test_series|mva 2|mva 3 -src open'
        df = zealot(s)
        self.assertEqual(df['mva_2'][1], 4.5)
        self.assertEqual(df['mva_2'][2], 3.5)
        self.assertEqual(df['mva_2'][3], 2.5)
        self.assertEqual(df['mva_2'][4], 1.5)

        self.assertEqual(df['mva_3'][2], 2.0)
        self.assertEqual(df['mva_3'][3], 3.0)
        self.assertEqual(df['mva_3'][4], 4.0)
示例#3
0
 def test_cut_2(self):
     s = 'test_series|cut -rm open close'
     df = zealot(s)
     self.assertEqual(len(df.columns.values), 2)
     self.assertEqual(df.columns.values[0], 'high')
     self.assertEqual(df.columns.values[1], 'low')
示例#4
0
 def test_price_in_pipe(self):
     df = zealot('price test|mva 5')
     self.assertEqual(df.shape, (16, 5))
     self.assertEqual(df['mva_5'][4], sum(df['close'][0:5]) / 5)
示例#5
0
 def test_row_filter_chaining(self):
     s = 'test_series | filter close in 1.0 2.0 3.0 | filter close > 1.0'
     df = zealot(s)
     self.assertEqual(df.shape, (2, 4))
     self.assertEqual(df['close'].iloc[0], 3.0)
     self.assertEqual(df['close'].iloc[1], 2.0)
示例#6
0
 def test_row_filter_9(self):
     s = 'test_series|filter close ni 1.0 3.0 2.0'
     df = zealot(s)
     self.assertEqual(df.shape, (2, 4))
     self.assertEqual(df['close'].iloc[0], 5.0)
     self.assertEqual(df['close'].iloc[1], 4.0)