Ejemplo n.º 1
0
 def test_single_partial_fill(self):
     self.assertEqual(
         Order(quantity=100,
               leaves_quantity=40,
               state=State.partially_filled,
               previous=(Order(quantity=100,
                               leaves_quantity=100,
                               state=State.new,
                               previous=None), Event.fill, {
                                   'quantity': 60
                               })), fill(new(100), 60))
Ejemplo n.º 2
0
 def test_single_fill(self):
     self.assertEqual(
         Order(quantity=100,
               leaves_quantity=0,
               state=State.filled,
               previous=(Order(quantity=100,
                               leaves_quantity=100,
                               state=State.new,
                               previous=None), Event.fill, {
                                   'quantity': 100
                               })), fill(new(100), 100))
Ejemplo n.º 3
0
 def test_over_fill(self):
     o = new(100)
     o = fill(o, 60)
     o = fill(o, 60)
     self.assertEqual(
         Order(quantity=100,
               leaves_quantity=-20,
               state=State.over_filled,
               previous=(Order(quantity=100,
                               leaves_quantity=40,
                               state=State.partially_filled,
                               previous=(Order(quantity=100,
                                               leaves_quantity=100,
                                               state=State.new,
                                               previous=None), Event.fill, {
                                                   'quantity': 60
                                               })), Event.fill, {
                                                   'quantity': 60
                                               })), o)
Ejemplo n.º 4
0
 def test_multiple_fills(self):
     o = new(100)
     o = fill(o, 40)
     o = fill(o, 60)
     self.assertEqual(
         Order(quantity=100,
               leaves_quantity=0,
               state=State.filled,
               previous=(Order(quantity=100,
                               leaves_quantity=60,
                               state=State.partially_filled,
                               previous=(Order(quantity=100,
                                               leaves_quantity=100,
                                               state=State.new,
                                               previous=None), Event.fill, {
                                                   'quantity': 40
                                               })), Event.fill, {
                                                   'quantity': 60
                                               })), o)
Ejemplo n.º 5
0
 def test_new(self):
     self.assertEqual(
         Order(quantity=100,
               leaves_quantity=100,
               state=State.new,
               previous=None), new(100))