A simple, self-hosted FastAPI Telegram bot that receives alerts from TradingView, captures charts via Playwright, and delivers them to a Telegram channel instantly.
- Instant alerts from TradingView delivered to Telegram.
- Chart screenshots captured with Playwright (headless Chromium).
- Async worker queue to process chart captures without blocking webhook response.
- Telegram commands for custom intervals, themes, and symbol-to-exchange mapping
- Simple self-hosting: runs well on a Proxmox homelab LXC.
git clone https://github.com/tedawf/tradingview-telegram-alerts.git
cd tradingview-telegram-alerts
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
playwright install chromium.env.example
TG_BOT_TOKEN=your_telegram_bot_token
TG_CHANNEL_ID=-1001234567890 # channel ID (with -100 for channels)
# for the bot to reply to your commands (not localhost!)
DOMAIN=https://your.domain.com # used by deploy.sh script to set webhook for the telegram APIRun:
uvicorn app.main:app --host 0.0.0.0 --port 8000Send a test webhook (text/plain):
curl -X POST "http://localhost:8000/alert" -H "Content-Type: text/plain" --data "BTCUSD Crossing 123456"This repo includes deploy.sh which:
- Activates the virtualenv
- Installs Python dependencies
- Restarts the
tvta-bot.servicesystemd service - Sets the Telegram webhook to
$DOMAIN/command
Example tvta-bot.service:
[Unit]
Description=TradingView Telegram Alerts
After=network.target
[Service]
User=tvta_user
WorkingDirectory=/opt/tvta
ExecStart=/opt/tvta/.venv/bin/uvicorn app.main:app --host 0.0.0.0 --port 8000
Restart=always
[Install]
WantedBy=multi-user.targetEnable and start the service:
sudo systemctl enable tvta-bot.service
sudo systemctl start tvta-bot.serviceThen run your deploy.sh on updates (git pull):
./deploy.sh- Use /map and /unmap to manage exchange mappings without redeploying.
- Limit
NUM_WORKERSin main.py for low-RAM environments or increase the LXC memory. - If Playwright fails to launch in an LXC, ensure
nesting=1and install Playwright dependencies (playwright install-deps) or use a full VM.
Contributions are welcome - open an issue or submit a PR.
Feel free to fork this repository!

