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.

Required Fields

TradersPost requires a minimum required amount of fields in a webhook in order to function. You are required to send at a minimum the ticker and an action. Here is an example where we send a signal to buy AMD.
1
{
2
"ticker": "AMD",
3
"action": "buy"
4
}
Copied!

Supported Fields

  • ticker - The ticker symbol name. Example AMD (required)
  • action - The signal action. Supported values are buy, sell, exit, cancel or add (required)
  • price - The price of the buy or sell action. If you omit this value, the current market price will be used when the trade is processed (optional)
  • quantity - The quantity to enter. If you omit this value, the quantity will be dynamically calculated or defaulted to 1. (optional)
You can send webhooks to TradersPost in a few different ways.

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.
1
mkdir traderspost
2
cd traderspost
Copied!
Now require the symfony/http-client package using composer.
1
composer require symfony/http-client
Copied!
Now you are ready to create a file named traderspost-test.php and paste the following code inside of the file.
1
<?php
2
// traderspost-test.php
3
4
require 'vendor/autoload.php';
5
6
use Symfony\Component\HttpClient\HttpClient;
7
8
$webhookUrl = 'https://traderspost.io/trading/webhook/9d9f8620-d60d-416e-827e-0ec01ef93532/9b5b8c4264421f5515fd4fcb6571af50';
9
10
$client = HttpClient::create();
11
12
$response = $client->request('POST', $webhookUrl, [
13
'json' => [
14
'ticker' => 'AMD',
15
'action' => 'buy',
16
'price' => 85.50,
17
]
18
]);
19
20
echo $response->getContent();
Copied!
Now you are ready to send the webhook to TradersPost!
1
php traderspost-test.php
2
{"success":true,"id":"cd481b19-9bb7-4845-8227-523203971d47","payload":{"ticker":"AMD","action":"buy","price":85.50}}
Copied!
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.
If you are interested building your own custom automated trading strategies, give TradersPost a try and Register your free account today! If you have any questions, join our Community or email us at [email protected].