Schwab Individual Trader API · Personal Project

Institutional-Grade Quantitative Trading, Built from Scratch

A proprietary real-time algorithmic trading platform fully integrated with Charles Schwab's Individual Trader API — streaming live market data across 19 symbols, computing multi-indicator confluence signals at sub-second latency, and executing automated OCO bracket orders with institutional-grade risk management and adaptive position tracking.

19
Live Symbols
WebSocket streaming
8
Indicators
Computed per candle close
OCO
Order Type
Entry + target + stop, automated
6+
Safety Gates
Before any order fires

Three-Layer Event-Driven Pipeline

Market data flows from Schwab's streaming API through a custom indicator engine and into an automated order management system — all non-blocking on a single Node.js event loop. No heavy frameworks, no build step, no external message queue.

📡

Layer 1 — Data Ingestion

  • OAuth2 with 60-second pre-expiry auto-refresh
  • WebSocket CHART_EQUITY 1-min candle stream
  • LEVELONE_EQUITIES tick-by-tick price quotes
  • In-memory 1→5 min candle aggregation engine
  • Historical REST seed: 100 candles per symbol on startup
  • Background pivot level refresh (non-blocking)
⚙️

Layer 2 — Signal Engine

  • 8 technical indicators computed on every candle close
  • Proprietary multi-indicator confluence scoring (−10 to +10)
  • ATR-based intraday reversal detection overlay
  • Support/resistance pivot scanner for confirmation
  • Market regime gates: SPY/QQQ/VIX context check
  • SHORT confirmation: requires prior-bucket agreement
🎯

Layer 3 — Order Management

  • 1st-Triggers OCO: entry → profit target + stop loss
  • ATR-derived stop distance and profit target
  • Per-trade bucket cap + portfolio cap enforcement
  • Regime-adaptive auto-trailing stop (ATR/2 or ATR/3)
  • SSE real-time order lifecycle stream to browser
  • Live broker + mock paper-trade modes

Built for Real Markets, Not Backtests

Every component was developed and validated against live Schwab market data — handling real-world edge cases like token expiry mid-session, partial fills, market regime shifts, and simultaneous alert bursts across multiple symbols.

📊

Multi-Indicator Confluence Engine

Eight independent technical indicators are computed on every 5-minute candle close, each contributing a weighted vote to a proprietary confluence score. Signals only fire when multiple independent indicators align — filtering noise and reducing false positives without over-fitting to a single measure.

Proprietary Scoring
🤖

Fully Automated Order Execution

When a confluence threshold is crossed, the system automatically places a 1st-Triggers OCO bracket order via the Schwab Trader API — simultaneously setting the profit target and stop loss. The entire order lifecycle is tracked in SQLite and streamed in real time to the dashboard via Server-Sent Events.

Phase 2b Auto-Trade
🌐

Market Regime Intelligence

SPY, QQQ, VIX, and UVXY snapshots are captured every 15 minutes and used to classify the current market regime. The Observer Filter Sets system applies historically-optimized filter combinations based on that day's conditions — improving signal quality adaptively without manual intervention.

Adaptive Filtering
🔬

Filter Optimization Engine

An offline optimizer evaluates over 2,000 filter combinations against 30 days of historical alerts, determining which filters maximize win rate under each observed market regime. Results are stored and automatically applied to subsequent live trading sessions when the regime classifier matches.

2,048 Combinations
📈

Regime-Adaptive Trailing Stops

Once a position enters the profit zone, the system activates a dynamic trailing stop whose width adapts to current market conditions. EMA slope and Chaikin Money Flow direction determine whether the trail tightens or widens — protecting gains without exiting strong trending moves prematurely.

ATR-Based Width
🛡️

Multi-Layer Risk Management

Six independent safeguards gate every auto-trade: session time window enforcement, direction filter, duplicate position check, per-symbol limit, per-trade bucket cap, and total portfolio cap. Optional stop/target price randomization prevents detectable entry patterns from accumulating.

6-Gate Safety System

Real-Time Trading Dashboard

The dashboard polls every 5 seconds and displays live confluence scores, prices, and position status for all 19 watched symbols. Per-symbol alert checkboxes control which tickers fire desktop notifications and trigger auto-trade orders.

