Sending Alerts To Alertatron

Introduction

Alertatron is a service allowing you to automatically execute orders based on any signal. By hooking up signals from Drakdoo to Alertatron you can create your own trading bot.

Prerequisites

In order to set this up you will need the following:

How It Works

When you setup an alert over at Drakdoo, the Drakdoo servers will continuously monitor the markets to check whether or not the conditions specified by the alert are met. If a match is found, Drakdoo can trigger push notifications to your webbrowser or phone, send email or message you via Telegram. Next to these notification mechanisms that are typically intended for human processing, Drakdoo also supports so called Webhook notifications intended for machine to machine processing.

In order for the Drakdoo servers to be able to reach out to the Alertatron servers, the Drakdoo servers need to be pointed to a web address (URL) that is handled by the Alertatron servers. You can retrieve the unique URL that is reserved for you in your Alertatron account settings.

Obtaining your unique Alertatron Webhook URL
Obtaining your unique Alertatron Webhook URL

When the Drakdoo servers communicate with the Alertatron servers via this Webhook URL a message is exchanged. Of course, this message must contain information that is understandable by the Alertatron servers. The way Alertatron works is that the message itself represents an Alertatron script containing instructions on the actions to take. Therefore, over at Drakdoo, next to configuring the Webhook URL you will also need to configure the Webhook message so that it contains the Alertatron script that is to be executed when the alert fires.

Preparing The Alertatron Script

The following is an example of an Alertatron script that buys 1 BTC at the current USD price:

myApiKeys(BTCUSD) {
market(side=buy, amount=1);
}
#bot

Over at Drakdoo, you can setup one alert that monitors all pairs of an exchange. When an alert fires, you typically want to act on the market pair for which the alert fired, not solely on the BTCUSD pair. So, the fact that the Alertatron script has BTCUSD hardcoded is something we need to address.

You can add placeholders to the Webhook message that will be filled in at the time the alert fires. This way, you can postpone fixating the market pair on which to operate, and make this dynamic. Particularly, if you place the placeholder {{item}} in the message, that will get replaced with eth in case the base currency of the market pair firing is Ethereum. Similarly, {{currency}} will become eur in case the quote currency is the Euro. Please refer to the Webhook message payload documentation for the full list of supported placeholders.

We can insert placeholders in the Alertatron script to remove the hardcodedness of BTCUSD as follows:

myApiKeys({{ITEM}}{{CURRENCY}}) {
market(side=buy, amount=1);
}
#bot

You can now configure the Alertatron webhook URL and the Alertatron script into Drakdoo as follows:

Drakdoo Webhook configuration
Drakdoo Webhook configuration

The above is all that is needed to setup an alert that, when triggered, will execute buy orders on the market pair for which the alert fires.