Webhooks
TradersPost allows third party applications like TradingView and TrendSpider to integrate with your connected brokers via webhooks.

What is a webhook?

Webhooks are automated messages sent from applications when something happens. They have a message that can contain a payload of data and are sent to a unique URL.
In the context of automated trading, the webhook message contains all the information about the trade signal like what ticker to buy and at what price. Here is an example simple webhook.
{
"ticker": "AMD",
"action": "buy"
}
Here is a full reference API documentation for the trading webhoook API end point.
post
https://traderspost.io
/trading/webhook/{uuid}/{password}
TradersPost Webhook Request API documentation.
Be sure you are aware of webhook rate limiting in TradersPost. You can read more here.

Examples

Enter Bullish

{
"ticker": "SQ",
"action": "buy"
}

Exit Bullish

{
"ticker": "SQ",
"action": "exit"
}
You can also use the sentiment field to exit a bullish position without entering a bearish position on the other side. When you send sentiment=flat, it will always exit the full quantity of the open position.
{
"ticker": "SQ",
"action": "sell",
"sentiment": "flat"
}

Enter Bearish

{
"ticker": "SQ",
"action": "sell"
}

Exit Bearish

{
"ticker": "SQ",
"action": "exit"
}
You can also use the sentiment field to exit a bearish position without entering a bullish position on the other side. When you send sentiment=flat, it will always exit the full quantity of the open position.
{
"ticker": "SQ",
"action": "buy",
"sentiment": "flat"
}

Cancel Open Orders

{
"ticker": "SQ",
"action": "cancel"
}

Add to Open Position

{
"ticker": "SQ",
"action": "add"
}

Signal Quantity

The signal quantity will only be used if you check Use signal quantity in the strategy subscription settings in TradersPost.
{
"ticker": "SQ",
"action": "buy",
"quantity": 5
}

Signal Price

The signal price is optional. If you omit a price from the signal, the current market price will be used if you have limit orders configured.
{
"ticker": "SQ",
"action": "buy",
"price": 60.30
}

Third Parties

Because TradersPost works using standard webhooks, this enables users to integrate with third party platforms that support sending alerts as webhooks.
Here are some popular platforms that enable you to build strategies and send alerts as webhooks.
  • TradingView - TradingView is a social network of 30 million traders and investors using the world's best charts and tools to spot trading opportunities across global markets.
  • TrendSpider - TrendSpider provides technical analysis software for retail traders and investors focused on the US equity and foreign exchange markets.

Custom Code

In addition to sending webhooks from third parties, you can send webhooks to TradersPost from custom code using programming languages like PHP or Python. Here is an example using PHP and the Symfony HTTP Client.
This example uses PHP and the Composer package manager. First create a new directory to work inside of.
mkdir traderspost
cd traderspost
Now require the symfony/http-client package using composer.
composer require symfony/http-client
Now you are ready to create a file named traderspost-test.php and paste the following code inside of the file.
<?php
// traderspost-test.php
require 'vendor/autoload.php';
use Symfony\Component\HttpClient\HttpClient;
$webhookUrl = 'https://traderspost.io/trading/webhook/9d9f8620-d60d-416e-827e-0ec01ef93532/9b5b8c4264421f5515fd4fcb6571af50';
$client = HttpClient::create();
$response = $client->request('POST', $webhookUrl, [
'json' => [
'ticker' => 'AMD',
'action' => 'buy',
'price' => 85.50,
]
]);
echo $response->getContent();
Now you are ready to send the webhook to TradersPost!
php traderspost-test.php
{"success":true,"id":"cd481b19-9bb7-4845-8227-523203971d47","payload":{"ticker":"AMD","action":"buy","price":85.50}}
This is a simple example, but you can combine this with a service like Polygon.io to get live real-time market data and build your own completely custom trading strategies and TradersPost can handle the integrations with your broker.
You can read more about custom code examples here.
Copy link
Edit on GitHub
On this page
What is a webhook?
post
TradersPost Webhook Request API documentation.
Examples
Third Parties
Custom Code