Send a new order
POST v2/trading/{account_id}/orders
Sends a new order for the Lime trading server for the specified account.
Parameters
Path Parameters
Attribute | Type | Requirement | Description |
---|---|---|---|
account_id | string | required | Account id for the order, accounts can be loaded from /v2/trading/accounts in the Account API |
Body Parameters
Attribute | Type | Requirement | Description |
---|---|---|---|
clientOrderID | string | required | A unique identifier for the order. Cannot be resused intra-day. |
price | decimal | conditional | Limit price for limit orders, not required for market orders. |
quantity | integer | required | Order quantity. |
route | string | optional | Execution route for the order. Available routes can be obtained from /v2/trading/accounts in the Trading API. |
side | string | required | BUY or SELL |
symbol | string | required | Symbol that identifies the security to trade. Can be verified at /api/security/ |
timeInForce | string | optional | Options Time In Force property that specifies certain order characteristics. |
type | string | required | MARKET or LIMIT |
Response
HTTP 200 OK
- Indicates the message was successfully received, check the eventType
value in the JSON payload returned:
OnOrderAckEvent
- the order was accepted by the execution venue
OnValidationError
- the order failed validation (missing field, etc.)
OnOrderRejectEvent
- the order was rejected by the Lime trading server or venue
Accepted Order response
{
"clientOrderID": "<clientOrderId>",
"eventType": "OnOrderAckEvent",
"reason": "OnOrderAckEvent(eventId=<integer>, clientOrderId=<string>, limeOrderId=<long>)"
}
Rejected Order responses
Rejected by validation
{
"clientOrderID": "<clientOrderId>",
"eventType": "OnValidationError",
"reason": "Validation errors",
"validationErrors": [
{
"message": "MISSING PRICE ON LIMIT ORDER",
"invalidValue": "null"
}
]
}
Rejected by the trading server
{
"clientOrderID": "<clientOrderId>",
"eventType": "OnOrderRejectEvent",
"reason": "eventId=<integer>, clientOrderId=<string>, limeOrderId=<long>"
}
HTTP Errors
HTTP 401 Unauthorized
- unable to accept order because user is unauthorized, check token is not expired, make sure user is authorized for the specifed account