Skip to main content

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

AttributeTypeRequirementDescription
account_idstringrequiredAccount id for the order, accounts can be loaded from /v2/trading/accounts in the Account API

Body Parameters

AttributeTypeRequirementDescription
clientOrderIDstringrequiredA unique identifier for the order. Cannot be resused intra-day.
pricedecimalconditionalLimit price for limit orders, not required for market orders.
quantityintegerrequiredOrder quantity.
routestringoptionalExecution route for the order. Available routes can be obtained from /v2/trading/accounts in the Trading API.
sidestringrequiredBUY or SELL
symbolstringrequiredSymbol that identifies the security to trade. Can be verified at /api/security/
timeInForcestringoptionalOptions Time In Force property that specifies certain order characteristics.
typestringrequiredMARKET 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

Example