How to send commands from TradingView to Hummingbot telegram bot

Important as of Aug 1st 2020: Confluxbot no longer offer free tier(Previously, you can set up to two free resender combinations), you need to pay $15/mth for unlimited resender combinations.

Discovered liquidity mining back in late May, and has a VPS setup to run the operation ever since. My problem with liquidity mining that it will work brilliantly in a trending or sideways market but terrible in a downtrend market.

So how can we keep running the bot in a trending or sideways market, and stop the bot in a downtrend market? The cons to stopping the bot in a downtrend is that liquidity rewards will stop unless there is way to import different strategy file but this is currently not possible. So let's take a look on how we can auto-trigger the bot based on any technical indicator.

Overview

Luckily, hummingbot has a telegram feature where you can start or stop the bot. Secondly, tradingview has a webhook feature to trigger trades but what is missing is the connector.

The connecter is conflux bot which provides a free webhook, and then setup a channel, group account where the tradingview signals are sent to. From that channel/group account, we need to forward the messages, start/stop to the hummingbot telegram. See following flowchart:

During the setup, there were some problems as the message from tradingview to channel/group has addition message of #webhook. Inorder to forward the correct messages, using text manipulation (by confluxbot) needs to be perform first before sending the commands to the hummingbot telegram.

The end result is that total automation of liquidity mining can be perform by sending start/stop signals from Tradingview to humming telegram bot.

Instructions

  1. Follow instructions https://docs.hummingbot.io/advanced/telegram/ to setup your hummingbot telegram.
  2. Add https://t.me/ConfluxBot
  3. (For payment, steps 3-4) Click Show Packages.
  4. Select and click 1.Plus [...option], and follow onscreen instructions to pay. Two payment types: Paypal and Bitcoin.
    1. Paypal: You will received a code in your email which you need to enter in the Redeem Access Code option.
    2. Bitcoin: Just pay to the address and the bot will be activated.
  5. Create a channel or a group. This group/channel is used as receiver from Tradingview triggers, and then forward to the hummingbot telegram bot. Add confluxbot as admin to the group.
  6. Go to ConfluxBot 
  7. Enter /Start
  8. Click Connect Accounts. Follow on-screen instructions for first time setup.
  9. Click Webhook. Your webhook URL is displayed.
  10. Copy & paste the webhook URL in your browser. A list of groups or channels is displayed.
  11. Look for the channel/group URL that you created (not the Hummingbot telegram) to confirm your channel/group is detected by conflux bot. Copy that URL as well.
  12. Go back to confluxbot, and click Telegram Account. You will be prompted to share your contact.
  13. Click Re-sender combinations.
  14. Click Add Combination. A list of telegram and discord groups/channels are displayed.
  15. Search for your group/channel. Tip: pin the group/channel so it will appear first. Select the number of the group/channel  as your source.
  16. Select the hummingbot telegram number as the destination.
  17. Click Back to Configs to confirm that you have selected source and destination.
  18. Go Tradingview and setup your alerts to trigger start or stop: - In the alert actions, use the confluxbot webhook URL for your group/channel. For info how to setup Tradingview webhook, see https://www.tradingview.com/blog/en/webhooks-for-alerts-now-available-14054/ - Enter Start or Stop in the message.So there will be two alerts messages, start and stop sent to the confluxbot webhook URL .Once either start or stop message is sent to group/channel. There should be an additional text infront of Start/Stop, for example #webhook Start or #Webhook stop. You need to perform text manipulation on those words. If there is none, great!
  19. Now go back to conflux bot, click Text Manipulation.
  20. Cut and paste the #webhook Start literally from the group/channel and paste the text in, and add :start. see following: Repeat step 17 for the stop For info on text manipulation: https://medium.com/@ak4zh/confluxbot-how-to-use-text-manipulation-feature-63b24fb9a93e
  21. Click Forward/Resend , and ensure the mode is in Resend. This allows text manipulation to be performed before sending the message to the bot.Now the bot should be able to start/stop based on your Tradingview strategy and alert triggers.
  22. You also need to disable Show Headers, so when sending, the channel/group headers wont be included in the headers.Hope this helps! So we can sleep better :P

Note: If you have alertatron, it can be use as well but the steps will be a bit different.