Skip to content
Algo Trade Analytics Docs

Webhook Integration

import { APP_URL } from ’../../../consts’; import { Badge } from ‘@astrojs/starlight/components’;

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.

Understanding the data flow is essential for troubleshooting:

  1. Trigger: Your Pine Script strategy fires an alert condition (e.g., “Buy Signal”).
  2. Payload: TradingView sends a JSON packet containing trade details (ticker, action, price).
  3. Authentication: Our server verifies the auth_key in the payload matches your specific webhook endpoint.
  4. Ingestion: If valid, the system creates a TradeWebhookEvent record.
  5. Processing: The event is parsed into a TradeOrder, ready for analytics or broker execution.

  1. Navigate to <a href={APP_URL + “/app/webhooks”}>Dashboard > Webhooks.
  2. Click Create Webhook.
  3. Give it a recognizable name (e.g., “BTC Strategy”).
  4. Copy the generated Webhook URL and Auth Key. You will need these for TradingView.

In your TradingView strategy settings or alert dialog:

  1. Webhook URL: Paste the URL you copied from the dashboard.
  2. 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"
}
}

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.
  • 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”.

Once your webhooks are flowing: