Introduction
Relevant source files
The following files were used as context for generating this wiki page:
Rabid Raccoon is a specialized trading platform and indicator system designed for Micro E-mini S&P 500 (MES) futures. It combines high-frequency technical analysis with a robust data ingestion pipeline that incorporates macroeconomic data from sources like FRED (Federal Reserve Economic Data), Databento, and various news feeds. The system provides traders with automated signals, multi-timeframe analysis, and AI-driven market overlays to assist in making informed trading decisions.
Sources: README.md:1-10, cubic.yaml:8-13
The architecture is built on a Next.js framework deployed on Vercel, utilizing Prisma ORM for persistent storage in a PostgreSQL database. It features background job processing via Inngest for scheduled data updates and automated pipeline management.
Sources: README.md:65-71, cubic.yaml:8-13
System Architecture
The project is divided into several primary functional areas: Pine Script v6 indicators for TradingView, a Next.js web application for dashboarding and AI analysis, and a suite of ingestion scripts for building datasets and real-time market streams.
Core Modules
| Module | Description | Status |
|---|---|---|
| Measured Move Detection | Identification of equal-length price swings with projected targets. | TODO |
| Auto-Fibonacci Engine | Multi-timeframe Fibonacci methodology (4H → 1H → 15m). | TODO |
| Correlation Analysis | Dynamic VIX/DXY/NQ correlation with divergence signals. | TODO |
| AI Analysis Engine | Multi-timeframe signal computation (15M, 1H, 4H) with AI narrative overlays. | Active |
| Data Ingestion | Scheduled pipelines for market prices, macro indicators, and news. | Active |
Sources: README.md:15-25, src/lib/instant-analysis.ts:5-12
Data Flow Overview
The following diagram illustrates the flow of market and macroeconomic data from external providers through the ingestion layer into the persistent database and finally to the analysis engine.
Core Components
1. Instant Analysis Engine
The analysis engine computes over 200 technical signals across multiple timeframes (15M, 1H, 4H). It uses "Raw Math" for deterministic signal generation and leverages OpenAI for optional narrative overlays and trade planning.
Sources: src/lib/instant-analysis.ts:5-12
Key technical indicators processed include:
- Moving Averages: SMA and EMA across periods 5, 10, 20, 50, 100, and 200.
- Oscillators: RSI, Stochastic, Williams %R, and CCI.
- Trend/Volatility: MACD, ATR expansion, and Bollinger Band positioning.
- Institutional Levels: VWAP and Fibonacci retracements.
Sources: src/lib/instant-analysis.ts:114-190
2. Market Context & Regime Detection
The system identifies the current market regime (RISK-ON, RISK-OFF, or MIXED) by analyzing cross-asset correlations and price changes in MES, NQ (Nasdaq), VX (VIX), and US10Y (10-Year Treasury Yield).
Sources: src/lib/market-context.ts:182-195
3. Inngest Background Pipelines
Automated background jobs are managed by Inngest. These pipelines handle incremental market price updates, macro refresh from FRED, and measured-move signal updates.
Sources: README.md:118-125
Critical Inngest Requirements:
- Client ID: Must always be
rabid-raccoonto prevent cross-project contamination. - Side Effects: All database writes and API calls must be wrapped in
step.run()for deterministic replay. - Event Names: Must be namespaced with
rr/orbackfill/.
Sources: cubic.yaml:26-45
Development & Deployment
Directory Structure
indicators/: Pine Script trading logic.src/lib/: Core library code for analysis and data handling.src/inngest/: Background job definitions.scripts/: Batch ingestion and dataset building tools.src/app/api/: Endpoint definitions for the dashboard and Inngest.
Sources: README.md:30-40, cubic.yaml:215-225
Dataset Building
The system includes scripts to build specialized training datasets for AutoGluon, integrating technical price action with macroeconomic "as-of" features to prevent data leakage.
Sources: scripts/build-lean-dataset.ts:5-15, scripts/build-15m-dataset.ts:5-15
| Feature Type | Count | Examples |
|---|---|---|
| Time Features | 5 | Hour UTC, Day of Week, Session Flags |
| MES Technicals | 22 | RSI, MA Distances, Volatility Ratios |
| FRED Raw | 19+ | VIX, DXY, 10Y Yield, Fed Assets |
| Derived Macro | 10 | Yield Curve Slope, Real Rates, VIX Percentile |
Sources: scripts/build-lean-dataset.ts:200-225
Conclusion
Rabid Raccoon serves as a comprehensive tool for MES futures trading, bridging the gap between technical chart analysis and macro-fundamental context. By enforcing strict data integrity rules and utilizing a modular architecture, the system provides a robust environment for both real-time trading and long-term signal backtesting.
Sources: README.md:1-10, cubic.yaml:50-60