TradingView-Binance-Telegram-Bot
An automated trading bot connecting TradingView alerts via webhook to the Binance API, and sending order confirmations or errors to a Telegram user. The user can also send commands to the bot to make new trades, download trade history, cancel open trades, and a variety of other options!
시스템 구조
저장소별 전략/실행 조건 확인 필요
거래소 API 기반 자동 주문 실행
에디터 요약저장소 설명과 공개 메타데이터 기준으로 Python 기반 구현, 암호화폐 거래 봇, 거래소 API/프레임워크, TradingView 웹훅 성격의 프로젝트로 파악했습니다. 확인 근거는 README, 저장소 설명, GitHub 지표, 파이프라인 필드이며, 주요 데이터는 Binance, OHLCV/호가/체결 데이터입니다. 전략/실행 조건은 저장소별 문서와 코드 확인이 필요하며, 실행 방식은 "거래소 API 기반 자동 주문 실행"라고 보수적으로 기록했습니다. GitHub 지표는 별 151개, 포크 45개입니다.
| 저장소 | ytrevor81/TradingView-Binance-Telegram-Bot |
|---|---|
| 제작자 | ytrevor81 |
| 스타 / 포크 | ★ 151 / 45 |
| 최근 업데이트 | 2025-08-07 |
| 스냅샷 시점 | 2026-07-08 (아래 README는 이 시점의 사본입니다) |
아래는 제3자가 작성·공개한 오픈소스 코드입니다. QuantField는 해당 코드의 동작과 안전성을 보증하지 않으며, 설치·실행 전 코드를 직접 검토하시기 바랍니다.
README
TradingView-Binance-Telegram-Bot
Flask | Binance API | Telegram API | TradingView Webhook | JSON
(This project was made quite a few years ago and is seriously outdated. This most likely doesn't work out of the box anymore, and I will not make updates. -Trevor 07/08/2025)
An automated trading bot connecting TradingView alerts via webhook to the Binance API, and sending order confirmations or errors to a Telegram user. The user can also send commands to the bot to make new trades, download trade history, cancel open trades, and a variety of other options!
How to run the trading bot
This bot is operated by Flask.
Local Server: After installing the requirements from requirements.txt, open your preferred terminal, navigate into the main directory and type the command "flask run"
Remote Server: After installing Python and the requirements from requirements.txt, configure your server using WSGI. This ensures that your bot is always running. The command "flask run" is not needed for remote servers, unless you want to test the bot in debug mode.
How does the trading bot work?
There are four parts to this trading bot:
- Receives TradingView alerts via webhook, at the endpoint "/botwebhook" (found in file app.py)
- Send order to Binance API (found in file app.py)
- A Telegram messaging bot sends order confirmations from Binance API and error messages to the Telegram bot admin (found in file bot.py)
- Send Telegram commands to a Telegram bot connected to the main application.
The user of this trading bot must make a config.py (or a .json file) that holds the desired Binance API keys and the Telegram bot keys. The user must also create a Telegram bot in order to receive notifications from the trading bot.
TradingView Webhook Alert
Set up your TradingView alert to send a JSON message like this:
{ "passphrase": "Your passphrase here", "time": "{{timenow}}", "exchange": "{{exchange}}", "symbol": "{{ticker}}", "quantity": 1.0, "side": "{{strategy.order.action}}", "type": "LIMIT", "timeInForce": "GTC", "currentPrice": {{close}} }
You can change and add any variable you want, as long as it's in JSON format. Any additions, however, must be added to the Binance API call in app.py as well, because the code in app.py will read directly from this alert message.
On TradingView, make sure to include the desired url you would like to send in the 'Webhook URL' input (ex: http://your.server.address/botwebhook)
Telegram Bot
Commands
- /start - Saves Chat Id and Username
- /help - Receive a notification of all valid commands the bot will process.
- /account - Check current account on Binance
- /orderhistory {symbol} - Receive a CSV file of all orders made for a specific token (ex. /orderhistory btc)
- /openorders {symbol} - Checks all open orders for a specific token (ex. /openorders xrp)
- /market {side} {amount} {symbol} - Place a market order on Binance (ex. /market buy 0.01 eth)
- /limit {timeInForce} {side} {amount} {symbol} at {price} - Place a limit order on Binance (ex. /limit gtc sell 0.01 eth at 1800)
- /stoploss {timeInForce} {side} {amount} {symbol} at {price} stop at {stopLoss} - Place a stoploss limit order on Binance (ex. /stoploss gtc sell 0.1 btc at 55000 stop at 54900)
- /ticker {symbol} - Checks the current price of a given token (ex. /ticker btc)
- /cancel {symbol} {orderId} - Cancels an open order. It is recommended to call the co