Placing/Creating Order
Pre-requisites:
To create an order request, the following prerequisites must be set/ready:
- Client is active.
- Client is validated.
- Client has at least 1 InternalAccount with a default InternalAccount set or specify internalAccountId in the query.
- Client has at least 1 DepositAccount with a default DepositAccount set or specify depositAccountId in the query.
- The Account usage type of the client's deposit account and internal account should be the same.
- Client has enough available balance in its InternalAccount to make a BUY, including fees and taxes.
- Client has enough sellable quantity in its DepositAccount to make a SELL of the specific financial instrument.
Placing Orders (Creating an Order) Flow
The flow for placing orders is as follows:
-
Call Trader OMS API create order endpoint.
-
Response from create order endpoint can be one of the following cases with HTTP status codes:
200: SUCCESS - The response will contain an order object with an id (UUID) and an initial status of NEW. This means that the order is entered into the market and waiting to be executed as specified when possible.
400: BAD_REQUEST - In case of invalid input or if one of the prerequisites for placing an order is not satisfied. The response body will contain RejectReasonCode and RejectReason as an error message.
422: UNPROCESSABLE_ENTITY - The request had some conflicting issues to reject placing the order. The response body will contain RejectReasonCode and RejectReason as an error message.
-
If a SUCCESS response is received, save the returned id (UUID) and client order id. These will be the main references for later order lifecycle.
-
If a SUCCESS response is received, the order is not processed and executed by the market immediately. Based on the order parameters, market conditions, etc., the order can be filled, canceled, declined, or rejected later (possibly days). Therefore, you need to check the order status. There are 2 methods of checking order status, as defined in the following sections.
Required Fields for Placing Order
Specify the following:
- clientId: For which client this order is for.
- clientOrderId: A unique identifier string of the order as assigned by the caller of the API. Uniqueness must be guaranteed within your software.
- side: BUY or SELL.
- isinCode: International financial instrument code to be traded.
- orderType: One of MARKET, LIMIT, STOP, STOP_LIMIT.
- orderSubType: One of REGULAR, FRACTIONAL, MONEY_ORDER.
- orderQty: The amount of shares or quantity requested to BUY or SELL.
- orderAmount: The amount of money that will be spent for BUYs or sold for SELLs, including fee, commission, and tax amounts. Set zero if REGULAR order.
- currencyCode: 3 code currency of the prices.
- price: The price that the trade deal should be. If the financial instrument's price becomes this price and there is a buyer or seller, the deal will happen at this price. Set zero for MARKET or STOP orders.
- stopPrice: The stop price that the trade deal should be. If the financial instrument's price becomes this price and there is a buyer or seller, the deal will happen at this price. Set zero for MARKET or LIMIT orders.
- timeInForce: One of IMMEDIATE_OR_CANCEL, FILL_OR_KILL, GOOD_TILL_DATE. GOOD_TILL_DATE can only be in pending type orders, such as LIMIT, STOP, STOP_LIMIT.
- expireDate: The date of order expiration (the local market date at which the order can be traded last). Must always be given (independent of timeInForce).
- provider: The market provider that you want to place the order. OMS API can have multiple trade providers (trading markets) trading the same financial instrument. Therefore, this has to be specified.
- blockOrderType: If not a Block Order, then set it as "NONE". If Block Order then set it as "SINGLE".
NOTE
- For Block Order placing, only the Child Block Orders should be sent to the OMS API.
- OMS API will do the aggregation and create a PARENT Block Order and send it to the trade provider (market).
- For Block Order placing, order request MUST specify BlockOrderType as SINGLE, meaning that it is a Child Block Order.
- For Block Order placing, order request MUST specify cutOffDate (in TradeProvider's local time).
- For Block Order placing, order request MUST specify cutOffTime (in TradeProvider's local time).
Order Lifecycle
After an order is formed and sent to the OMS API, the status of the order may change.
Your software needs to keep track of the order status.