System Guide

Complete Reference For Engines, Automation, Settings, And Production

Important: This system runs two separate engines that must never be mixed during execution: Fast News (speed-focused, optional auto-orders) and Regular A+ (confirmation-focused, manual alerts only).
1. System overview

Trading Intelligence monitors U.S. market news and price action, scores setups with rules and OpenAI, logs decisions for the learning engine, and sends Telegram alerts. The web dashboard shows live option quotes (Tradier REST polling), alert feeds, and controls. Fast News can optionally place sandbox or live option orders through Tradier when enabled.

  • Timezone: All market schedules use America/New_York (U.S. Eastern).
  • Asset class: U.S. listed options (calls and puts).
  • Broker integration: Tradier (sandbox or live, configured on the server).
  • News & data: Benzinga headlines, Massive/Polygon-style market bars, optional Reuters RSS and X/Twitter when enabled in .env.
2. The two engines (do not mix)
Engine Purpose Execution Typical hold
Fast News Breaking headlines (geopolitical, FDA, M&A, macro, etc.) with strict speed and premium guardrails. Can auto-submit Tradier option orders when enabled in Settings and all checks pass. Default: OFF. Minutes (time stop 3–5 min typical)
Regular A+ Slower confirmation: VWAP, opening range (15 min), volume, sector, options flow, OpenAI ≥ 8, weighted score ≥ 85 (full “A+” label at OpenAI ≥ 10). Manual only — Telegram alert with contract and limit hint. You place the trade in your broker. Intraday plan; often first 5–15 minutes after open

Fast News never uses Regular A+ confirmation logic. Regular A+ never auto-submits broker orders.

3. Automation & schedule (server cron)

The server must run this command every minute (Linux cron on AWS EC2):

* * * * * cd /var/www/html/tradding_app && php artisan schedule:run

When cron runs, Laravel decides which jobs are due based on New York market time:

  • fast-news:run — every 1 min, weekdays 9:30 AM – 3:55 PM ET
  • options:scan-watchlist — every 3 min (no overlap), weekdays 9:30 AM – 3:55 PM ET (Regular A+)
  • options:monitor-positions — every 1 min, weekdays 9:30 AM – 4:05 PM ET (A+ TRIM/EXIT Telegram alerts)
  • fast-news:monitor-exits — every 1 min, weekdays 9:30 AM – 4:05 PM ET (Fast News auto exits)
  • trading:collect-reactions — every 1 min, 9:30 AM – 4:05 PM ET (underlying/option snapshots)
  • trading:sync-executions — every 1 min, 9:30 AM – 4:05 PM ET (poll Tradier fills → update slippage)
  • learning:retrain — weekdays 4:30 PM ET (learning:retrain)
  • fast-news:missed-review — weekdays 5:15 PM ET
  • trading:export-csv — weekdays 5:20 PM ET → storage/app/exports/trading_log_YYYY-MM-DD.csv

Outside U.S. market hours or on weekends: cron may still run, but most trading jobs will not execute — this is normal.

Note: Live stock WebSocket (market:stream) runs as a separate long-lived process under Supervisor — not inside schedule:run. See next section.

4. Market data & WebSocket (market:stream)
This is not the dashboard browser tab. WebSocket runs on the server and feeds faster stock prices into scans. Dashboard option mids use Tradier REST every 1s by default.
What it does
  • Command: php artisan market:stream — long-running listener (use Supervisor on production).
  • Massive/Polygon WebSocket — live trades, quotes, minute aggregates for watchlist stocks.
  • Tradier WebSocket — market events for the same tickers + open Fast News option symbols.
  • Writes into Redis/cache (LiveMarketDataStore) with a heartbeat.
  • Engines read prices via UnifiedMarketDataService fallback order: stream → tradier → massive.
Subscribed symbols
  • Fast News watchlist: AVGO, NVDA, SMH, COIN, XLE, SPY, QQQ, USO, MRVL, GDX, IBM, NOW, ARM
  • Regular A+ watchlist: AVGO, NVDA, SMH, COIN, XLE, SPY, QQQ, USO, PLTR, AMD, IBM, NOW, ARM, INTC, EBAY, NCLH, TMHC
  • Sector ETF proxies from options_alerts.sector_etf_map + SPY
  • Any open Fast News trade_executions option contracts (buy_to_open, not closed)
