Installation & Setup
Relevant source files
The following files were used as context for generating this wiki page:
Rabid Raccoon is an MES (Micro E-mini S&P 500) futures trading platform built with Next.js, featuring an integrated AI forecasting engine, Prisma ORM for persistent data storage, and Inngest for background job orchestration. The system is designed to handle high-frequency market data ingestion from Databento and macro indicators from FRED.
Sources: README.md:1-10, cubic.yaml:8-12
Prerequisites & Environment Configuration
The project requires Node.js (version 20 or higher) and a local PostgreSQL instance. Configuration is managed via environment variables stored in a .env.local file.
Core Environment Variables
| Variable | Description | Default/Example |
|---|---|---|
DATABASE_URL | PostgreSQL connection string | postgresql://postgres:postgres@localhost:5432/rabid_raccoon |
OPENAI_API_KEY | API Key for AI Analysis/Forecasting | Required for /api/analyse/ai |
OPENAI_ANALYSIS_MODEL | Primary model for analysis | gpt-5.2-pro (fallback chain) |
ANTHROPIC_API_KEY | API Key for Claude-based chart analysis | Required for /api/analyse/chart |
INNGEST_SIGNING_KEY | Key for Inngest production communication | Required for deployment |
INNGEST_EVENT_KEY | Key for triggering Inngest events | Required for deployment |
Sources: package.json:5-7, README.md:46-56, src/app/api/analyse/chart/route.ts:51-57, cubic.yaml:158-165
Development Workflow
The project follows a specific workflow for both the Pine Script trading indicators and the Next.js web application.
This diagram illustrates the dual-path development process for the trading indicator and the dashboard application.
Sources: README.md:27-33, README.md:68-76, package.json:10-33
Database & Data Layer Setup
The application utilizes Prisma with a PostgreSQL database. The setup is divided into infrastructure initialization and initial data backfilling.
1. Infrastructure Initialization
To start the local database and prepare the schema, execute the following commands:
# Start local PostgreSQL container
npm run db:up
# Apply schema migrations and generate Prisma Client
npx prisma migrate dev --name init_market_data
npx prisma generate
Sources: README.md:58-69, package.json:11-16
2. Machine-Only Initial Backfill
Backfilling is restricted to local operations with a "zero-fake" policy, ensuring only verified data from Databento and FRED enters the system.
# Ingest market prices (1h aggregated from Databento 1m)
npm run ingest:market
# Ingest macro indicators (730 days lookback)
npm run ingest:macro -- --days-back 730
# Ingest measured-move signals
npm run ingest:mm -- --timeframe 1h --days-back 120
Sources: README.md:71-85, package.json:18-24
AI & Python Stack Verification
The platform relies on a specific Python finance stack for intraday scanning (Halsey Module) and AI models for technical analysis.
Python Finance Stack
A verification script is provided to ensure the local environment has the necessary quantitative libraries installed:
pip install -r mes_hft_halsey/requirements.txt
python scripts/verify-finance-stack.py
The verification script checks for:
- SciPy & Statsmodels: For statistical calculations and OLS regression.
- QuantLib: For financial date and calendar logic.
- Zipline/Pyfolio: For backtesting and performance analytics.
Sources: README.md:112-120, scripts/verify-finance-stack.py:16-65
AI Model Integration
The system uses a fallback chain for OpenAI models, prioritizing gpt-5.2-pro. For visual chart analysis, the system integrates with Anthropic's Claude models.
Sources: src/lib/instant-analysis.ts:32-38, src/app/api/analyse/chart/route.ts:110-115
Automation with Inngest
Background jobs are orchestrated via Inngest. For local development, an Inngest dev server must be connected to the Next.js API route.
Sequence diagram showing the interaction between the Inngest runner and the application during daily automation.
Sources: README.md:87-95, cubic.yaml:23-40, package.json:33
Critical Isolation Rules
To prevent cross-project contamination (specifically with ZINC-FUSION-V15), the following configuration is mandatory:
- Inngest Client ID: Must be explicitly set to
"rabid-raccoon". - Event Namespacing: All events must use the
rr/orbackfill/prefix. - Side Effects: Every
fetch(),prismawrite, orconsole.logwith dynamic data must be wrapped insidestep.run()to prevent duplicate executions during retries.
Sources: cubic.yaml:25-50
Conclusion
Setting up Rabid Raccoon involves a multi-stage process of configuring environment variables, initializing a PostgreSQL database via Prisma, and performing a local data backfill. The system's integrity is maintained through strict isolation rules for background jobs and a specialized Python finance stack for HFT analysis.