Example #1
0
 def event_order_expired(order) -> OrderExpired:
     return OrderExpired(
         TestStubs.account_id(),
         order.cl_ord_id,
         OrderId("1"),
         UNIX_EPOCH,
         uuid4(),
         UNIX_EPOCH,
     )
Example #2
0
 def event_order_expired(order) -> OrderExpired:
     return OrderExpired(
         TestStubs.account_id(),
         order.client_order_id,
         order.venue_order_id,
         0,
         uuid4(),
         0,
     )
 def event_order_expired(order) -> OrderExpired:
     return OrderExpired(
         account_id=TestStubs.account_id(),
         client_order_id=order.client_order_id,
         venue_order_id=order.venue_order_id,
         ts_expired_ns=0,
         event_id=uuid4(),
         timestamp_ns=0,
     )
Example #4
0
    def test_can_apply_order_expired_event_to_order(self):
        # Arrange
        order = self.order_factory.market(AUDUSD_FXCM, OrderSide.BUY,
                                          Quantity(100000))

        event = OrderExpired(self.account_id, order.id, UNIX_EPOCH,
                             GUID(uuid.uuid4()), UNIX_EPOCH)

        # Act
        order.apply(event)

        # Assert
        self.assertEqual(OrderState.EXPIRED, order.state)
        self.assertTrue(order.is_completed)
    def test_order_expired(self):
        # Arrange
        uuid = uuid4()
        event = OrderExpired(
            account_id=AccountId("SIM", "000"),
            cl_ord_id=ClientOrderId("O-2020872378423"),
            order_id=OrderId("123456"),
            expired_time=UNIX_EPOCH,
            event_id=uuid,
            event_timestamp=UNIX_EPOCH,
        )

        # Act
        assert f"OrderExpired(account_id=SIM-000, cl_ord_id=O-2020872378423, order_id=123456, event_id={uuid})" == str(
            event)
        assert f"OrderExpired(account_id=SIM-000, cl_ord_id=O-2020872378423, order_id=123456, event_id={uuid})" == repr(
            event)
    def test_serialize_and_deserialize_order_expired_events(self):
        # Arrange
        event = OrderExpired(
            self.account_id,
            ClientOrderId("O-123456"),
            VenueOrderId("1"),
            0,
            uuid4(),
            0,
        )

        # Act
        serialized = self.serializer.serialize(event)
        deserialized = self.serializer.deserialize(serialized)

        # Assert
        assert deserialized == event
    def test_serialize_and_deserialize_order_expired_events(self):
        # Arrange
        event = OrderExpired(
            self.account_id,
            ClientOrderId("O-123456"),
            OrderId("1"),
            UNIX_EPOCH,
            uuid4(),
            UNIX_EPOCH,
        )

        # Act
        serialized = self.serializer.serialize(event)
        deserialized = self.serializer.deserialize(serialized)

        # Assert
        self.assertEqual(deserialized, event)
Example #8
0
    def test_order_expired(self):
        # Arrange
        uuid = uuid4()
        event = OrderExpired(
            account_id=AccountId("SIM", "000"),
            client_order_id=ClientOrderId("O-2020872378423"),
            venue_order_id=VenueOrderId("123456"),
            expired_ns=0,
            event_id=uuid,
            timestamp_ns=0,
        )

        # Act
        assert (
            f"OrderExpired(account_id=SIM-000, client_order_id=O-2020872378423, venue_order_id=123456, event_id={uuid})"
            == str(event))
        assert (
            f"OrderExpired(account_id=SIM-000, client_order_id=O-2020872378423, venue_order_id=123456, event_id={uuid})"
            == repr(event))