示例#1
0
 def test_get_best_bbo_general_extended(self):
     book1 = OrderBook()
     book1.update_level(2, 4, True)
     book1.update_level(8, 6, True)
     book1.update_level(3, 5, False)
     book1.update_level(1, 2, False)
     assert book1.get_best_bbo() == (8, 6, 3, 5)
示例#2
0
 def test_get_levels_general(self):
     book1 = OrderBook()
     book1.update_level(2, 4, True)
     book1.update_level(3, 4, True)
     book1.update_level(5, 2, False)
     book1.update_level(3, 1, False)
     assert book1.get_levels() == (([(3,4)], [(2, 4)]),([(3,1)],[(5, 2)]))
示例#3
0
 def test_get_levels_general_empty_buy_list(self):
     book1 = OrderBook()
     book1.update_level(2, 4, False)
     book1.update_level(3, 4, False)
     assert book1.get_levels() == ((), ([(2, 4)],[(3, 4)]))
示例#4
0
 def test_get_levels_general_empty_sell_list(self):
     book1 = OrderBook()
     book1.update_level(2, 4, True)
     book1.update_level(3, 4, True)
     assert book1.get_levels() == (([(3, 4)],[(2, 4)]), ())
示例#5
0
 def test_get_best_bbo_empty_buy_list(self):
     book1 = OrderBook()
     book1.update_level(2, 4, False)
     assert book1.get_best_bbo() == (None, None, 2, 4)
示例#6
0
 def test_get_best_bbo_empty_sell_list(self):
     book1 = OrderBook()
     book1.update_level(2, 4, True)
     assert book1.get_best_bbo() == (2, 4, None, None)
示例#7
0
 def test_get_best_bbo_empty_lists(self):
     book1 = OrderBook()
     book1.update_level(2, 0, True)
     book1.update_level(3, 0, False)
     assert book1.get_best_bbo() == (None, None, None, None)
示例#8
0
 def test_update_level_add(self):
     book1 = OrderBook()
     book1.update_level(2, 4, True)
     assert book1.levels_buy == [[(2,4)]]
示例#9
0
 def test_get_best_bbo_general(self):
     book1 = OrderBook()
     book1.update_level(2, 4, True)
     book1.update_level(3, 5, False)
     assert book1.get_best_bbo() == (2, 4, 3, 5)
示例#10
0
 def test_update_level_delete(self):
     book1 = OrderBook()
     book1.update_level(3, 1, True)
     book1.update_level(2, 4, True)
     book1.update_level(2, 0, True)
     assert book1.levels_buy == [[(3,1)]]
示例#11
0
 def test_update_level_change(self):
     book1 = OrderBook()
     book1.update_level(2, 4, True)
     book1.update_level(2, 3, True)
     assert book1.levels_buy == [[(2,3)]]
示例#12
0
 def test_update_level_add_zero_volume(self):
     book1 = OrderBook()
     book1.update_level(2, 0, True)
     assert book1.levels_buy == []
示例#13
0
 def test_update_level_add_to_sell_list(self):
     book1 = OrderBook()
     book1.update_level(2, 4, False)
     assert book1.levels_buy == []
     assert book1.levels_sell == [[(2, 4)]]