Ejemplo n.º 1
0
 def test_has_active_bids(self):
     book = OrderBook()
     self.assertEqual(book.has_active_bids(), False)
     order = Order(ID_GENERATOR, AGENT_ID, PRICE, "LIMIT", 100)
     book.add_order(order)
     self.assertEqual(book.has_active_bids(), True)
     self.assertEqual(book.has_active_asks(), False)
Ejemplo n.º 2
0
 def test_has_both_active(self):
     book = OrderBook()
     self.assertEqual(book.has_active_bids(), False)
     limit_buy_order = Order(ID_GENERATOR, 1, 100, "LIMIT", 100)
     limit_sell_order = Order(ID_GENERATOR, 2, 105, "LIMIT", -100)
     book.add_order(limit_buy_order)
     book.add_order(limit_sell_order)
     self.assertEqual(book.has_active_asks(), True)
     self.assertEqual(book.has_active_bids(), True)