Dashboard vs server stream
FeatureTechnologyPurpose
Engine scans (FN / A+) WebSocket cache + REST fallback Fast underlying price / VWAP / bars during decisions
Watchlist “Stock Candles” stream → tradier → massive 1m / 5m underlying OHLC chart for configured watchlist tickers
Dashboard “Live Options” Tradier REST poll (~1s) Option bid/ask/mid for open positions & alert rows
Dashboard SSE (optional) Server-Sent Events DASHBOARD_QUOTE_SSE_ENABLED OFF (default) — push quotes to browser; not the same as market:stream
Current status (this server)
  • MARKET_STREAM_ENABLED: ON
  • Stream cache for dashboard badge: Not live — engines fall back to Tradier/Massive REST (normal if Supervisor is not running market:stream)
Production setup
# Supervisor example (runs 24/7, restarts on crash)
php artisan market:stream --cycle-seconds=55

Session window: weekdays ~9:25 AM – 4:10 PM ET (see market_stream.allow_outside_session). Key .env vars: MARKET_STREAM_ENABLED, MASSIVE_WS_URL, TRADIER_WS_URL, MARKET_LIVE_STORE (redis/cache).

5. Fast News — step-by-step flow
  1. Ingest — Latest Benzinga wires + watchlist headlines (tickers: AVGO, NVDA, SMH, COIN, XLE, SPY, QQQ, USO, MRVL, GDX, IBM, NOW, ARM).
  2. Duplicate check — Same theme may repeat on a new day; exact duplicates within ~15 minutes are suppressed.
  3. Severity — Score must be ≥ 9 (configurable). Earnings-only positioning is rejected.
  4. Direction map — Headline mapped to tickers (e.g. oil/geopolitical → USO/XLE, yields → QQQ/SPY).
  5. Market + options — Live price, VWAP, TA; option delta ~0.4–0.5, spread ≤ 10%.
  6. OpenAI — Strict JSON decision (ENTER_FAST_NEWS or REJECT) with guardrails.
  7. Local rules — Latency, premium move, friction, spread enforced again in code.
  8. Execution — Only if Fast News auto is ON in Settings, kill switch OFF, risk limits OK, and Tradier sandbox/live allowed.
  9. Telegram — Auto entry notification or review/reject message.
  10. Latency — Reject if news→decision > 30s (normal) or total pipeline delay > 15s (hard).
  11. Exitsfast-news:monitor-exits: trim +20% / +40% premium, stop −20% / −20%, time stop 5 min, VWAP failure.

Max Fast News auto entries per day: 1 (default). Max open positions: 3.

6. Regular A+ — step-by-step flow
  1. Scan watchlist (AVGO, NVDA, SMH, COIN, XLE, SPY, QQQ, USO, PLTR, AMD, IBM, NOW, ARM, INTC, EBAY, NCLH, TMHC) every 3 minutes during session (options:scan-watchlist).
  2. Require: price vs VWAP, 15-minute opening range break, relative volume, options flow, sector alignment@if (config('options_alerts.require_ema9_alignment', true)), 9 EMA@endif.
  3. OpenAI 0–10: minimum 8 to proceed; label A+ ENTRY CONFIRMED at ≥ 10.
  4. Weighted composite score ≥ 85 (news, reaction, sector, volume, technicals, liquidity, risk/reward).
  5. Option spread cap 8% (sandbox may use relaxed pick tiers in code).
  6. Telegram manual alert with contract, limits, trim/targets — you place the trade; no A+ auto-orders.
  7. options:monitor-positions — TRIM at +30% premium, EXIT at +50% or stop −20% / VWAP flip (tracked trade_signals).
  8. Max A+ ENTRY alerts per day: 2.
7. Settings page — what each control does

Go to Settings. Current live status:

  • Fast News auto-trading: ON — When ON (with confirmation), the system may place sandbox option orders on Tradier after AI + rules pass. Sandbox broker URL
  • Manual kill switch: OFF
  • Daily P/L kill switch: Not triggered
  • A+ auto-trade: Never — A+ is manual Telegram only.
