Ejemplo n.º 1
0
 def testFull(self):
     b = Bar(datetime.datetime(2013,3,22),15.0, 25.0, 15.0, 20.0, volume=10000, open_interest=500, adj_close=22.5)
     self.assertEqual(b.open(), 15.0)
     self.assertEqual(b.high(), 25.0)
     self.assertEqual(b.low(), 15.0)
     self.assertEqual(b.close(), 20.0)
     self.assertEqual(b.volume(), 10000)
     self.assertEqual(b.open_interest(), 500)
     self.assertEqual(b.adj_close(), 22.5)
     bstr = '%s' % b
     self.assertEqual(bstr, 'date:2013-03-22 00:00:00,open:15.0,high:25.0,low:15.0,close:20.0,volume:10000,open_interest:500,adjusted_close:22.5')
Ejemplo n.º 2
0
 def testMinimal(self):
     b = Bar(datetime.datetime(2013,1,23),10.0, 40.0, 5.0, 25.0)
     self.assertEqual(b.open(), 10.0)
     self.assertEqual(b.high(), 40.0)
     self.assertEqual(b.low(), 5.0)
     self.assertEqual(b.close(), 25.0)
     self.assertEqual(b.volume(), None)
     self.assertEqual(b.open_interest(), None)
     self.assertEqual(b.adj_close(), None)
     bstr = '%s' % b
     self.assertEqual(bstr, 'date:2013-01-23 00:00:00,open:10.0,high:40.0,low:5.0,close:25.0')
Ejemplo n.º 3
0
 def testMinimal(self):
     b = Bar(datetime.datetime(2013, 1, 23), 10.0, 40.0, 5.0, 25.0)
     self.assertEqual(b.open(), 10.0)
     self.assertEqual(b.high(), 40.0)
     self.assertEqual(b.low(), 5.0)
     self.assertEqual(b.close(), 25.0)
     self.assertEqual(b.volume(), None)
     self.assertEqual(b.open_interest(), None)
     self.assertEqual(b.adj_close(), None)
     bstr = '%s' % b
     self.assertEqual(
         bstr,
         'date:2013-01-23 00:00:00,open:10.0,high:40.0,low:5.0,close:25.0')
Ejemplo n.º 4
0
 def testFull(self):
     b = Bar(datetime.datetime(2013, 3, 22),
             15.0,
             25.0,
             15.0,
             20.0,
             volume=10000,
             open_interest=500,
             adj_close=22.5)
     self.assertEqual(b.open(), 15.0)
     self.assertEqual(b.high(), 25.0)
     self.assertEqual(b.low(), 15.0)
     self.assertEqual(b.close(), 20.0)
     self.assertEqual(b.volume(), 10000)
     self.assertEqual(b.open_interest(), 500)
     self.assertEqual(b.adj_close(), 22.5)
     bstr = '%s' % b
     self.assertEqual(
         bstr,
         'date:2013-03-22 00:00:00,open:15.0,high:25.0,low:15.0,close:20.0,volume:10000,open_interest:500,adjusted_close:22.5'
     )