Integration Architecture
This guide outlines the technical data flow between TradingView strategy intent and broker execution. The system is designed to isolate variables across the signal-to-fill pipeline.
Data Flow Architecture
Section titled “Data Flow Architecture”The reconciliation engine utilizes a multi-stage pipeline to quantify performance variance:
- Signal Generation: A TradingView strategy initiates an alert containing a structured JSON alert signal.
- Ingestion: The Webhook Endpoint captures the signal with millisecond-precision.
- Normalization: The Universal Webhook Processor validates the signal and maps
positionDirectionto broker-specific execution intents. - Broker Synchronization: Actual fill reports are retrieved from Alpaca via OAuth or secure API key synchronization. Basic & Pro
- Reconciliation: The matching engine pairs signals with fills based on symbol, timestamp, and logical direction.
Performance Metrics
Section titled “Performance Metrics”The engine analyzes three primary data points to calculate execution variance:
- Signal Price: The
marketPricerecorded at the exact moment the alert was triggered. - Intended Price: The execution target derived from the
orderType(e.g.,limitPriceorstopPrice). - Actual Price: The average fill price as reported by the broker’s execution report.
Cost Attribution Analysis
Section titled “Cost Attribution Analysis”To provide actionable insights, the system distinguishes between two primary cost vectors:
- Setup Cost: Variance between the signal price and the intended entry (Strategy logic choice).
- Execution Slippage: Variance between the intended entry and the actual fill price (Broker execution performance).
API Response Interface
Section titled “API Response Interface”Custom integrations can utilize the structured analysis returned by the webhook endpoint:
{ "success": true, "webhookEvent": { "id": "evt_123", "ticker": "AAPL" }, "analytics": { "orderType": "stop_limit", "intendedPrice": 151.00, "setupCost": 0.75, "executionQuality": "good" }, "validation": { "valid": true, "warnings": [] }}Functional Progression
Section titled “Functional Progression”- Webhook Integration: Technical steps for endpoint configuration.
- Backtest Logic Audit: Verifying signal generation against strategy intent.
- Webhook API Reference: Detailed specification for the JSON alert signal.