Kill switch wins over Fast News auto. With kill ON, no new entries even if auto appears enabled in UI.
8. Dashboard cards
  • Top KPI boxes — Regular A+ count today, Fast News decisions + executions + auto ON/OFF, active positions (POSITION_ACTIVE / TRIMMED), kill switch + realized P/L today.
  • Live options table — Active positions with mid/bid/ask/spread; Tradier REST refresh every 1s. Chip shows Tradier Rest or Stream Live if market:stream cache is fresh (underlying feed — options still from Tradier REST).
  • Learning engine — 30-day stats (decisions, slippage, win rate when trade_executions / trade_exits exist), category scores, lessons.
  • Alert tabs — Regular A+ vs Fast News feeds, 8 alerts per page, scrollable table, AJAX pagination.
  • Alerts log — Full history, 20 per page.
9. Telegram alerts

Alerts go to the chat ID in TELEGRAM_CHAT_ID (your personal or group chat — not the bot ID).

Message types:

  • REGULAR A+ MANUAL ALERT — Entry plan, contract, limits, stops (you trade manually).
  • FAST NEWS AUTO ENTRY — When auto-trading places a sandbox order.
  • FAST NEWS REVIEW — Headline processed but rejected or not auto-eligible.
  • TRIM / EXIT — Position monitor on open paper-tracked trades.
  • WAIT — Optional choppy-market notice when enabled on scan command.

Test from ToolsDiagnose Telegram or run php artisan telegram:diagnose on the server.

10. Other pages
Dashboard
Live KPIs, quotes, learning panel, paginated A+ / Fast News alert previews.
Alerts log
All engines — ENTRY / TRIM / EXIT / Fast News decisions; Telegram preview per row.
Watchlist
OPTIONS_WATCHLIST (A+) and FAST_NEWS_WATCHLIST tickers + sector ETF map.
Tools
Telegram test, dry scans, Fast News dry run, health check, position monitor dry — no live orders from dry-run.
AI lab
Upload client JSON logic for scoring prompts; test OpenAI Q&A.
Settings
Fast News auto, manual kill switch, API key presence (secrets in .env).
System guide
This page — aligned with current scheduler and config defaults.
11. Data & learning database

Every news event and decision can be stored for post-trade learning:

  • raw_news_events — Headlines, severity, duplicate status, theme.
  • reaction_snapshots — Underlying and option prices at news, 30s, 1m, 5m.
  • trade_decisions — OpenAI JSON, latency, reject reasons.
  • trade_executions / trade_exits — Broker orders and P/L when auto-trading runs.
  • learning_scores — Updated after close by retrain job.
  • trade_signals — Regular A+ Telegram / paper-tracked alerts.

Daily CSV export: storage/app/exports/trading_log_YYYY-MM-DD.csv

12. Risk & limits (defaults)
  • Fast News: max 1 auto entry/day; size hints severity 9 → $15,000, severity 10 → $25,000.
  • Regular A+: max 2 ENTRY alerts/day.
  • Spread caps: Fast News ≤ 10%; A+ scan ≤ 8% (relaxed tiers possible in sandbox).
  • Daily P/L kill: DAILY_KILL_SWITCH_USD default $200 realized tracking.
  • Fast News: no averaging down; cooldowns after loss/trade (see config/trading_system.php).
  • Live Tradier orders require LIVE_EXECUTION_ENABLED=true in .env (admin).
13. Troubleshooting
SymptomWhat to check
No alerts at allCron running? storage/logs/scheduler.log; U.S. market hours? Kill switch OFF?
Telegram not workingTELEGRAM_CHAT_ID = user chat from getUpdates, not bot ID; run telegram:diagnose
Fast News always 0Auto OFF is normal; decisions still log in DB during session
Auto order rejectedSpread, premium move, latency > 30s, severity < 9, kill/P&L switch, or auto OFF
Learning slippage / win rate “—”No trade_executions.slippage_percent or trade_exits in last 30 days — normal if Fast News auto was OFF
Live quotes staleCheck Tradier token; dashboard uses REST every 1s (SSE off by default)
“Stream Live” badge offStart Supervisor job php artisan market:stream; set MARKET_STREAM_ENABLED=true; check Redis/cache
Scans slow vs newsWithout WebSocket, engines use REST only — enable market:stream for faster underlying prices
Integrations “Missing key”Update .env on server, then php artisan config:clear