Correct JSON Structure for TradersPost Take Profit Webhooks

Fact checked by
Mike Christensen, CFOA
November 16, 2024
Learn how to configure TradersPost take profit webhooks with proper JSON examples, including percentage-based, absolute price, and combined stop-loss setups.

TradersPost allows seamless automation of trading strategies through webhooks. For features like take profit, following the correct JSON structure is crucial to ensure trades execute as intended. This guide explains the proper webhook JSON format for configuring take profit and how to integrate it into your trading strategy.

Understanding the JSON Structure for Take Profit

A webhook JSON must adhere to TradersPost’s documented standards. The required fields ensure your broker receives precise instructions. Here's how to set up a take profit with webhook JSON:

Example: Basic Take Profit Webhook

{
 "ticker": "BTCUSD",
 "action": "buy",
 "orderType": "market",
 "quantity": 1,
 "takeProfit": {
   "amount": 1000
 }
}

Explanation:

  • "ticker": The symbol for the asset to trade (e.g., Bitcoin/US Dollar pair).
  • "action": The trading action (e.g., "buy", "sell", "exit").
  • "orderType": Defines the type of order ("market", "limit", etc.).
  • "quantity": Number of units to trade.
  • "takeProfit": Contains the profit-taking parameters.
    • "amount": Sets a $1,000 profit target relative to the entry price.

Advanced Configurations

1. Percentage-Based Take Profit

Set a take profit relative to the entry price as a percentage.

{
 "ticker": "AAPL",
 "action": "buy",
 "orderType": "limit",
 "limitPrice": 150,
 "quantity": 10,
 "takeProfit": {
   "percent": 10
 }
}

This configuration will trigger a profit-taking order 10% above the entry price.

2. Absolute Price Take Profit

Use an exact price level for your take profit order.

{
 "ticker": "ETHUSD",
 "action": "buy",
 "orderType": "market",
 "quantity": 2,
 "takeProfit": {
   "limitPrice": 3000
 }
}

Here, the system will set the take profit at $3,000 for Ethereum.

3. Combining Take Profit with Stop Loss

Include both take profit and stop loss in a single webhook for comprehensive risk management.

{
 "ticker": "TSLA",
 "action": "buy",
 "orderType": "market",
 "quantity": 5,
 "takeProfit": {
   "limitPrice": 800
 },
 "stopLoss": {
   "type": "stop",
   "stopPrice": 600
 }
}

Key Additions:

  • "stopLoss": Defines the stop-loss parameters.
    • "type": Specifies the stop-loss type ("stop", "stop_limit", etc.).
    • "stopPrice": Sets the absolute price for triggering the stop loss.

Tips for Successful Webhook Execution

Validate Your JSON

Use a JSON validation tool to confirm the structure is error-free before sending it to TradersPost.

Test in Simulation Mode

Start by testing your webhook configurations in a demo environment to avoid errors in live trading.

Review Broker Capabilities

Ensure your broker supports the specified order types and configurations, such as take profit and stop loss.

Conclusion

Using the correct JSON structure is vital for executing take profit orders in TradersPost. By following the official documentation and using examples like those above, you can automate your trading strategies with precision. Whether you're targeting absolute price levels, percentages, or combining take profit with stop loss, the flexibility of TradersPost ensures your trading goals are achievable.

Ready to automate your trading? Try a free 7-day account:
Try it for free ->