Connection with Alert2Trade Using Webhook

This document explains the process of linking TrendSpider Alerts to Alert2Trade, using webhooks. This integration facilitates the transmission of alert notifications from TrendSpider to Alert2Trade, enabling the seamless execution of automated trading strategies.

For the demonstration purpose, we have used Coinbase as this is the exchange where we would like the orders to be executed automatically via Alert2Trade whenever the TrendSpider will trigger an alert.

Let's get started 🚀

Generate API Key on Coinbase

The process starts with generating API keys and Secret Key from Coinbase and using them to establish a secure connection with Alert2Trade.

Step 1: Sign in to your Coinbase account, click on the “profile” icon from the top right corner, and select “API” from the dropdown menu.

image11.png

Step 2: Navigate to “API settings” and click on the “New API Key” button.

image14.png

Step 3: Fill out all the required details, including permissions, and hit the “Create API key” button. At this step, the API key will be generated.

image3.png

Step 4: Copy your API secret key and click on Done.

image6.png

Step 5: Once the key is generated, you can navigate to “My API Keys” and view the API key, a secret key, and a passphrase (if you have added one).

Note: It's crucial to note down these details and keep them in a secure location.

image1.png

Edit Alert2Trade PHP Script

Step 1: Sign in to your Alert2Trade account and choose the "Coinbase Spot Trading Script" from the options. (This script contains a range of settings and parameters that define how the script engages with external services and functions).

Afterwards, access the "settings.php" file within the script.

image2.png

Step 2: Insert your Coinbase Pro API credentials and define a secure API Pin in the settings.php file.

1. Replace 'spot_api_key' with your Coinbase Pro API key.
2. Replace 'spot_api_secret' with your Coinbase Pro API secret.
3. Replace  'spot_api_passphrase' with your Coinbase Pro API passphrase.
4. Replace ‘api_acess_pin’ and set a secure API Pin for added security.

image9.png

Upload the Script File into Alert2Trade PHP Script

Step 1: After making the necessary edits to the "settings.php" file, upload the Alert2Trade PHP script to your web hosting server.

You can accomplish this through either FTP (File Transfer Protocol) or your web host file manager.

Method I: Web host via File Manager

image5.png

Method II: Web host via FTP

image7.png

Step 2: After uploading the Alert2Trade PHP script into your web hosting server, your webhook URL will be ready to be added to your TrendSpider notification input.

Your Alert2Trade webhook URL will look something like this:

http://alert2trade/example/api.php?pin=1337

Setting Up TrendSpider Webhook Configuration

Step 1: Log in to your TrendSpider account, Click on the “User Icon” from the upper-right corner of the interface, and select Account & Settings from the dropdown list.

No_name_-_18_December_2023_V1.gif

Step 2: Now copy the webhook URL from the web host where the Alert2Trade script is saved and paste it into the URL field under “Webhook for Alerts” and then click on the “Save” button.

image12.png

Create Webhook Alert in TrendSpider

For demonstration purposes, we have created an alert on the trend line.

Step 1: Create a trend line, right-click on the same, and select “Create an alert at this line” from the dropdown.

No_name_-_18_December_2023_V2.gif

Step 2: Select the type of alert trigger you want to create. Trendspiders offer three types of triggers: Break Through, Touch, and Bounce.

  • Break Through: Trigger when price opens & closes, or closes & open on different sides of the buffer area.
  • Touch: Trigger when price touches or trades through the buffer area, but does not break through it.
  • Bounce: Trigger when price touches the buffer area, but does not break through on the next candle.

For demonstration purposes, we have currently selected the Breakthrough trigger.

image10.png

Step 3: Add webhook payload in the “Your note” section and click on the “Create Alert” button.

Here's an example of a payload used for a webhook alert:

{
market(side=buy, amount=20%);
wait(5);
limit(side=sell, amount=50%, offset=10%);
balance();
}

This payload represents a trading algorithm that intends to buy 20% of a specific asset, wait for 5 units of time, and then place a sell order for 50% of the acquired amount with a price offset of 10%, followed by checking the account balance.

image4.png

After clicking the "Create Alert," your webhook alert will be successfully created and activated, ready to respond.

Activate Automation

Whenever the alert will be triggered by TrendSpider, the webhook payload shall be sent to Alert2Trade. Then Alert2Trade will fetch this payload message and convert it into an actionable trade right into your connected exchange like Coinbase.

Dec 18, 2023

Contact Us

Not finding what you're looking for? Contact Us Directly