Order
'Order' object contains order information. It is a object used by Orders
interface, and is also returned by Sell
or Buy
commands.
Orders are created by issuing Buy
or Sell
commands. The status field is the first indicator we should check to determine if an order was submitted successfully.
- JavaScript
- Python
#
Status codesaccepted
: at first an order is in accepted state. This means the broker has successfully received your order - however it has not been processed yet.new
: once an order is processed by the broker, it is moved to a new status.duplicate
: if your algorithm tries to submit two or more orders with the same parameters: same symbol, same quantity, same limit price, etc. it's status will be set to duplicate and the order WILL NOT be submitted to the broker. This feature can be disabled via configuration, but I'd caution against doing so.rejected
orforbidden
: in case there is an error, the status may be set to rejected or forbidden with additional information in statusCode field and extendedInfo fields. Such code can result with orders that do not have enough cash or equity to make a transaction. Example: Holding 1000 shares of AMC and issuing two orders to sell 1000 shares of AMC will result in the first order being accepted and the second forbidden.
#
Order objectField | Field type | Description |
---|---|---|
symbol | String | the symbol of the underlying |
status | String | order status (‘new’, ‘filled’, ‘partfilled’, ‘canceled’, ‘duplicate’, etc.) |
statusCode | String | status code (as defined by the broker) |
side | String | ‘buy’ or ‘sell’ |
qty | Number | the number of shares in the order |
type | String | ‘market’ or ‘limit’ |
limitPrice | Float | limit price if type is “limit” |
timeInForce | String | ‘Day’, ‘GTC’ (GoodTillCanceled), etc. |
orderId | String | alphanumeric order id |
createdDt | Date/time | timestamp, i.e.’2020-10-20T17:30:37.769815’ |
partiallyFilledDt | Date/time | timestamp of the last partial fill |
partialFillQty | Number | partial fill quantity (applicable to partially filled orders) |
extendedInfo | String | additional information about the order (if any) |
- JavaScript
- Python