Webhook alerts
Using webhooks, alerts from TradingView.com can be sent directly to a Gunbot instance. You need to be able to run Gunbot on a device that is publicly accessible on port 443.
Initial setup
Before you start setting up your alerts, you need to:
- Make sure your system has LibreSSL installed, this will generate the needed certificate
- Make sure your device is publicly accessible on port 443, the only port allowed by TradingView
- Enable webhooks support in Gunbot on the TradingView settings page and set a self chosen passphrase to use in alerts, to ensure it is you who sends the alerts that the bot will execute
- Like with TradingView alerts in email mode, make sure to add one valid pair to Gunbot for each exchange you'll receive alerts on. This pair will not get actively traded unless you send alerts for it.
Alert message contents
The alerts have to be in the following format in order for Gunbot to act on them:
passphrase exchange order_type pair amount price
Alerts follow the same standardized pair syntax that also apply for normal Gunbot usage, the alert text must be in the subject line of an email.
Limit order alert examples
spot:
123456 binance buy USDT-BTC 0.1 42553.4
123456 binance sell USDT-BTC 0.1 42553.4
futures:
123456 binanceFutures long USDT-BTC 0.1 42553.4
123456 binanceFutures short USDT-BTC -0.1 42553.4
123456 binanceFutures close USDT-BTC 0.1 42553.4
123456 binanceFutures close USDT-BTC -0.1 42553.4
Market order alert examples
spot:
123456 binance buy USDT-BTC 0.1 0
123456 binance sell USDT-BTC 0.1 0
futures:
123456 binanceFutures long USDT-BTC 0.1 0
123456 binanceFutures short USDT-BTC -0.1 0
123456 binanceFutures close USDT-BTC 0.1 0
123456 binanceFutures close USDT-BTC -0.1 0
Change strategy alert
format:
passphrase exchange strat pair name_of_strategy_here 0
example:
123456 okgunbot strat ETH-AVAX superCoolDCA 0
Other settings
Currently a small subset of the settings available for email alerts are available for use with webhooks:
- TV_GB
- TV_PROTECTION
Installing LibreSSL on Windows
If you get certificate related errors when enabling the webhook listener on a windows server, the following steps should resolve it.
open powershell and run the following command:
Set-ExecutionPolicy Bypass -Scope Process
still in powershell, run the following command:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
open cmd terminal and run this command to install libressl:
choco install -confirm libressl
In case errors persist, manually install LibreSSL using this method:
- download .dll from here https://sourceforge.net/projects/libressl-3-2-0-for-windows/files/LibreSSL-3.3.3_MinGW_Windows7%28static%29.zip/download
- extract the folder in c:/libressl