Design, backtest, analyze, and optimize trading strategies with real-time market data, interactive risk dashboards, and automated AI strategy verdicts.
Key Features β’ Architecture β’ Tech Stack β’ Quick Start β’ API Documentation β’ Metrics & Indicators β’ License
Rooknomics is a full-stack quantitative financial analytics and algorithmic backtesting engine built for traders, analysts, and developers. It allows users to build technical trading rules (RSI, Moving Average Crossovers), simulate trade executions against historical equity price data, and compare performance against benchmark indices like the S&P 500.
With an intuitive dark-themed UI, interactive Recharts visualization, multi-axis risk radar charts, and an automated AI Verdict Engine, Rooknomics empowers users to make data-driven investment decisions without writing code.
- Asset Selection: Support for major equities and tickers (AAPL, MSFT, TSLA, NVDA, GOOGL, etc.).
- Custom Backtest Windows: Flexible date pickers and adjustable initial starting capital ($1,000 β $1,000,000+).
- Technical Indicators Engine:
- RSI (Relative Strength Index): Customizable period, buy oversold threshold, sell overbought threshold.
- Moving Average Crossover: Dual SMA / EMA support with adjustable fast and slow period windows.
- Equity Growth Overlay: Interactive dual-line chart comparing strategy equity curve against the S&P 500 Buy & Hold benchmark.
- Key Performance Metrics (KPIs):
- Total Return & CAGR / Annualized Return
- S&P 500 Benchmark Return & Value Delta
- Maximum Drawdown (MDD) %
- Sharpe Ratio & Daily Volatility %
- Win Rate %, Profit Factor, & Average Holding Days
- 5-Axis Risk Radar: Multi-dimensional risk score evaluating Returns, Stability, Drawdown, Costs, and Simplicity.
- Granular Trade Log: Full execution ledger with entry/exit dates, BUY/SELL signals, fill prices, share counts, trade PnL, PnL %, and running portfolio valuation.
- Evaluates strategy outcomes:
OUTPERFORMED,UNDERPERFORMED,NO_SIGNIFICANT_DIFFERENCE, orSTRATEGY_INACTIVE. - Generates actionable insights, warning against trade churn, premature exit timing, excessive drawdowns, or unrewarded volatility risk.
- Dual Auth Options: Password-less OTP email verification (via Resend) or one-click Google OAuth 2.0.
- JWT Cookie Session Management: Secure HTTP-only cookies and Authorization Bearer header support.
- Personalized User Dashboard: Save, review, reload, or delete past backtest simulations.
- Quantitative Learning Hub: Interactive guides explaining key technical indicators, risk metrics, and strategy formulation.
- Market News Hub: Live news aggregator with category filtering and publication timelines.
Rooknomics is structured as a modular TypeScript monorepo split into high-performance client and server applications:
Rooknomics/
βββ client/ # React 18 + Vite Frontend App
β βββ public/ # Static assets & icons
β βββ src/
β β βββ components/ # Modular UI & Chart components
β β β βββ AuthDialog.tsx # Login / Register / OTP Modal
β β β βββ BuilderView.tsx # Interactive Strategy Builder Form
β β β βββ LandingView.tsx # Hero section & Platform showcase
β β β βββ MetricsComparisonChart.tsx# Strategy vs Benchmark comparison
β β β βββ ProfileView.tsx # User profile & saved backtests history
β β β βββ ResultDashboard.tsx # Comprehensive analytics dashboard
β β β βββ ScrollCandlestickChart.tsx# Scrollable interactive price chart
β β β βββ ui/ # Radix UI primitives & design tokens
β β βββ data/ # Mock data & fallback presets
β β βββ hooks/ # Custom React hooks (useAuth, useMarketNews)
β β βββ lib/ # Utility helpers & Framer Motion variants
β β βββ pages/ # Primary route views (Index, Learn, NotFound)
β β βββ store/ # Redux Toolkit store (authSlice, backtestSlice)
β β βββ types/ # Frontend TypeScript contracts
β β βββ App.tsx # Main App layout & routing providers
β β βββ main.tsx # Application entrypoint
β βββ index.html
β βββ package.json
β βββ tailwind.config.ts
β βββ vite.config.ts
β
βββ server/ # Node.js + Express + MongoDB Backend
β βββ docs/ # Full REST API Endpoint documentation
β β βββ API_ENDPOINTS.md
β βββ src/
β β βββ api/ # Market data fetchers (Yahoo Finance API integration)
β β β βββ fetchPrice.ts # Stock candle fetcher & in-memory cache
β β β βββ fetchSP500.ts # S&P 500 index price fetcher
β β β βββ prepareMarketData.ts # Aggregator & indicator dataset prep
β β β βββ prices.ts # Real-time prices API handler
β β βββ backtest/ # Core Quantitative Backtest Engine
β β β βββ createBacktestInput.ts # Input transformer
β β β βββ metrics.ts # Financial metrics (Sharpe, Drawdown, PnL)
β β β βββ rules.ts # Signal triggers (RSI, MA Cross)
β β β βββ runBacktest.ts # Trade execution simulator
β β β βββ types.ts # Backtest domain interfaces
β β βββ config/ # DB connection (MongoDB Mongoose)
β β βββ controller/ # Request handlers (Auth, Backtest, User)
β β βββ engine/ # Technical Indicator algorithms (SMA, EMA, RSI, BB)
β β β βββ indicator.ts
β β βββ middleware/ # Auth & cookie verification middleware
β β βββ models/ # Mongoose schemas (User, Backtest, Simulation, PendingOTP)
β β βββ routes/ # Express API routes definition
β β β βββ authRoutes.ts # Authentication endpoints
β β β βββ userRoutes.ts # User profile endpoints
β β β βββ simulationRoutes.ts # Simulation persistence endpoints
β β β βββ routes.ts # Master router setup
β β βββ index.ts # Core backtest handler entrypoint
β βββ package.json
β βββ tsconfig.json
βββ LICENSE
| Domain | Technology | Description |
|---|---|---|
| Frontend Framework | React 18 + TypeScript | UI architecture with full type safety |
| Build Tool & Bundler | Vite 5 | Fast HMR & optimized production build pipeline |
| Styling & Components | Tailwind CSS + Radix UI | Utility-first styling & accessible UI primitives |
| Animations | Framer Motion | Smooth component transitions and UI micro-interactions |
| State Management | Redux Toolkit + React Query | Global auth state management & cached API queries |
| Data Visualization | Recharts | Financial equity charts, trade markers, & risk radar |
| Backend Runtime | Node.js + Express 5 | Asynchronous RESTful API backend engine |
| Database & ORM | MongoDB + Mongoose 9 | NoSQL database for users, OTPs, and saved backtests |
| Authentication | JWT + Google OAuth + Resend | HTTP-Only cookie JWT auth, Google login, & email OTP |
| Market Data Source | Yahoo Finance API | Live daily stock candles & benchmark price data |
- Node.js: v18.0.0 or higher
- Package Manager:
npmorbun - MongoDB: A running local MongoDB instance or MongoDB Atlas URI.
git clone https://github.com/vardaansinghal17/ROOKNOMICS.git
cd ROOKNOMICSCreate a .env file inside the server/ directory:
PORT=3000
MONGO_URI=mongodb://localhost:27017/rooknomics
JWT_SECRET=your_super_secret_jwt_key_here
RESEND_API_KEY=re_your_resend_api_key
CORS_ORIGINS=http://localhost:8080,http://localhost:5173
CLIENT_URL=http://localhost:8080
ALPHA_VANTAGE_API=optional_keyCreate a .env file inside the client/ directory:
VITE_GOOGLE_CLIENT_ID=your_google_oauth_client_id.apps.googleusercontent.com
VITE_API_BASE_URL=http://localhost:3000cd server
npm install
npm run devThe server will start listening at http://localhost:3000.
cd client
npm install
npm run devThe client app will launch at http://localhost:8080 (or http://localhost:5173).
Rooknomics features a structured REST API for authentication, price fetching, backtest execution, and user history persistence.
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/api/auth/register |
Send OTP email for account registration | No |
POST |
/api/auth/verify-otp |
Verify OTP & complete account creation | No |
POST |
/api/auth/login |
Authenticate user & set session cookie | No |
POST |
/api/auth/google |
Authenticate via Google OAuth 2.0 | No |
GET |
/api/auth/me |
Fetch authenticated user profile | Yes (Cookie) |
POST |
/api/auth/logout |
Clear user auth session cookie | Yes (Cookie) |
GET |
/api/prices |
Fetch historical candle prices for symbol | No |
POST |
/api/backtest |
Execute a quantitative backtest simulation | Optional |
POST |
/api/backtests |
Execute & save backtest to user profile | Yes (Bearer Token) |
GET |
/api/backtests |
Fetch paginated saved backtests | Yes (Bearer Token) |
DELETE |
/api/backtests/:id |
Delete a saved backtest record | Yes (Bearer Token) |
π For complete payload examples and response schemas, refer to API_ENDPOINTS.md.
-
SMA (Simple Moving Average): Calculates the average close price over a rolling window
$N$ . $$\text{SMA}t = \frac{1}{N} \sum{i=0}^{N-1} P_{t-i}$$ - EMA (Exponential Moving Average): Applies exponentially decreasing weights to past prices. $$\text{EMA}t = P_t \times \left(\frac{2}{N+1}\right) + \text{EMA}{t-1} \times \left(1 - \frac{2}{N+1}\right)$$
-
RSI (Relative Strength Index): Measures momentum on a 0-100 scale using average gain vs. loss.
$$\text{RSI} = 100 - \left( \frac{100}{1 + \frac{\text{Average Gain}}{\text{Average Loss}}} \right)$$ - Bollinger Bands: Visualizes volatility bands placed 2 standard deviations away from a 20-period SMA.
-
Sharpe Ratio: Risk-adjusted excess return over annualized daily volatility (
$\sqrt{252}$ ). - Max Drawdown (MDD): The maximum observed peak-to-trough drop in strategy portfolio value.
- Profit Factor: Gross profits generated divided by gross losses incurred.
- Value at Risk (VaR 5%): 5th percentile worst daily return scenario.
Run frontend unit tests and end-to-end browser tests:
# In client/
npm run test # Run unit tests with Vitest
npx playwright test # Run E2E integration tests with PlaywrightDistributed under the MIT License. See LICENSE for more information.