SystemSelf reportedCryptoPython

binance-tradingview-webhook-bot

A tradingview webhook trading bot for Binance Exchange.

System Structure

Data Used
Binance가격/거래량 데이터
Rules / Strategy

저장소별 전략/실행 조건 확인 필요

Execution

거래소 API 기반 자동 주문 실행

Editor Summary

저장소 설명과 공개 메타데이터 기준으로 Python 기반 구현, 암호화폐 거래 봇, 거래소 API/프레임워크, TradingView 웹훅 성격의 프로젝트로 파악했습니다. 확인 근거는 README, 저장소 설명, GitHub 지표, 파이프라인 필드이며, 주요 데이터는 Binance, 가격/거래량 데이터입니다. 전략/실행 조건은 저장소별 문서와 코드 확인이 필요하며, 실행 방식은 "거래소 API 기반 자동 주문 실행"라고 보수적으로 기록했습니다. GitHub 지표는 별 122개, 포크 61개입니다.

Repository51bitquant/binance-tradingview-webhook-bot
Creator51bitquant
Stars / Forks★ 122 / 61
LicenseMIT
Last Updated2023-04-28
Snapshot Date2026-07-08 (README below is a copy from this date)

This is third-party open-source code. QuantField does not guarantee its behavior or safety. Review the code before installing or running it.

README

binance-tradingview-webhook-bot

中文文档

A tradingview webhook trading bot for Binance Exchange. you can just simply set up your own signal alert from tradingview, and the bot will help you place order to Binance Spot or Binance Future.

if you want to use algo trader in your strategy, we recommend you to use howtrader, it implements a few algo trader in tv strategy.

how-to use

Follow the following step you can create your own Binance tradingview webhook bot.

1. buy a server、 domain and install the nginx software.

If you don't have a server, you need to buy a server and a domain. Then resolve your domain to your server ip.

window server recommendationhttps://www.ucloud.cn/site/active/kuaijie.html?invitation_code=C1x2EA81CD79B8C#dongjing

After setup your own server, you also need to install the nginx software. For window, you can download from https://nginx.org/en/download.html , For MacOs system, you can just type this command into your terminal:

brew install nginx

Other useful command are:

brew services start nginx

brew services restart nginx

brew services reload nginx

if you don't have the brew installed, just google how to install the homebrew.

For window server, you just download the nginx software from: https://nginx.org/en/download.html, then unzip and cd to the current directory. Here are the useful command.

start nginx.exe

nginx.exe -s stop

nginx.exe -s quit

nginx.exe -s stop

nginx.exe -s reload (reload)

Then edit the nginx.conf file, and add a server for the Flask Server, then save the nginx.conf


http {

    server {
            listen 80;
            server_name your.domain.com;
            charset utf-8;
    
            location / {
              proxy_pass http://localhost:8888;
            }
    
        }
        
        
     }
     
     # other configurations.

After editing the eginx.conf, you need to restart nginx.conf or reload the eginx. Finally, run the main.py, like python main.py. You may need to create a python virtual environment.

create an alert from tradingview.

You may need to register an account from https://www.tradingview.com and develop your own strategy and create an alert.

config your webhook details.

when creating an alert, select the box Webhook Url, and past your webhook url like: http://www.your.domain/webhook, for the message body, you can config like this:

{"action": "{{strategy.order.comment}}",
  "symbol": "ETHUSDT",
"exchange": "binance_future",
"price":"{{strategy.order.price}}",
"close": "{{close}}",
"passphrase": "your custom password for safety.",
"strategy_name": "ETHUSDT_15min",
"some other key": "some other value you need"
}

In this tradingbot, in order to make the order filled immediately, we use the market order type. If you trade BTCUSDT, ETHUSDT pairs, the slippage is very small. If you want to use the limit order type, please checkout the code and just change the order type to limit and change the order's price. Last but not least, you also need to set the commemt at the your order, like:


strategy.entry('L', strategy.long, comment="long")
strategy.entry('S', strategy.short, comment="short")
strategy.exit('tp', comment="exit")

how to run the code

  1. download the codes and unzip it
  2. create a