A suite of quantitative market tools:
- PXI Index - Real-time macro market strength (28 indicators → single 0-100 score)
- Sector Signals - Weekly sector rotation signals from Reddit discussion analysis
Live: pxicommand.com · /signals
PXI (Positioning Index) synthesizes signals from liquidity, credit spreads, volatility, market breadth, macro economic data, global risk appetite, and crypto markets into one score:
| Score | Status | Meaning |
|---|---|---|
| 80+ | MAX PAMP | Extremely bullish conditions |
| 65-79 | PAMPING | Bullish conditions |
| 45-64 | NEUTRAL | Mixed signals |
| 30-44 | SOFT | Bearish conditions |
| <30 | DUMPING | Extremely bearish conditions |
- 28 indicators across 7 categories normalized to 0-100 scale
- Real-time updates via GitHub Actions cron (4x daily)
- Historical backtest with 1000+ observations since Dec 2022
- Ensemble Predictions - Weighted combination of XGBoost (60%) and LSTM (40%) with confidence scoring
- XGBoost Model - Gradient boosted trees using 36 engineered features (momentum, dispersion, extremes)
- LSTM Model - Recurrent neural network using 20-day sequences of 12 features for temporal patterns
- Similar Period Detection - Find historically similar market regimes using vector embeddings
- Prediction Tracking - Log predictions and evaluate against actual outcomes
- Historical Outlook - Forward returns and win rates by PXI bucket with adaptive thresholds
- Signal Layer - Risk allocation signals based on PXI, momentum, and volatility
- PXI-Signal Strategy - Dynamic risk allocation (Sharpe ~2.0)
- Comparison - vs 200DMA and buy-and-hold baselines
- Walk-forward validation - Out-of-sample testing
- Model Context Protocol - Enables Claude and other LLM agents to query PXI
- 7 Tools - get_pxi, get_predictions, get_similar_periods, get_signal, get_regime, get_market_context, get_history
- Agent-Optimized - Structured responses with suggested actions and risk assessments
- Weekly Analysis - Runs every Monday (or Tuesday if Monday is a US market holiday)
- Reddit Sentiment - Analyzes 750+ posts from investing subreddits
- 20 Sector Themes - Nuclear, Automation, Defense, Copper, Financials, and more
- Classification System - Signal type (Rotation/Momentum/Divergence/Reversion), confidence, timing
- Evidence-Based - Links to source discussions for each theme
| Category | Weight | Key Indicators |
|---|---|---|
| Credit | 20% | HY spreads, IG spreads, yield curve |
| Liquidity | 15% | Fed balance sheet, TGA, reverse repo, net liquidity |
| Volatility | 15% | VIX, VIX term structure |
| Breadth | 15% | RSP/SPY ratio, advance-decline |
| Positioning | 15% | Put/call ratio, fear & greed |
| Macro | 10% | 10Y yield, dollar index, oil |
| Global | 10% | Copper/gold ratio, BTC, stablecoin flows |
PXI INDEX SIGNALS
┌─────────────────────────┐ ┌─────────────────────────┐
│ │ │ │
┌─────────────────┐ │ ┌──────────────────┐ │ ┌───────────┐ │ ┌──────────────────┐ │
│ Data Sources │───▶│ GitHub Actions │ │ │ Reddit │────▶│ Cloudflare Cron │ │
│ FRED, Yahoo, │ │ │ (Daily Cron) │ │ │ API │ │ │ (Weekly) │ │
│ DeFiLlama... │ │ └────────┬─────────┘ │ └───────────┘ │ └────────┬─────────┘ │
└─────────────────┘ │ │ │ │ │ │
│ ▼ │ │ ▼ │
│ ┌──────────────────┐ │ │ ┌──────────────────┐ │
│ │ Cloudflare D1 │ │ │ │ Cloudflare D1 │ │
│ │ (SQLite) │ │ │ │ + R2 Storage │ │
│ └────────┬─────────┘ │ │ └────────┬─────────┘ │
│ │ │ │ │ │
└───────────┼─────────────┘ └───────────┼─────────────┘
│ │
▼ ▼
┌──────────────────────────────────────────────────────────────────┐
│ React Frontend (CF Pages) │
│ pxicommand.com │
└──────────────────────────────────────────────────────────────────┘
pxi-command/
├── frontend/ # React app (pxicommand.com)
├── worker/ # Main PXI API worker
├── signals/ # Sector rotation signals worker (/signals)
├── ml/ # ML model training (XGBoost, LSTM)
├── mcp-server/ # MCP server for AI agents
├── src/ # Shared data collection scripts
└── ai/ # AI analysis prompts
- Backend: TypeScript, Node.js
- Database: Cloudflare D1 (SQLite at edge)
- Storage: Cloudflare R2 (report storage for signals)
- Vector Store: Cloudflare Vectorize (768-dim embeddings)
- ML Models: XGBoost + LSTM (trained locally, inference at edge via KV)
- AI: Cloudflare Workers AI (BGE embeddings, Llama analysis)
- API: Cloudflare Workers
- Frontend: React 19, Vite, Tailwind CSS
- Hosting: Cloudflare Pages
- Scheduler: GitHub Actions (PXI daily) + Cloudflare Cron (Signals weekly)
- Agent Integration: MCP Server (Model Context Protocol)
| Endpoint | Method | Description |
|---|---|---|
/api/pxi |
GET | Current PXI score, categories, sparkline, regime, and freshness operator payload (topOffenders, refresh ETA) |
/api/history |
GET | Historical PXI scores |
/api/regime |
GET | Current market regime detection |
/api/signal |
GET | PXI-Signal layer with risk allocation |
/api/plan |
GET | Canonical decision object for homepage (policy state, uncertainty, consistency, trader playbook) |
/api/market/consistency |
GET | Latest decision consistency score/state/violations |
/api/ops/freshness-slo |
GET | Rolling 7d/30d freshness SLO attainment and recent critical stale incidents |
/api/ops/utility-funnel |
GET | Rolling utility funnel metrics (session -> decision views -> no-action unlock coverage + CTA intent rate) |
/api/ops/decision-impact |
GET | Decision-impact ops view (7d/30d market outcome proxy, theme summary, utility attribution, governance mode with observe + enforce readiness) |
/api/ops/decision-grade |
GET | Rolling governance scorecard (freshness, consistency, calibration, edge evidence, opportunity hygiene, utility) |
/api/ops/go-live-readiness |
GET | Explicit go-live readiness snapshot (blockers + decision-impact enforce readiness context) |
| Endpoint | Method | Description |
|---|---|---|
/api/brief |
GET | Daily market brief coherent with /api/plan policy state (includes contract version + consistency) |
/api/opportunities |
GET | Ranked opportunities for 7d or 30d horizon with calibration + expectancy + unavailable reasons |
/api/decision-impact |
GET | Outcome attribution using matured opportunity ledger rows (market uses SPY forward proxy; theme uses proxy blend with SPY fallback, 30/90d windows) |
/api/diagnostics/calibration |
GET | Calibration diagnostics (Brier/ECE/log loss + quality band) for conviction and edge-quality snapshots |
/api/diagnostics/edge |
GET | Forward-chaining edge evidence (model vs lagged baseline uplift, CI, leakage sentinel, promotion gate) |
/api/alerts/feed |
GET | In-app alert timeline (regime_change, threshold_cross, opportunity_spike, freshness_warning) |
/api/alerts/subscribe/start |
POST | Start email digest subscription with verification token |
/api/alerts/subscribe/verify |
POST | Verify subscription token and activate email digest |
/api/alerts/unsubscribe |
POST | Unsubscribe via token |
/api/metrics/utility-event |
POST | Record lightweight product utility telemetry events (session, decision view, no-action unlock, cta_action_click) |
| Endpoint | Method | Description |
|---|---|---|
/api/similar |
GET | Find similar historical periods (vector search with weighted scoring) |
/api/predict |
GET | Historical outlook by PXI bucket with adaptive thresholds |
/api/ml/predict |
GET | XGBoost model predictions for 7d/30d PXI changes |
/api/ml/lstm |
GET | LSTM neural network predictions using 20-day sequences |
/api/ml/ensemble |
GET | Weighted ensemble (60% XGBoost + 40% LSTM) with confidence |
/api/accuracy |
GET | Prediction accuracy metrics |
/api/analyze |
GET | AI-generated market analysis |
| Endpoint | Method | Description |
|---|---|---|
/api/backtest |
GET | PXI bucket forward returns analysis |
/api/backtest/signal |
GET | Signal strategy vs baselines |
| Endpoint | Method | Description |
|---|---|---|
/api/write |
POST | Write indicator data |
/api/recalculate |
POST | Recalculate PXI for date |
/api/migrate |
POST | Create missing database tables |
/api/evaluate |
POST | Evaluate past predictions |
/api/retrain |
POST | Retrain adaptive bucket thresholds |
/api/export/training-data |
GET | Export data for ML model training |
/api/market/refresh-products |
POST | Generate/store latest brief, opportunities, and market alerts |
/api/market/send-digest |
POST | Send daily digest to active subscribers |
| Endpoint | Method | Description |
|---|---|---|
/signals/latest |
GET | Latest weekly report (HTML) |
/signals/run/{id} |
GET | Specific report by run ID |
/signals/api/runs |
GET | List all runs with metadata |
/signals/api/runs/{id} |
GET | Run details as JSON |
/signals/api/run |
POST | Trigger manual run (requires X-Admin-Token) |
/signals/og-image.png |
GET | Dynamic OG image for social sharing |
Agent-discovery and markdown docs are published as static frontend endpoints:
https://pxicommand.com/llms.txthttps://pxicommand.com/agent.mdhttps://pxicommand.com/signals/agent.md
Canonical read endpoints referenced by llms.txt:
https://api.pxicommand.com/healthhttps://api.pxicommand.com/api/pxihttps://pxicommand.com/signals/api/runshttps://pxicommand.com/signals/api/accuracyhttps://pxicommand.com/signals/api/predictions
Write/admin endpoints remain auth-protected and are not intended for autonomous agent writes.
npm run cron:daily enforces per-indicator freshness SLAs before any write/recalculate calls.
| Class | Max age (days) |
|---|---|
| daily | 4 |
| realtime | 4 |
| weekly | 10 |
| monthly | 45 |
source-lagged (wti_crude) |
7 |
source-lagged (dollar_index) |
10 |
| Indicator | Max age (days) |
|---|---|
cfnai |
120 |
m2_yoy |
120 |
fed_balance_sheet |
14 |
treasury_general_account |
14 |
reverse_repo |
14 |
net_liquidity |
14 |
The daily refresh fails if any of these are stale or missing after fetch stage:
aaii_sentimentcopper_gold_ratiovixspy_closedxyhyglqdfear_greed
Run summary output is written to /tmp/pxi-sla-summary.json and published to GitHub Actions step summary.
Daily PXI Refreshnow runs ingestion + SLA gate + post-refresh product generation (/api/market/refresh-products).- Product summary output is written to
/tmp/pxi-market-summary.jsonand appended to the Actions job summary. - A separate
Daily PXI Digestworkflow runs at13:00 UTC(8:00 AM ET standard) and calls/api/market/send-digest. - Digest summary output is written to
/tmp/pxi-digest-summary.json.
Taylor’s PXI audit findings are being remediated with trust-first controls:
- Opportunity coherence gate
- Directional opportunities are only published when contract checks are coherent.
- Bullish items must have non-negative expectancy and
p_correct >= 0.50when available. - Bearish items must have non-positive expectancy and
p_correct >= 0.50when available. - Neutral items are not published in phase 1 actionable feed.
- Degraded-mode suppression
/api/opportunitiesis hard-suppressed (items: []) when:critical_stale_count > 0, or- market consistency state is
FAIL.
- Response includes
suppressed_countanddegraded_reason(for examplesuppressed_data_quality,coherence_gate_failed,quality_filtered).
- Calibration diagnostics transparency
- New endpoint:
GET /api/diagnostics/calibration - Includes Brier score, ECE, log loss, quality band, and insufficient-sample reasons.
- Freshness reliability governance
- New endpoint:
GET /api/ops/freshness-slo - Reports rolling 7d and 30d SLO attainment using
market_refresh_runs, including recent critical stale incidents.
- Edge-proof diagnostics + promotion gate
- New endpoint:
GET /api/diagnostics/edge - Reports forward-chaining directional uplift vs lagged baseline, CI bounds, and leakage sentinel health per horizon.
/api/market/refresh-productsnow fails closed when leakage sentinel checks fail, blocking publish/promotion.
- Decision-stack unification + cross-horizon coherence
/api/plannow includes additivedecision_stackandcross_horizonblocks.cross_horizon.state(ALIGNED|MIXED|CONFLICT|INSUFFICIENT) downgradesACTIONABLE -> WATCHon conflict/insufficient evidence.- Additional invalidation guidance is attached when horizons conflict or one horizon is missing.
- Signals sanitation + stability
- Adapter-side ticker sanitation (allowlist regex, jargon stopwords, dedupe/cap) before PXI opportunity blending.
- Signals source velocity cap tightened (
GROWTH_RATIO_CAP = 25) with explicitgrowth_ratio_cappedflag in metrics payload.
- Opportunity TTL timebox + cache safety
/api/opportunitiesnow emits refresh recency metadata:data_age_secondsttl_state(fresh|stale|overdue|unknown)next_expected_refresh_atoverdue_seconds
- CTA is hard-disabled when
ttl_stateisoverdueorunknown. - Cache policy is timebox-aware: overdue/unknown states return
Cache-Control: no-storeto avoid stale hard-CTA exposure.
- Utility funnel instrumentation (Phase 3)
- New ingestion endpoint:
POST /api/metrics/utility-event. - New ops endpoint:
GET /api/ops/utility-funnel?window=7|30. - Frontend now emits additive utility events for:
session_startplan_viewopportunities_view- decision-state exposures (
decision_actionable_view|decision_watch_view|decision_no_action_view) no_action_unlock_view(tracks no-action days as positive threshold-communication workflow events)cta_action_click(anonymous action intent from/opportunities)
- Decision-grade governance (Phase 4)
- Immutable opportunity ledger tracks candidate-vs-published counts per horizon on every product refresh.
- New ops endpoint:
GET /api/ops/decision-grade?window=7|30. - Scorecard components:
- freshness SLO reliability
- consistency-state quality
- calibration quality band health
- edge-promotion evidence
- opportunity hygiene (over-suppression + cross-horizon conflict persistence)
- utility funnel adoption
- Outcome attribution + utility lift (Phase 5)
- New endpoint:
GET /api/decision-impact?horizon=7d|30d&scope=market|theme&window=30|90 - New endpoint:
GET /api/ops/decision-impact?window=30|90 - Refresh pipeline persists:
- item-level publish/suppression ledger (
market_opportunity_item_ledger) - decision-impact snapshots (
market_decision_impact_snapshots)
- item-level publish/suppression ledger (
- Attribution basis is
spy_forward_proxy(market and theme scope in this phase). - Governance is observe-only in this phase. Breaches are surfaced in ops/workflow summaries but do not fail refresh runs.
- Observe thresholds:
market_7d.hit_rate >= 0.52market_30d.hit_rate >= 0.50market_7d.avg_signed_return_pct > 0market_30d.avg_signed_return_pct > 0cta_action_rate_pct >= 2.0
- Decision-impact enforcement + attribution hardening (Phase 6)
ops/decision-impactnow reports governance mode (observe|enforce), enforce readiness, and enforce breach list/count.- Enforce mode is sample-gated and disabled by default:
FEATURE_ENABLE_DECISION_IMPACT_ENFORCE=falseDECISION_IMPACT_ENFORCE_MIN_SAMPLE=30DECISION_IMPACT_ENFORCE_MIN_ACTIONABLE_SESSIONS=10
- Theme attribution basis upgraded from pure SPY proxy to theme proxy blend (credit/vol/global/crypto mappings) with explicit SPY fallback when proxy coverage is unavailable.
- Utility funnel CTA denominator now uses actionable sessions including CTA-click sessions (not only explicit actionable-view events) to reduce denominator undercount.
POST /api/market/backfill-productscan now rebuild opportunity ledgers and regenerate decision-impact snapshots from historical opportunity snapshots (rebuild_ledgers, defaulttrue).
- Go-live readiness + maturity-window correction (Phase 7)
- Decision-impact sampling now uses maturity-window semantics (outcome date in-window) instead of raw
as_offiltering, so 30d attribution no longer collapses to zero in a 30d window. /api/ops/decision-gradenow emits explicitgo_live_blockers[]plus readiness context (decision_impact_enforce_ready, sample counts, minimum thresholds).- New endpoint:
GET /api/ops/go-live-readiness?window=30for a compact operator view of readiness blockers and score context.
- Go-live blocker reduction + enforce readiness normalization (Phase 8)
- Utility decision target now scales by observed days in-window (instead of fixed full-window counts), improving early-window status stability.
- Decision-impact actionable-session minimum is normalized by observed days (with configured minimum still reported) to avoid false readiness negatives during partial windows.
- Go-live blocker logic now keys edge on promotion-gate safety (
edge_promotion_gate_fail) rather than strict edge componentpass/watchstate. - Enforcement should be flipped only when
/api/ops/go-live-readinessshowsgo_live_ready=trueand no blockers.
Target ownership is GitHub Actions (Daily PXI Refresh) only. Keep Cloudflare cron enabled during hardening, then cut over after stability validation.
- Keep Cloudflare and GitHub schedulers active.
- Require 12 consecutive successful scheduled GitHub runs (4/day over 72 hours) with zero critical SLA violations.
- Disable Cloudflare cron triggers for:
pxi-api-productionpxi-api
- Re-verify Cloudflare schedules are empty and GitHub continues refreshing data.
# Install dependencies
npm install
# Set up environment
cp .env.example .env
# Edit .env with your credentials
# Run daily data refresh
npm run cron:daily
# Start frontend dev server
cd frontend && npm run dev
# Deploy main worker
cd worker && npx wrangler deploy --env production
# Deploy signals worker
cd signals && npm install && npx wrangler deploy --env productionUse these checks after deployment or before releases:
# Frontend route checks
curl -I https://pxicommand.com/
curl -I https://pxicommand.com/spec
curl -I https://pxicommand.com/alerts
curl -I https://pxicommand.com/guide
curl -I https://pxicommand.com/signals
curl -I https://pxicommand.com/signals/latest
# API checks (canonical host)
curl -I https://api.pxicommand.com/health
curl -I https://api.pxicommand.com/api/pxi
curl -I https://api.pxicommand.com/api/alerts
curl -I https://api.pxicommand.com/api/signal
curl -I https://api.pxicommand.com/api/diagnostics/edge?horizon=all
# CORS preflight check
curl -X OPTIONS https://api.pxicommand.com/api/refresh \
-H "Origin: https://pxicommand.com" \
-H "Access-Control-Request-Method: POST" \
-H "Access-Control-Request-Headers: Content-Type, Authorization, X-Admin-Token"
# Backfill validation check (expect 400/401 depending on auth mode)
curl -X POST https://api.pxicommand.com/api/backfill \
-H "Content-Type: application/json" \
-d '{"start":"invalid-date","limit":"bad"}'Temporary rollback path remains available via https://pxi-api.novoamorx1.workers.dev during cutover.
Confirm the route is attached and active:
cd /Users/scott/pxi/signals
npx wrangler whoami
npx wrangler deployments list --name pxi-signals --env productionIf /signals is unreachable (404), verify:
signals/wrangler.tomlhaspxicommand.com/signalsandpxicommand.com/signals/*route entries.- The worker deploy succeeds after route changes.
- The
pxi-signalsworker has active production bindings (d1,r2,kv) forpxicommand.com.
cd signals
# Run tests (258 tests)
npm test
# Generate offline report (uses sample data)
npm run offline
# Deploy to Cloudflare
npx wrangler deploy --env production
# Set admin token for manual runs
npx wrangler secret put ADMIN_RUN_TOKEN# Install Python dependencies
cd ml && pip install -r requirements.txt
# Train XGBoost models (requires WRITE_API_KEY for data export)
export WRITE_API_KEY=your_key
python train_xgboost.py
# Train LSTM models (requires PyTorch)
pip install torch
python train_lstm.py
# Upload models to Cloudflare KV
npx wrangler kv key put "pxi_model" --path=pxi_model_compact.json \
--namespace-id=88901ff0216a484eb81b8004be0f5aea --remote
npx wrangler kv key put "pxi_lstm_model" --path=pxi_lstm_compact.json \
--namespace-id=88901ff0216a484eb81b8004be0f5aea --remoteXGBoost (train_xgboost.py):
- Engineers 36 features (momentum, dispersion, extremes, rolling stats)
- Gradient boosted trees for 7d/30d PXI change prediction
- Exports to JSON (318KB compact)
LSTM (train_lstm.py):
- Uses 20-day sequences of 12 features (PXI, categories, VIX, dispersion)
- Single-layer LSTM with 32 hidden units
- Exports weights to JSON for edge inference (239KB compact)
# Build the MCP server
cd mcp-server && npm install && npm run buildClaude Desktop - add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"pxi": {
"command": "node",
"args": ["/path/to/pxi/mcp-server/dist/index.js"]
}
}
}Available Tools:
| Tool | Description |
|---|---|
get_pxi |
Current score, categories, trend |
get_predictions |
ML ensemble forecasts (7d/30d) |
get_similar_periods |
Vector similarity search |
get_signal |
Risk allocation signal |
get_regime |
Market regime analysis |
get_market_context |
Comprehensive agent context |
get_history |
Historical scores |
| Variable | Description |
|---|---|
FRED_API_KEY |
FRED API key (get one free) |
WRITE_API_KEY |
API key for write operations |
WRITE_API_URL |
Worker API URL for cron |
npx wrangler secret put WRITE_API_KEY
npx wrangler secret put FRED_API_KEYindicator_values- Raw indicator data from sourcesindicator_scores- Normalized 0-100 scorescategory_scores- Category-level aggregationspxi_scores- Final composite scores
prediction_log- Predictions vs actual outcomesmodel_params- Tunable model parametersperiod_accuracy- Historical period prediction qualitymarket_embeddings- Vector embeddings for similarity search
pxi_signal- Risk allocation signalsalert_history- Generated alertsbacktest_results- Strategy performance
- FRED - Federal Reserve economic data (liquidity, credit spreads, yields)
- Yahoo Finance - Market prices, ETFs, VIX, currencies
- DeFiLlama - Stablecoin market cap
- Coinglass - BTC funding rates
- CNN - Fear & Greed index
MIT