Read Backtest
Orders
Request
Fetch the orders of a backtest for the project Id, backtest Id and steps provided. The /backtests/orders/read
API accepts requests in the following format:
ReadBacktestOrdersRequest Model - Request to read orders from a backtest. | |
---|---|
start | integer Starting index of the orders to be fetched. Required if end > 100. |
end | integer Last index of the orders to be fetched. Note that end - start must be less than 100. |
projectId | integer Id of the project from which to read the backtest. |
backtestId | string Id of the backtest from which to read the orders. |
Example |
{ "start": 0, "end": 0, "projectId": 0, "backtestId": "string" } |
Responses
The /backtests/orders/read
API provides a response in the following format:
200 Success
BacktestOrdersResponse Model - Contains orders and the number of orders of the backtest in the request criteria. | |
---|---|
orders | Order object /. |
length | integer Total number of returned orders. |
Example |
{ "orders": { "id": 0, "contingentId": 0, "brokerId": [ "string" ], "symbol": { "value": "string", "id": "string", "permtick": "string" }, "limitPrice": , "stopPrice": 0, "stopTriggered": , "price": 0, "priceCurrency": "string", "time": "2021-11-26T15:18:27.693Z", "createdTime": "2021-11-26T15:18:27.693Z", "lastFillTime": "2021-11-26T15:18:27.693Z", "lastUpdateTime": "2021-11-26T15:18:27.693Z", "canceledTime": "2021-11-26T15:18:27.693Z", "quantity": 0, "type": 0 = Market, "status": 0 = New, "tag": "string", "securityType": 0 = Base, "direction": 0 = Buy, "value": 0, "orderSubmissionData": { "bidPrice": 0, "askPrice": 0, "lastPrice": 0 }, "isMarketable": true, "properties": { "timeInForce": 0 = GoodTilCanceled }, "events": [ { "algorithmId": "string", "symbol": "string", "symbolValue": "string", "symbolPermtick": "string", "orderId": 0, "orderEventId": 0, "id": 0, "status": "new", "orderFeeAmount": 0, "orderFeeCurrency": "string", "fillPrice": 0, "fillPriceCurrency": "string", "fillQuantity": 0, "direction": "string", "message": "string", "isAssignment": true, "stopPrice": 0, "limitPrice": 0, "quantity": 0, "time": 0, "isInTheMoney": } ], "trailingAmount": 0, "trailingPercentage": , "groupOrderManager": { "id": 0, "quantity": 0, "count": 0, "limitPrice": 0, "orderIds": [ "integer" ], "direction": 0 }, "triggerPrice": 0, "triggerTouched": }, "length": 0 } |
Order Model - Order struct for placing new trade. | |
---|---|
id | integer Order ID. |
contingentId | integer Order Id to process before processing this order. |
brokerId | string Array Brokerage Id for this order for when the brokerage splits orders into multiple pieces. |
symbol | Symbol object Represents a unique security identifier. This is made of two components, the unique SID and the Value. The value is the current ticker symbol while the SID is constant over the life of a security. |
limitPrice | nummber Limit price of the Order. |
stopPrice | number Stop price of the Order. |
stopTriggered | bool Indicates if the stop price has been reached, so the limit order has been triggered. |
price | number Price of the Order. |
priceCurrency | string Currency for the order price. |
time | string($date-time) Gets the utc time the order was created. |
createdTime | string($date-time) Gets the utc time this order was created. Alias for Time. |
lastFillTime | string($date-time) Gets the utc time the last fill was received, or null if no fills have been received. |
lastUpdateTime | string($date-time) Gets the utc time this order was last updated, or null if the order has not been updated. |
canceledTime | string($date-time) Gets the utc time this order was canceled, or null if the order was not canceled. |
quantity | number Number of shares to execute. |
type | integer Enum Order type. Options : ['0 = Market', '1 = Limit', '2 = StopMarket', '3 = StopLimit', '4 = MarketOnOpen', '5 = MarketOnClose', '6 = OptionExercise', '7 = LimitIfTouched', '8 = ComboMarket', '9 = ComboLimit', '10 = ComboLegLimit', '11 = TrailingStop'] |
status | integer Enum Status of the Order. Options : ['0 = New', '1 = Submitted', '2 = PartiallyFilled', '3 = Filled', '5 = Canceled', '6 = None', '7 = Invalid', '8 = CancelPending', '9 = UpdateSubmitted'] |
tag | string Tag the order with some custom data. |
securityType | integer Enum Type of tradable security / underlying asset. Options : ['0 = Base', '1 = Equity', '2 = Option', '3 = Commodity', '4 = Forex', '5 = Future', '6 = Cfd', '7 = Crypto'] |
direction | integer Enum Order Direction Property based off Quantity. Options : ['0 = Buy', '1 = Sell', '2 = Hold'] |
value | number Gets the executed value of this order. If the order has not yet filled, then this will return zero. |
orderSubmissionData | OrderSubmissionData object Stores time and price information available at the time an order was submitted. |
isMarketable | boolean Returns true if the order is a marketable order. |
properties | OrderProperties object Additional properties of the order. |
events | OrderEvent Array The order events. |
trailingAmount | number Trailing amount for a trailing stop order. |
trailingPercentage | bool Determines whether the trailingAmount is a percentage or an absolute currency value. |
groupOrderManager | GroupOrderManager object Manager of a group of orders. |
triggerPrice | number The price which, when touched, will trigger the setting of a limit order at limitPrice. |
triggerTouched | bool Whether or not the triggerPrice has been touched. |
Example |
{ "id": 0, "contingentId": 0, "brokerId": [ "string" ], "symbol": { "value": "string", "id": "string", "permtick": "string" }, "limitPrice": , "stopPrice": 0, "stopTriggered": , "price": 0, "priceCurrency": "string", "time": "2021-11-26T15:18:27.693Z", "createdTime": "2021-11-26T15:18:27.693Z", "lastFillTime": "2021-11-26T15:18:27.693Z", "lastUpdateTime": "2021-11-26T15:18:27.693Z", "canceledTime": "2021-11-26T15:18:27.693Z", "quantity": 0, "type": 0 = Market, "status": 0 = New, "tag": "string", "securityType": 0 = Base, "direction": 0 = Buy, "value": 0, "orderSubmissionData": { "bidPrice": 0, "askPrice": 0, "lastPrice": 0 }, "isMarketable": true, "properties": { "timeInForce": 0 = GoodTilCanceled }, "events": [ { "algorithmId": "string", "symbol": "string", "symbolValue": "string", "symbolPermtick": "string", "orderId": 0, "orderEventId": 0, "id": 0, "status": "new", "orderFeeAmount": 0, "orderFeeCurrency": "string", "fillPrice": 0, "fillPriceCurrency": "string", "fillQuantity": 0, "direction": "string", "message": "string", "isAssignment": true, "stopPrice": 0, "limitPrice": 0, "quantity": 0, "time": 0, "isInTheMoney": } ], "trailingAmount": 0, "trailingPercentage": , "groupOrderManager": { "id": 0, "quantity": 0, "count": 0, "limitPrice": 0, "orderIds": [ "integer" ], "direction": 0 }, "triggerPrice": 0, "triggerTouched": } |
Symbol Model - Represents a unique security identifier. This is made of two components, the unique SID and the Value. The value is the current ticker symbol while the SID is constant over the life of a security. | |
---|---|
value | string The current symbol for this ticker. |
id | string The security identifier for this symbol. |
permtick | string The current symbol for this ticker. |
Example |
{ "value": "string", "id": "string", "permtick": "string" } |
OrderSubmissionData Model - Stores time and price information available at the time an order was submitted. | |
---|---|
bidPrice | number The bid price at an order submission time. |
askPrice | number The ask price at an order submission time. |
lastPrice | number The current price at an order submission time. |
Example |
{ "bidPrice": 0, "askPrice": 0, "lastPrice": 0 } |
OrderProperties Model - Additional properties of the order. | |
---|---|
timeInForce | object Enum Defines the length of time over which an order will continue working before it is cancelled. Options : ['0 = GoodTilCanceled', '1 = Day', '2 = GoodTilDate'] |
Example |
{ "timeInForce": 0 = GoodTilCanceled } |
OrderEvent Model - Change in an order state applied to user algorithm portfolio | |
---|---|
algorithmId | string Algorithm Id, BacktestId or DeployId. |
symbol | string Easy access to the order symbol associated with this event. |
symbolValue | string The current symbol for this ticker; It is a user friendly symbol representation. |
symbolPermtick | string The original symbol used to generate this symbol. |
orderId | integer Id of the order this event comes from. |
orderEventId | integer The unique order event id for each order. |
id | integer The unique order event Id for each order. |
status | string Enum Status of the Order. Options : ['new', 'submitted', 'partiallyFilled', 'filled', 'canceled', 'none', 'invalid', 'cancelPending', 'updateSubmitted'] |
orderFeeAmount | number The fee amount associated with the order. |
orderFeeCurrency | string The fee currency associated with the order. |
fillPrice | number Fill price information about the order. |
fillPriceCurrency | string Currency for the fill price. |
fillQuantity | number Number of shares of the order that was filled in this event. |
direction | string Order direction. |
message | string Any message from the exchange. |
isAssignment | boolean True if the order event is an assignment. |
stopPrice | number The current stop price. |
limitPrice | number The current limit price. |
quantity | number The current order quantity. |
time | integer The time of this event in unix timestamp. |
isInTheMoney | bool True if the order event's option is In-The-Money (ITM). |
Example |
{ "algorithmId": "string", "symbol": "string", "symbolValue": "string", "symbolPermtick": "string", "orderId": 0, "orderEventId": 0, "id": 0, "status": "new", "orderFeeAmount": 0, "orderFeeCurrency": "string", "fillPrice": 0, "fillPriceCurrency": "string", "fillQuantity": 0, "direction": "string", "message": "string", "isAssignment": true, "stopPrice": 0, "limitPrice": 0, "quantity": 0, "time": 0, "isInTheMoney": } |
GroupOrderManager Model - Manager of a group of orders. | |
---|---|
id | integer The unique order group Id. |
quantity | number The group order quantity. |
count | integer The total order count associated with this order group. |
limitPrice | number The limit price associated with this order group if any. |
orderIds | integer Array The order Ids in this group. |
direction | integer Order Direction Property based off Quantity. |
Example |
{ "id": 0, "quantity": 0, "count": 0, "limitPrice": 0, "orderIds": [ "integer" ], "direction": 0 } |
401 Authentication Error
UnauthorizedError Model - Unauthorized response from the API. Key is missing, invalid, or timestamp is too old for hash. | |
---|---|
www_authenticate | string Header |