Exemplo n.º 1
0
 def testCursor(self):
     w = Feed(self._inst)        
     w.insert( talibfunc.ATR('ATR10',w,10) )
     w.set_cursor(None)
     self.assertEqual(w.get_last_close(), 0.0 )
     b = w.get_current_bar()
     self.assertEqual(b.datetime(), datetime.datetime(2012,1,23,0,0))
     self.assertTrue(math.isnan(b.ATR10()))
     self.assertEqual(w.get_next_bar_date(), datetime.datetime(2012,1,24,0,0))
     count = 1
     while w.get_next_bar_date()!= None:
         count += 1
         lastbar = w.get_current_bar()
     self.assertEqual(count, 252)
     self.assertEqual(lastbar.datetime(),datetime.datetime(2013,1,18,0,0))
Exemplo n.º 2
0
 def testCursor(self):
     w = Feed(self._inst)
     w.insert(talibfunc.ATR('ATR10', w, 10))
     w.set_cursor(None)
     self.assertEqual(w.get_last_close(), 0.0)
     b = w.get_current_bar()
     self.assertEqual(b.datetime(), datetime.datetime(2012, 1, 23, 0, 0))
     self.assertTrue(math.isnan(b.ATR10()))
     self.assertEqual(w.get_next_bar_date(),
                      datetime.datetime(2012, 1, 24, 0, 0))
     count = 1
     while w.get_next_bar_date() != None:
         count += 1
         lastbar = w.get_current_bar()
     self.assertEqual(count, 252)
     self.assertEqual(lastbar.datetime(),
                      datetime.datetime(2013, 1, 18, 0, 0))
Exemplo n.º 3
0
 def testCursor2(self):
     w = Feed(self._inst)
     w.set_cursor(datetime.datetime(2012, 6, 29, 0, 0))
     self.assertEqual(w.get_next_bar_date(),
                      datetime.datetime(2012, 6, 29, 0, 0))
     self.assertEqual(w.get_last_close(), 2.182)
Exemplo n.º 4
0
 def testCursor2(self):
     w = Feed(self._inst)
     w.set_cursor(datetime.datetime(2012,6,29,0,0))
     self.assertEqual(w.get_next_bar_date(), datetime.datetime(2012,6,29,0,0))
     self.assertEqual(w.get_last_close(), 2.182 )