http://localhost:3001 — Trading Monitor
● LIVE
SPY +0.82%
QQQ +1.14%
VIX 14.2 ▼
Market Bias BULL
ATR Reversal ACTIVE
Pivot Scanner ON
Observer Filters OFS-3 APPLIED
Symbol Price Score Meter ATR Signal Alert
NVDA 127.84 +8
3.42 ▲ LONG ⚡ AUTO
AAPL 213.56 +7
2.18 ▲ LONG ⚡ ALERT
TSLA 248.90 −8
7.63 ▼ SHORT ⚡ AUTO
AMD 168.32 +3
4.07 Watching…
META 563.14 +5
8.21 Building…
MSFT 419.77 −2
3.84 Neutral
http://localhost:3001/report.html — Reports & Analytics
📊 REPORTS
Alerts
Orders
Analyze
Market Summary
Filter Optimizer
67%
Long Win Rate
71%
Short Win Rate
69%
Overall Win Rate
142
Total Alerts
+$3,840
Est. P/L
+$2,915
Actual P/L
SymbolAlertsWin RatePerformanceActual P/L
NVDA2475%
75%
+$820
AAPL1867%
67%
+$610
TSLA2162%
62%
+$540
AMD1573%
73%
+$495

Every Panel, Explained

The live interface combines market regime intelligence, watchlist scoring, pivot S/R levels, automated order controls, and real-time position tracking — all in a single view.

127.0.0.1:3001 — Trading Monitor · Regular Session · 1:50 PM ET
● LIVE
QT Platform Live Dashboard
1
Market Regime Header NEUTRAL / BULL / BEAR classification derived from QQQ, VIX, ADX, and SPY scores. Drives Observer Filter Set selection and trade direction gates.
2
Live Alert Counts & Score Summary Running tally of LONG and SHORT alerts since market open, with the current SPY ADX, VWAP, and VIX readings surfaced inline for quick regime context.
3
Observer Filter Set (OFS) Active Criteria Auto-Filters applies the optimizer-selected filter combination for the current regime. Shown here: Sector Specific + 10-Min EMA Trend + ADX/DMI + MACD Histograms + CMF Bearish applied to SHORT signals.
4
Industry ETF Momentum Tickers Live S&P 500, Nasdaq-100, Russell 2000, Dow Jones, and sector ETF (XLF, XLK, XLV) percent-change ribbon. Used for same-sector bias confirmation.
5
QT Automation Controls The full auto-trade control strip: Quantitative Trading enable, Live Mode (broker orders), Pivot Reverse-Trade, Long/Short direction filter, Add Jitter, Auto Trail, Close @ EOD, ATR Reversal rule, and Profit Protect — all persisted in localStorage.
6
Directional Filter Checkboxes Per-direction filter toggles: SHORT row (top) and LONG row (bottom). Each filter independently gates signals — Sector Specific, EMA Trend, ADX/DMI, VWAP, Candle Pattern, Session Candles, RSI, MACD, CMF. Optimizer selects the highest win-rate combination.
7
Live Watchlist: Score, Pivot S/R, RSI, TTM, ATR Each row shows real-time price, net change, confluence score (−10 to +10), three R and three S Pivot levels (daily Standard Pivots), RSI, TTM squeeze state, and Trade ATR used for stop/target sizing. Rows with active signals show the direction badge.
8
QT Positions Panel (Live / Mock) Real-time table of all auto-placed trades for the session: entry price, target, current live price, stop, unrealized P&L, exit price, status (open / stop / profit-protect / early-exit). Each row updates every 5 seconds via LEVELONE_EQUITIES quotes.
9
Trade Candidates / Audit Log Chronological log of every signal that reached the confluence threshold during the session — symbol, direction, entry/stop/target, share count, max loss, max gain, score, and outcome status. Used for end-of-day review and strategy refinement.

Monitor Trades from Anywhere

The dashboard is a standard browser app — no native install required. On the local network it's instant; with an nginx reverse proxy it's accessible from any device on any connection.

QT Positions on Android
📶
Local Network Access

