Preview Order

POST/accounts/{accountId}/previewOrder

Preview an order before submission. Returns a confirmId and structured confirmation details. Use this to validate the order, check for sufficient buying power, calculate fees and show the validation results to the human. The human can then decline or proceed with order placement, in this case pass confirmId to Place Order to submit.

Path Parameters

accountIdstringrequired

The account identifier.

Body Parameters

instrumentstringrequired

Security symbol. Example: AAPL.

sidestringrequired

Order direction.

typestringrequired

Order type.

quantityTypestringrequired

Whether the order size is specified by quantity or notional amount.

categorystringrequired

Asset class.

durationTypestringrequired

Order time-in-force.

extendHoursstringrequired

Trading session.

qtystringoptional

Order quantity. Required when quantityType is qty.

amountstringoptional

Order notional amount. Required when quantityType is amount.

limitPricestringoptional

Limit price. Required for limit and stopLimit order types.

stopPricestringoptional

Stop trigger price. Required for stop and stopLimit order types.

openClosestringoptional

Position direction.

takeProfitobjectoptional

Take-profit leg.

stopLossobjectoptional

Stop-loss leg.

Request Example

Preview Order
JSON
{
  "instrument": "BAC",
  "side": "buy",
  "type": "limit",
  "quantityType": "qty",
  "qty": "100",
  "limitPrice": "30.0",
  "category": "stock",
  "durationType": "day",
  "extendHours": "reg"
}

Response

200application/json

Preview generated successfully.

sstring

Status indicator. ok on success.

errmsgstring

Error message if the preview could not be generated.

dobject
d.confirmIdstring

Confirmation token to pass back as confirmId when calling Place Order.

d.sectionsobject[]

Informational sections to display to the user before order submission.

d.sections[].headerstring

Section heading.

d.sections[].rowsobject[]
d.sections[].rows[].labelstring
d.sections[].rows[].valuestring
d.sections[].warningsstring[]

Warning messages for the section.

d.sections[].errorsstring[]

Error messages for the section.

Response

errorapplication/json

Error response.

sstring

Error code string, e.g. invalid_grant.

errmsgstring

Human-readable error message.

Response Example

{
  "s": "ok",
  "d": {
    "confirmId": "0000001",
    "sections": [
      {
        "header": "Estimated",
        "rows": [
          {
            "label": "Estimated Cost",
            "value": "$1,000.00"
          }
        ],
        "warnings": [
          "A warning is some message that should be shown to the user, but not necessarily preventing from executing the order."
        ],
        "errors": [
          "The order can not be executed right now because of errors specified here."
        ]
      }
    ]
  }
}