githubEdit

Custom Code Examples

The examples in this document intend to demonstrate how you can send signals to TradersPost from custom programming languages like PHP, Python, etc.

Custom Code

In addition to sending webhooks from third parties, you can send webhooks to TradersPost from custom code using programming languages like PHParrow-up-right or Pythonarrow-up-right. Here is an example using PHParrow-up-right and the Symfony HTTP Clientarrow-up-right.

This example uses PHParrow-up-right and the Composerarrow-up-right 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!

This is a simple example, but you can combine this with a service like Polygon.ioarrow-up-right to get live real-time market data and build your own completely custom trading strategies and TradersPost can handle the integrations with your broker.

cURL

PHP

Python

Ruby

JavaScript

Go

C++

C#

Java

Take these examples and combine them with a service like Polygonarrow-up-right or Alpacaarrow-up-right to get live market data to build your own custom strategies and use TradersPost to manage the integration with your broker.

If you are interested building your own custom automated trading strategies, give TradersPost a try and Registerarrow-up-right your free account today! If you have any questions, join our Communityarrow-up-right or email us at [email protected]envelope.

Last updated

Was this helpful?