APIs & Payloads
APIs
The following API endpoints allow users to interact with the trading bot to place orders, liquidate positions, and set market trends. Each endpoint is designed to facilitate seamless execution of trading actions, ensuring speed, accuracy, and validation checks where necessary.
The trend-related endpoints allow for setting market trends in DynamoDB, ensuring trades align with predefined strategies. The order placement endpoints allow traders to execute trades efficiently, including a version with trend validation.
Below is a table summarizing the key API endpoints and their functionality:
Endpoint
Method
Usage
/ts/place-order
POST
Places an order to Tradovate without trend validation.
/ts/liquidate-position
POST
Liquidates all open positions in Tradovate for a particular instrument
/ts/set-trend
POST
Sets the market trend (BULL
or BEAR
) along with an optional trend duration in AWS DynamoDB, This can be used in combination with the place-order-trend endpoint
/ts/place-order-trend
POST
Places an order with trend validation to ensure alignment with the defined market trend.
Each of these endpoints is designed to streamline trading actions, allowing for automation while maintaining control over execution logic. Let me know if you need additional details or modifications!
Payloads
Place Order (/ts/place-order
)
/ts/place-order
)Payload Example:
Field Descriptions:
Field
Description
Possible Values
Required
accountSpecs
List of account identifiers for placing the order.
Example: ["PRACTICEFEB310430043"]
Multiple accounts can also be provided
as shown below
["YOURAccount1","YOURAccount2","YOURAccount3"]
✅ Yes
action
The type of order action to perform.
"Buy"
, "Sell"
✅ Yes
orderType
The type of order being placed.
"Market"
, "Limit"
, "Protect"
, "Bracket"
✅ Yes
symbol
The ticker symbol of the asset being traded.
Example: "MNQ1!"
, "ES!"
If setting alerts from Trading view, then this should be "{{ticker}}"
✅ Yes
orderQty
The quantity of contracts/shares to trade.
Any positive integer
✅ Yes
limitPrice
The price at which the limit order should be placed.
Numeric value (Required for limit orders)
❌ No (Only for Limit Orders)
stopPrice
The price at which the stop order should be triggered.
Eg: 10
❌ No
takeProfit
The price at which the trade should take profit.
Eg: 10
❌ No
trailingOffset
The distance from the price for a trailing stop.
Eg: 5.0
❌ No
tradeTimeRanges
Specifies time ranges where trading is allowed.
Example: ["09:30-16:00"]
avoidTradeTimeRanges
Specifies time ranges where trading is not allowed.
Example: ["12:00-13:00"]
Liquidate Open Positions (/ts/liquidate-position
)
/ts/liquidate-position
)Payload Example:
Field Descriptions:
Field
Description
Possible Values
Required
symbol
The ticker symbol of the asset to liquidate.
Example: "MNQZ4"
, "ES!"
✅ Yes
accountSpecs
List of account identifiers for liquidation.
Example: ["PRACTICEDEC20XXXX"]
Multiple accounts can also be provided
as shown below
["YOURAccount1","YOURAccount2","YOURAccount3"
✅ Yes
Set Market Trend (/ts/set-trend
)
/ts/set-trend
)Payload Example:
Field Descriptions:
Field
Description
Possible Values
Required
trend
Defines the market trend direction.
"BULL"
, "BEAR"
✅ Yes
trend_duration
The duration for which the trend should be valid.
Example: "24Brick"
, "30Min"
❌ No
trend_ticker
The ticker symbol associated with the trend.
Example: "NQ1!"
, "ES!"
✅ Yes
. Place Order with Trend Validation (/ts/place-order-trend
)
/ts/place-order-trend
)Payload Example:
Field Descriptions:
Field
Description
Possible Values
Required
List of account identifiers for placing the order.
Example: ["PRACTICEFEB310430043"]
Multiple accounts can also be provided
as shown below
["YOURAccount1","YOURAccount2","YOURAccount3"]
✅ Yes
action
The type of order action to perform.
"Buy"
, "Sell"
✅ Yes
orderType
The type of order being placed.
"Market"
, "Limit"
, "Stop"
, "Bracket"
✅ Yes
symbol
The ticker symbol of the asset being traded.
Example: "NQ1!"
, "ES!"
✅ Yes
orderQty
The quantity of contracts/shares to trade.
Any positive integer
✅ Yes
limitPrice
The price at which the limit order should be placed.
Numeric value (Required for limit orders)
❌ No (Only for Limit Orders)
stopPrice
The price at which the stop order should be triggered.
Numeric value
❌ No
trailingOffset
The distance from the price for a trailing stop.
Numeric value
❌ No
closeOnTrendReversal
Whether to close the trade if the trend reverses.
"True"
, "False"
❌ No
tradeTimeRanges
Specifies time ranges where trading is allowed.
Example: ["09:30-16:00"]
❌ No
avoidTradeTimeRanges
Specifies time ranges where trading is not allowed.
Example: ["12:00-13:00"]
❌ No
Last updated