def test_fill_price_worse_than_limit_price(self): non_limit_order = TestOrder(limit=None, direction=1) limit_buy = TestOrder(limit=1.5, direction=1) limit_sell = TestOrder(limit=1.5, direction=-1) for price in [1, 1.5, 2]: self.assertFalse( fill_price_worse_than_limit_price(price, non_limit_order)) self.assertFalse(fill_price_worse_than_limit_price(1, limit_buy)) self.assertFalse(fill_price_worse_than_limit_price(1.5, limit_buy)) self.assertTrue(fill_price_worse_than_limit_price(2, limit_buy)) self.assertTrue(fill_price_worse_than_limit_price(1, limit_sell)) self.assertFalse(fill_price_worse_than_limit_price(1.5, limit_sell)) self.assertFalse(fill_price_worse_than_limit_price(2, limit_sell))
def test_fill_price_worse_than_limit_price(self): non_limit_order = TestOrder(limit=None, direction=1) limit_buy = TestOrder(limit=1.5, direction=1) limit_sell = TestOrder(limit=1.5, direction=-1) for price in [1, 1.5, 2]: assert not fill_price_worse_than_limit_price( price, non_limit_order) assert not fill_price_worse_than_limit_price(1, limit_buy) assert not fill_price_worse_than_limit_price(1.5, limit_buy) assert fill_price_worse_than_limit_price(2, limit_buy) assert fill_price_worse_than_limit_price(1, limit_sell) assert not fill_price_worse_than_limit_price(1.5, limit_sell) assert not fill_price_worse_than_limit_price(2, limit_sell)
def test_fill_price_worse_than_limit_price(self): non_limit_order = TestOrder(limit=None, direction=1) limit_buy = TestOrder(limit=1.5, direction=1) limit_sell = TestOrder(limit=1.5, direction=-1) for price in [1, 1.5, 2]: self.assertFalse( fill_price_worse_than_limit_price(price, non_limit_order) ) self.assertFalse(fill_price_worse_than_limit_price(1, limit_buy)) self.assertFalse(fill_price_worse_than_limit_price(1.5, limit_buy)) self.assertTrue(fill_price_worse_than_limit_price(2, limit_buy)) self.assertTrue(fill_price_worse_than_limit_price(1, limit_sell)) self.assertFalse(fill_price_worse_than_limit_price(1.5, limit_sell)) self.assertFalse(fill_price_worse_than_limit_price(2, limit_sell))