Gainium Logo

This article will guide you through using webhooks to operate Gainium bots, including a special focus on concatenating webhook actions on the same alert by sending an array in the webhook payload.

What are Webhooks?

Webhooks are automated messages sent from apps when something happens. They have a message—or payload—and are sent to a unique URL. They're a simple way your online accounts can communicate and get automated messages when something new happens.

Setting Up Webhooks in Gainium

Step 1: Understanding Gainium Bots

Before diving into webhooks, it's essential to understand the various bots Gainium offers, such as grid, DCA, and combo bots. Each bot has unique triggers and actions that can be automated.

Step 2: Create a new bot

To start, create a new bot. There are several places where the bot can accept webhooks, those include:

  • Deal Start
  • Add funds
  • Take Profit
  • Stop Loss
  • Start bot

webhooks.png

Depending on where do you enable webhooks, you will have access to certain actions to be automated through them. Once you are happy with the bot configuration, click on “Add new bot,” and a new info box will appear with the webhook information.

webhook config.png

Step 3: Configuring Your Webhook alert (TradingView or others)

Next, head to your webhook provider, in this case we will use TradingView as an example.

On the indicator of your choosing, click on “More” (the three dots at the end of the indicator name), then “Add alert on…”. 

TV-add-alert.png

You will be presented with the following window. Click on “Webhook URL”.

tv-alert.png

You may input the webhook URL and the message as shown in your bot info. The alert name can be anything you want. Click on Create, and that's it! 

There are different types of webhook actions:

  • Open deal: will instruct the bot to start a new deal.
  • Close all deals: will instruct to close all open deals at market price.
  • Close bot
  • Add funds

Concatenating Webhook Actions on the Same Alert

Understanding Concatenation

Concatenating actions means executing multiple actions in sequence based on a single alert. In the context of webhooks, this involves sending an array of actions in the webhook payload.

Implementing Concatenation

Structure the Payload: When setting up your webhook, structure the payload as an array of actions. Each action should be a distinct object within the array.

Example to start a deal adding funds right away:

[
  { "action": "startDeal", "uuid": "f944e169-2398-482w-4987-10a30eeb477b" },
  { "action": "addFunds", "uuid": "f944e169-2398-482w-4987-10a30eeb477b", "asset": "quote", "qty": "50" }

]

Test the Webhook: Before going live, test the webhook with the array payload to ensure all actions are executed as expected.

Get more profit from your crypto with our trading tools

Table of contents

Skyrocket your profits with the most advanced trading bots in the market

Gainium logo

Gainium - Empower Your Crypto Trading: Research, Deploy, Analyze | Product Hunt

Gainium Pte. Ltd.
68 Circular Rd. #02-01 Singapore (049422)

Community

All rights reserved. Copyright © 2024.

Gainium is a publisher of financial information, not an investment adviser. We do not provide personalized or individualized investment advice. Cryptocurrencies are volatile investments and carry significant risk including the risk of permanent and total loss. Past performance is not indicative of future results. Figures and charts are correct at the time of writing or as otherwise specified. Live-tested strategies are not recommendations. Consult your financial adviser before making financial decisions.