Orders


GET orders/:id

Description

Get the order status details for the specified order.

Resource URL

https://api.optionscity.com/orders/:id
Authentication Required
HTTP Methods GET
Media Types application/json
Response Object Order
Response Type Standard

Parameters

NameDescriptionRequired?Type
id The unique City API identifier for the order. Yes Number
embed_instrument Whether instrument, product and product group details should be embedded. No Boolean

Example Request

GET https://api.optionscity.com/orders/1

Example Response

{
  "id" : 1,
  "acct_id" : 1,
  "user_id" : 1,
  "instrument_id" : 1,
  "time_in_force" : "Day",
  "order_type" : "Limit",
  "side" : "Buy",
  "quantity" : 5,
  "remaining_quantity" : 5,
  "submitted_at" : "2018-05-23T21:51:11.024Z",
  "last_updated_at" : "2018-05-23T21:51:11.024Z",
  "limit_price" : 23.45,
  "last_msg_status" : "NewAck",
  "status" : "Open"
}

GET orders

Description

Get a batch of orders accessible to the user (sorted reverse chronologically by submission).

Resource URL

https://api.optionscity.com/orders
Authentication Required
HTTP Methods GET
Media Types application/json
Response Object Order
Response Type Standard

Parameters

NameDescriptionRequired?Type
status Filter to orders matching the specified status only. No String
page 1-indexed page to retrieve. Default is 1. No Number
per_page Number of entries returned per page. Default is 100. Limit is 200. No Number
min_update_time Filter orders to only include those updated after the specified time. No DateTime*
max_update_time Will only return orders updated before this time. No DateTime*
acct_id Return orders for this account only. Default is all accounts accessible by user making request. No Number
embed_instrument Whether instrument, product and product group details should be embedded in each order definition. No Boolean

Example Request

GET https://api.optionscity.com/orders

Example Response

[ {
  "id" : 1,
  "acct_id" : 1,
  "user_id" : 1,
  "instrument_id" : 1,
  "time_in_force" : "Day",
  "order_type" : "Limit",
  "side" : "Buy",
  "quantity" : 5,
  "remaining_quantity" : 5,
  "submitted_at" : "2018-05-23T21:51:11.024Z",
  "last_updated_at" : "2018-05-23T21:51:11.024Z",
  "limit_price" : 23.45,
  "last_msg_status" : "NewAck",
  "status" : "Open"
} ]

Order Object

Description

Represents the current state of an order submitted to the exchange.

Fields

Field Type Optional Description
id Number No City API assigned identifier.
instrument_id Number No Identifies the order instrument.
acct_id Number No Identifies the account to which the order belongs.
time_in_force String No Specifies how long an unfilled order will remain open. One of 'Day', 'Gtc', 'Fok', 'Ioc', or 'Gtd'.
order_type String No One of 'Limit', 'Market', 'Stop', 'StopLimit', 'MarketLimit'.
side String No 'Buy' or 'Sell'.
quantity Number No The order quantity.
min_quantity Number Yes The minimum quantity that can be filled, if applicable.
max_show Number Yes The maximum quantity shown at the exchange, if applicable.
limit_price Number Yes The limit price in a limit or stop-limit order. Only shown if applicable.
stop_price Number Yes The stop price in a stop or stop-limit order. Only shown if applicable.
last_msg_status String No

The last message status received from the exchange. One of 'NewAck', 'PartialFill', 'CompleteFill', 'CancelAck', 'ModifyAck', 'Rejected', 'Expired', 'TradeCancelled', 'OrderNotFound' or 'Undefined'.

Note that these correspond to a subset of the valid FIX field values for tag 39. This can be somewhat confusing in some cases. For example, when a request to modify an order is submitted with an invalid price, the exchange may return a status of 'Undefined'. Something like 'ModifyRejected' may be more clear, but is not part of the FIX protocol. To see details on an order action or an update on an order's status from the exchange, see the events API.

status String Yes The current order status. One of 'Open', 'Rejected', 'Cancelled', 'Expired', 'Filled' or 'Pending'.
last_filled_price Number Yes The trade price of the most recent fill.
last_filled_quantity Number Yes The trade quantity of the most recent fill.
total_filled_quantity Number No The total quantity filled.
remaining_quantity Number No The open quantity remaining at the exchange.
rejection_reason String Yes The reason for rejecting the most recent order action, if applicable. (Provided by the exchange.)
submitted_at DateTime* No Time order was submitted.
last_updated_at DateTime* No Time last order update was received from the exchange.
good_til_date DateTime* Yes Date on which the order will expire if time_in_force is set to Gtd. Format should be YYYY-MM-dd
position_effect String Yes Whether this order will be opening or cosing a position, must be one of "O" or "C"

JSON Sample

{
  "id" : 1,
  "acct_id" : 1,
  "user_id" : 1,
  "instrument_id" : 1,
  "time_in_force" : "Day",
  "order_type" : "Limit",
  "side" : "Buy",
  "quantity" : 5,
  "remaining_quantity" : 5,
  "submitted_at" : "2018-05-23T21:51:11.024Z",
  "last_updated_at" : "2018-05-23T21:51:11.024Z",
  "limit_price" : 23.45,
  "last_msg_status" : "NewAck",
  "status" : "Open"
}

* Date and time elements are ISO-8601 string representations