Webhook Integration
import { APP_URL } from ’../../../consts’; import { Badge } from ‘@astrojs/starlight/components’;
Webhook Connection
Section titled “Webhook Connection”The critical link between your TradingView strategy and real-time analytics.
Webhooks allow TradingView to push signals instantly to our platform. This guide covers configuration, authentication, and payload requirements.
How It Works
Section titled “How It Works”Understanding the data flow is essential for troubleshooting:
- Trigger: Your Pine Script strategy fires an alert condition (e.g., “Buy Signal”).
- Payload: TradingView sends a JSON packet containing trade details (ticker, action, price).
- Authentication: Our server verifies the
auth_keyin the payload matches your specific webhook endpoint. - Ingestion: If valid, the system creates a TradeWebhookEvent record.
- Processing: The event is parsed into a TradeOrder, ready for analytics or broker execution.
Step 1: Create a Connection
Section titled “Step 1: Create a Connection”- Navigate to <a href={APP_URL + “/app/webhooks”}>Dashboard > Webhooks.
- Click Create Webhook.
- Give it a recognizable name (e.g., “BTC Strategy”).
- Copy the generated Webhook URL and Auth Key. You will need these for TradingView.
Step 2: Configure TradingView Alert
Section titled “Step 2: Configure TradingView Alert”In your TradingView strategy settings or alert dialog:
- Webhook URL: Paste the URL you copied from the dashboard.
- Message: You must send a valid JSON object. Use our standard template:
{ "auth_key": "YOUR_AUTH_KEY_HERE", "ticker": "{{ticker}}", "positionDirection": "entryLong", "orderType": "market", "qty": {{strategy.order.contracts}}, "marketPrice": {{close}}, "metadata": { "timestamp": "{{timenow}}", "strategy": "My Strategy", "signal": "Buy Signal" }}Step 3: Limitations & Best Practices
Section titled “Step 3: Limitations & Best Practices”To ensure system stability and accurate processing:
- Rate Limits: Each webhook connection is limited to 30 requests per minute. This prevents runaway strategies from flooding the system. High-frequency trading (HFT) is not supported.
- One Strategy, One Webhook: We recommend creating a separate webhook connection for each distinct strategy. This makes debugging much easier if one strategy starts misbehaving.
- Payload Size: Keep payloads under 25KB. The system is optimized for trade signals, not massive data dumps.
Troubleshooting
Section titled “Troubleshooting”- 401 Error: Check your
auth_key. It must be an exact string match. - No Event: Verify you checked the “Webhook URL” box in TradingView alert options.
- Event but No Trade: Check the Webhook Events Log. If the JSON was malformed, the system creates an event but marks it as “Failed to Process”.
Next Steps
Section titled “Next Steps”Once your webhooks are flowing:
- Verify Data: Check the raw logs to ensure TradingView is sending what you expect.
- Backtest vs Alerts: Compare these real-time signals against your historical backtest.
- Standard Reference: View the full list of supported JSON fields.