Order State

Order state is defined by IOrder.State, which can be OPENED, CREATED, FILLED, CLOSED, or CANCELLED. The user can modify, close or cancel active orders, i.e. the ones with state OPENED, CREATED, or FILLED. The user can not modify immutable orders - the ones with state CLOSED or CANCELLED. The data of CLOSED orders can be retrieved from Order History of the IHistory interface. Order history does not contain CANCELLED orders, since they never enter the market (i.e. cause a trading balance change).

Order state may change in two cases:

  • on user action either manually or from a strategy (e.g., submit, close order, set stop loss price, etc.),
  • a price condition is met on the server side (e.g., meeting price condition fills an order, meeting stop loss price condition closes an order, etc.).

An order state change in a strategy gets notified in onMessage callback method and message type is defined by IMessage.Type. On certain order state changes, certain messages arrive. All possible action, order state and message combinations are shown in the order state diagrams below. In general, before calling any order changing method one should always check the order state. See more on managing order state and value changes and received messages in Manage Order State.

Market Order States Diagramm

The following diagram describes the workflow of market orders. See more on market orders in Market Order.

Hedged

Order State Market

Global

Order State Market Global

Conditional Order States Diagramm

The following diagram describes the workflow of conditional orders. See more on conditional orders in Conditional Order.

Hedged

Order State Cond

Global

Order State Cond Global

The information on this web site is provided only as general information, which may be incomplete or outdated. Click here for full disclaimer.