Webhook bridge that receives TradingView strategy alerts and auto-executes trades on Capital.com demo/live via REST API
TradingView → Capital.com Webhook Bot
Receives TradingView webhook alerts and automatically executes trades on Capital.com (demo or live account).
How It Works
- TradingView sends a webhook
POSTto your server when an alert fires - Flask app receives and parses the JSON payload
- Capital.com API places the order (market buy/sell)
Webhook Payload Format
Configure your TradingView alert message as:
{
"action": "buy",
"symbol": "EURUSD",
"size": 1
}
| Field | Values | Description | |----------|---------------------|--------------------------| | action | "buy" / "sell" | Trade direction | | symbol | e.g. "EURUSD" | Capital.com market name | | size | number | Position size (lots) |
Setup
pip install flask requests python-dotenv
Create .env:
CAPITALAPIKEY=yourapikey
CAPITALPASSWORD=yourpassword
CAPITALIDENTIFIER=youremail
DEMO=true
Run the server:
python app.py
Point your TradingView webhook to http://your-server:5000/webhook.
Files
| File | Purpose | |---------------------|----------------------------------| | app.py | Flask webhook server | | capital_client.py | Capital.com REST API wrapper | | config.py | Environment config loader | | generate_guide.py | Generates a trading setup guide |
License
MIT