| title | Equity Execution Quality Analyzer |
|---|---|
| emoji | 📈 |
| colorFrom | blue |
| colorTo | indigo |
| sdk | streamlit |
| sdk_version | 1.57.0 |
| app_file | app.py |
| pinned | false |
This application monitors the execution quality of algorithmic trading across 15 large-cap equities (SPY, AAPL, MSFT, NVDA, TSLA, and 10 others). Every minute of the trading session it ingests OHLCV bar data — either live from the Alpaca IEX feed when an API key is present, or from a Geometric Brownian Motion simulator when running without credentials — and computes three execution-quality metrics: how closely each trade tracks the session VWAP benchmark, how wide the implicit transaction cost (effective spread) is relative to the intraday quote midpoint, and whether each bar's volume is abnormally large for that time of day. A four-method anomaly detector (VWAP z-score, spread percentile, volume z-score, and Isolation Forest on the joint feature space) then flags bars that deviate from normal execution patterns, and the results are surfaced through a four-page Streamlit dashboard that auto-refreshes every 30 seconds.
-
Live Feed — Candlestick chart of the last 50 bars with a session-VWAP overlay and color-coded volume bars; metrics strip showing current price, session VWAP, VWAP deviation %, effective spread in basis points, and today's anomaly count; auto-refreshes every 30 seconds for near-real-time monitoring.
-
VWAP + Volume Profile — Top panel overlays the closing price on the running session VWAP so you can see at a glance whether execution is beating or lagging the intraday benchmark; bottom panel breaks total session volume into four time buckets (OPEN, MORNING, MIDDAY, CLOSE) to reveal whether the day's liquidity profile matches the expected U-shape or shows structural deviations.
-
Spread Analysis — Scatter of effective spread in basis points across every bar of a chosen session, with a horizontal line at the 97th-percentile threshold used by the anomaly detector; a cross-symbol ranking table below shows average spread across all stored sessions so the selected symbol can be oriented within the broader universe.
-
Anomaly Log — Filterable audit trail of every flagged bar, grouped by symbol, anomaly type, and severity; color-coded rows (red = high/ALERT, orange = medium, yellow = low/WARN) and a summary strip of counts by severity level make it straightforward to triage whether the day's anomaly load is elevated and which detection method is responsible.
VWAP deviation measures how far each bar's closing price sits above or below the volume-weighted average price for that session, expressed as a signed percentage. VWAP is the standard execution benchmark for institutional trading: a desk that consistently executes above VWAP is paying more than the average market participant (adverse for buyers), while executing below VWAP means getting a better-than-average price (favorable for buyers). The z-score of this deviation — computed as an expanding window that resets at each market open — flags bars where the price has moved unusually far from the session anchor, which can indicate information leakage, momentum, or a large order moving the market.
Effective spread quantifies the implicit round-trip transaction cost of any trade that occurs within a given bar. It is computed as 2 × |close − midpoint| / midpoint, where the bar's high-low midpoint proxies the NBBO quote midpoint when full tick data is unavailable, and the result is expressed in basis points (hundredths of a percent) for direct comparison across symbols at any price level. A widening effective spread means market makers are quoting wider — they are demanding more compensation for the risk of taking the other side — and any algorithmic order filled during a wide-spread bar pays a higher implicit cost. Rather than a z-score (which assumes a symmetric, roughly normal distribution), the spread detector uses a rolling 97th-percentile threshold because effective spread is right-skewed and bounded at zero; the percentile approach fires on exactly the top 3% of bars regardless of the distribution's shape.
Anomaly detection combines three rule-based signals with a multivariate machine-learning model. The rule-based methods (VWAP z-score, spread percentile, volume z-score) are interpretable and map directly to known market microstructure events — a volume spike at 2σ is a concrete, auditable fact. The Isolation Forest runs on the joint feature space of all three metrics simultaneously: it can catch bars where no single metric breaches its individual threshold but the combination of a moderately elevated spread, a mild VWAP deviation, and a slightly high volume is jointly anomalous in a way no single rule would find. In testing on the simulated universe, 12.6% of Isolation Forest flags had no corresponding rule-based flag — demonstrating the practical value of multivariate detection for catching moderate joint stress before any individual metric triggers.