Orders

The Orders API allows a user to monitor, place and cancel their orders with Alpaca.

Each order has a unique identifier provided by the client. This client-side unique order ID will be automatically generated by the system if not provided by the client, and will be returned as part of the order object along with the rest of the fields described below. Once an order is placed, it can be queried using the client-side order ID to check the status. Updates on open orders at Alpaca will also be sent over the streaming interface, which is the recommended method of maintaining order state.

For further details on order functionality, please see the Trading On Alpaca - Orders page.

Please note that body parameters should be passed using a JSON encoded body.

Sample Order Object

{
  "id": "61e69015-8549-4bfd-b9c3-01e75843f47d",
  "client_order_id": "eb9e2aaa-f71a-4f51-b5b4-52a6c565dad4",
  "created_at": "2021-03-16T18:38:01.942282Z",
  "updated_at": "2021-03-16T18:38:01.942282Z",
  "submitted_at": "2021-03-16T18:38:01.937734Z",
  "filled_at": null,
  "expired_at": null,
  "canceled_at": null,
  "failed_at": null,
  "replaced_at": null,
  "replaced_by": null,
  "replaces": null,
  "asset_id": "b0b6dd9d-8b9b-48a9-ba46-b9d54906e415",
  "symbol": "AAPL",
  "asset_class": "us_equity",
  "notional": "500",
  "qty": null,
  "filled_qty": "0",
  "filled_avg_price": null,
  "order_class": "",
  "order_type": "market",
  "type": "market",
  "side": "buy",
  "time_in_force": "day",
  "limit_price": null,
  "stop_price": null,
  "status": "accepted",
  "extended_hours": false,
  "legs": null,
  "trail_percent": null,
  "trail_price": null,
  "hwm": null
}

Properties

AttributeTypeDescription
idstringThe order_id
client_order_idstringEach order has a unique identifier provided by you, otherwise automatically generated by the system if not provided. client_order_id will be returned as part of the order object along with the rest of the fields described below.
created_atstring (Nullable)Timestamp when the order was created
updated_atstring (Nullable)Timestamp when the order was updated, if updated
submitted_atstring (Nullable)Timestamp when the order was submitted
filled_atstring (Nullable)Timestamp when the order was filled
expired_atstring (Nullable)Timestamp when the order was expired, if expired
canceled_atstring (Nullable)Timestamp when the order was canceled, if canceled
failed_atstring (Nullable)Timestamp when the order failed, if failed
replaced_atstring (Nullable)Timestamp when the order was replaced, if replaced
replaced_bystring (Nullable)The order_id that this order was replaced by
replacesstring (Nullable)The order_id that this order replaces
asset_idstringThe asset_id for the asset traded
symbolstringThe symbol for the asset traded
asset_classstringThe asset_class for the asset traded. Can either be us_equity or crypto
notionalstringOrdered notional amount. If entered, qty will be null. Can take up to 9 decimal points
qtystringOrdered quantity. If entered, notional will be null. Can take up to 9 decimal points
filled_qtystringFilled quantity. Filled orders will always have a filled_quantity populated
filled_avg_pricestring (Nullable)The average price per share at which the order was filled
order_classstringValid values are simple, bracket, oco or oto. For details of non-simple order classes, please see Bracket Order Overview
order_typestringDEPRECATED and replaced by type below
typestringValid values are market, limit, stop, stop_limit, trailing_stop
sidestringValid values are either buy or sell
time_in_forcestringValid values are day, gtc, ...
limit_pricestring (Nullable)Limit price
stop_pricestring (Nullable)Stop price
statusstringOrder status
extended_hoursbooleanIf true, eligible for execution outside regular trading hours.
legsarrayWhen querying non-simple order_class orders in a nested style, an array of Order entities associated with this order. Otherwise, null.
trail_percentstringThe percent value away from the high water mark for trailing stop orders.
trail_pricestringThe dollar value away from the high water mark for trailing stop orders.
hwmstringThe highest (lowest) market price seen since the trailing stop order was submitted.