def test_is_sell(self): order = Order( NewOrderRequest(cl_id='test', cl_ord_id=1, inst_id=1, action=OrdAction.SELL, type=OrdType.LIMIT, qty=1000, limit_price=18.5)) self.assertFalse(order.is_buy()) self.assertTrue(order.is_sell()) order = Order( NewOrderRequest(cl_id='test', cl_ord_id=1, inst_id=1, action=OrdAction.SSHORT, type=OrdType.LIMIT, qty=1000, limit_price=18.5)) self.assertFalse(order.is_buy()) self.assertTrue(order.is_sell())
def test_is_buy(self): order = Order( NewOrderRequest(cl_id='test', cl_ord_id=1, inst_id=1, action=OrdAction.BUY, type=OrdType.LIMIT, qty=1000, limit_price=18.5)) self.assertTrue(order.is_buy()) self.assertFalse(order.is_sell())
def test_is_buy(self): nos = ModelFactory.build_new_order_request(timestamp=0, cl_id='TestClient', cl_ord_id="TestClientOrder", portf_id="TestPortf", broker_id="TestBroker", inst_id="HSI@SEHK", action=Buy, type=Limit, qty=1000, limit_price=18.5) order = Order(ModelFactory.build_order_state_from_nos(nos)) self.assertTrue(order.is_buy()) self.assertFalse(order.is_sell())