Place Order
Place a new order
Last updated
Place a new order
Last updated
This POST endpoint enables you to place a new order in Autoshares Trader. The order is sent in the JSON format to our service which turns it into a new outstanding order that should eventually be fulfilled.
There are five required parameters that must be provided in the request:
Et-App-Key (header). This is the unique key of your app that identifies your app when communicating with our service. Contact your administrator to get this key.
Authorization (header). This is the authorization token from the very first .
Trading Account ID (path). This is the numeric ID of the trading account on which a new order must be placed.
API version (path). Unless necessary, leave it at "1.0".
body (body of the request). This is a JSON file that contains the order's characteristics.
Here's the final template for this API request:
For orders that will only be verified by the API but not the execution venue (quick):
For orders that will be verified by the API and the execution venue too (slow):
The body of this request represents the information about the to-be-created order. It must be sent in the JSON format with the parameters described in the following table:
Parameter
Description
Symbol
This is the ticker symbol of the underlying security in the new order.
ClientId
This is the order ID on the client's side.
ExpireDate
This is the expiration of the order. If the order isn't executed until the specified date, it'll automatically be cancelled.
Type
This is the type of the order. The range of possible values includes: Market, Limit, Stop, Stop Limit.
Side
This is the side of the trade. The range of possible values includes: Buy, Sell, SellShort, Buy to Cover.
ExecInst
Indicates if the order should be filled either entirely in one transaction or not at all. Possible values: 'DoNotIncrease', 'DoNotReduce', 'AllOrNone'.
TimeInforce
Indicates the time frame in which the order will be active. Possible Values:
Day. The order automatically expires at the end of the regular trading session if it weren't executed.
GTC (Good-till-Canceled). The order persists indefinitely until it is executed or manually cancelled.
AtTheOpening. The order should be filled at the opening of the marketplace or cancelled.
ImmediateOrCancel. The order should be completely or partially filled immediately. If partially filled, the remaining part of the order should be cancelled.
FillOrKill. The order should be filled immediately and entirely or cancelled right away.
GoodTillCrossing. The order will be active until the market enters the auction phase.
GoodTillDate. The order will be active until the date specified in the ExpireDate attribute (unless it is executed or cancelled).
GoodTillTime. The order will be active until a certain time point.
Quantity
The number of shares in the order.
Price
The price at which the shares must be purchased.
StopPrice
When this price is reached, the order will automatically be converted into a market order.
Exchange
This is the exchange on which the order should be executed.
TrailingStopAmountType
This is the type of the trailing stop (Absolute or Persentage).
TrailingStopAmount
This is the trailing amount of the trailing stop (in percentage terms or in the currency units).
TrailingLimitAmountType
This is the type of the trailing limit (Absolute or Persentage).
TrailingLimitAmount
This is the trailing amount (in percentage terms or in the currency units).
ExtendedHours
Indicates if the order should be placed during the extended hours (pre-market session, post-market session).
ExecutionInstructions
Execution instructions for algorithmic trades.
Legs
These are the legs of a multi-leg order.
All legs of a multi-leg order should contain only three parameters:
Ticker symbol
Quantity
Side
All other parameters like the order's type and limit price must be specified outside the legs as the root parameters applicable to all legs.
The type of a multi-leg order must be either market or limit.
One-Triggers-the-Other is a type of conditional order in which execution of one order automatically triggers the other one. Each of the two orders has to be provided as a separate leg:
In this case, if the limit order to purchase the Apple stock gets executed, the second limit order to purchase the Tesla stock will automatically be triggered.
In One-Triggers-the-Other orders, the first leg cannot be a market order.
One-Cancels-the-Other is a type of conditional order in which execution of one order automatically cancels the other one. Each of the two orders has to be provided as a separate leg:
In this case, if the limit order to purchase the Apple stock gets executed, the second limit order to purchase the Tesla stock will automatically be cancelled.
In One-Cancels-the-Other orders, both legs cannot be market orders.
In response to this request, you'll receive a JSON file with comprehensive information about the newly created order:
Please note that you may receive the 200 status code even if the order was improperly configured. For example, if you attempt to create a limit order and specify the stop price instead of the limit price, the order will be registered in the system but will eventually be rejected. Please monitor the order's status (it's PendingNew by default) to determine if the order has been rejected or placed.
Here are some of the common mistakes that developers make when attempting to place a new order.
If you specify the wrong Et-App-Key parameter or fail to include it in the header altogether, you'll get the following error:
Another common mistake when making this request is specifying the user ID instead of the user's trading account ID. Doing so will result in the 500 status code and the following error message:
It's critical to understand that when you use the authorization token of a particular user in this request's header, only this user's trading accounts can be used for placing new orders. Placing a new order on a trading account of a different user will lead to the 401 error.
In the following article we provide in-depth coverage of the syntax for this API request.
When attempting to place an order whose value exceeds the trading account's buying power, you'll receive a JSON file with the ErrorDescription
parameter equaling DayTradingBuyingPowerExceeded
.
An attempt to place a limit order without specifying its price will result in an error; in response you'll receive a JSON file with the ErrorDescription
parameter equaling QuotePriceIsInvalid
.
An attempt to place a stop-loss order without specifying its price will result in an error; in response you'll receive a JSON file with the ErrorDescription
parameter equaling QuotePriceIsInvalid
.
The following article covers the syntax for this API request in detail.
Feel free to examine our article that demonstrates how to place a new order with the help of a Python script.