Any device on the same WiFi points its browser at 192.168.x.x:3001. The full dashboard, reports, and QT Positions panel are instantly available — no install, no app store.

🌐
Remote Access via nginx

An nginx reverse proxy with TLS (Let's Encrypt via win-acme) sits in front of the Node.js server. Anywhere internet access with HTTPS, HTTP basic auth, and automatic certificate renewal.

🔄
Mock / Live Toggle

The Mock↔Live mode button is accessible from mobile. Switch between paper-trade simulation and live Schwab broker orders from any device — same session state, same open positions.

📅
Historical Day Navigation

Step through past trading days using the date picker. Each day shows all placed trades with entry, stop, target, exit price, exit type (stop / profit-protect / early-exit), and realized P&L.

Trade Card — What Each Field Means
Symbol + DirSymbol, direction (^ L = Long, v S = Short)
Outcomewin / loss with realized P&L
TimeET timestamp the order was placed
SharesATR-sized position, capped by bucket limit
EntryLimit price of the bracket entry order
TargetProfit target (ATR-based, optional jitter)
StopStop loss (ATR-based, tighter than target)
Exit @Actual fill price at close
Exit Bystop · profit-protect · early-exit · trail

Deep Performance Intelligence

A five-tab reports system provides full-depth analysis of every alert, order, and market condition — enabling iterative refinement against real historical data without leaving the browser.

Alerts & Orders Analysis

Full day-by-day replay of every alert with P&L breakdown, win rate by symbol, by hour-of-day, by confluence score level, and by market regime classification.

  • Production vs. paper-trade mode filtering
  • Outcome classification: win / loss / expired
  • Estimated P/L vs. actual P/L reconciliation
  • Peak burst capital and average capital per alert

Market Regime Correlation

Each trading day is correlated with SPY%, QQQ%, and VIX close to reveal which macro conditions most favor the strategy's signal quality across different regimes.

  • Daily SPY / QQQ / VIX context table per session
  • Bull / Bear / Flat day classification (±0.25% threshold)
  • Win rate overlaid with 15-min regime snapshots
  • UVXY volatility proxy for regime sensitivity

Filter Optimizer Report

The optimizer evaluates all filter combinations against historical alerts to find the configuration that maximizes win rate under the current market regime, with before/after comparison across the 30-day window.

  • 11 filters evaluated — 2,048 combinations per direction
  • Per-regime top filter set identification and storage
  • Historically-correct pivot level replay per alert date
  • One-click apply to live session Observer Filter Sets

Position & P&L Tracking

The QT Positions panel shows all open and closed trades for the current session with live price feeds, unrealized P&L, and one-click close functionality directly from the dashboard without navigating to a separate order screen.

  • Live price via LEVELONE_EQUITIES tick quotes
  • Actual close price vs. entry price reconciled
  • Auto-cancel for orders open longer than 1 hour
  • End-of-day sweep closes all positions at 3:30 PM ET

Modern Zero-Dependency Architecture

Built entirely on Node.js 22 with no heavy frameworks — raw WebSockets, native SQLite bindings, Server-Sent Events, and vanilla JavaScript on the frontend. Fast, lean, and fully observable with no build pipeline.

🟢
Node.js 22
Event-driven single process, native test runner, no transpilation step
🔷
Schwab API
OAuth2, WebSocket streaming, REST order placement & account management
🗄️
SQLite (WAL)
6-table schema, WAL mode for concurrent reads, in-memory test isolation
📡
WebSocket
Schwab CHART_EQUITY + LEVELONE_EQUITIES streams, auto-reconnect
📤
Server-Sent Events
Real-time order lifecycle push to browser — no polling, no WebSocket overhead
🔒
OAuth2
Auto-refresh 60s before expiry, 7-day refresh token TTL warning system
🧪
Node:test
Built-in test runner across 6 suites — scorer, calculator, orders, auto-trader
🌐
Vanilla JS
Zero framework frontend — no React, no bundler, no build step required

Engineered for Real Markets

This platform represents years of iterative development against live Charles Schwab market data — from OAuth2 integration through full automated bracket order execution. Built by Saer Khan, a software consultant with 30+ years of enterprise development experience.