'Test the trade tick method in an order book'

def test_trade_tick(self):

    self.order_book.insert_ask(self.ask)
    self.order_book.insert_bid(self.bid)
    self.order_book.insert_ask(self.ask2)
    self.order_book.insert_bid(self.bid2)
    self.order_book.trade_tick(self.ask.order_id, self.bid.order_id, Quantity(20, 'MC'), Timestamp.now())
    self.assertTrue(self.order_book.tick_exists(self.ask.order_id))
    self.assertTrue(self.order_book.tick_exists(self.bid.order_id))
    self.assertEqual(self.order_book.get_tick(self.ask.order_id).tick.quantity, Quantity(10, 'MC'))
    self.assertEqual(self.order_book.get_tick(self.bid.order_id).tick.quantity, Quantity(10, 'MC'))
    self.order_book.trade_tick(self.bid2.order_id, self.ask2.order_id, Quantity(30, 'MC'), Timestamp.now())
    self.assertTrue(self.order_book.tick_exists(self.ask2.order_id))
    self.assertTrue(self.order_book.tick_exists(self.bid2.order_id))
    self.assertEqual(self.order_book.get_tick(self.ask2.order_id).tick.quantity, Quantity(0, 'MC'))
    self.assertEqual(self.order_book.get_tick(self.bid2.order_id).tick.quantity, Quantity(0, 'MC'))
