🚀 Live Demo: https://trade-pulse-ivory.vercel.app/
The Trading Strategy Backtester is a full-stack serverless application designed to simulate and analyze the performance of trading strategies against historical or synthetic market data. It allows quantitative traders (and enthusiasts) to validate their hypotheses before risking capital.
Currently, the system demonstrates a Mean Reversion strategy simulation on procedurally generated price data.
The application checks the "Serverless" box by leveraging AWS managed services for scalability and zero-maintenance compute.
graph LR
User[User Browser] -- HTTPS --> Cloud[Vercel Frontend]
Cloud -- API Calls --> APIG[AWS API Gateway]
APIG -- Event --> Lambda[Spring Boot Lambda]
Lambda -- Read/Write --> DDB[(AWS DynamoDB)]
- Frontend: A responsive Single Page Application (SPA) that handles user configuration, visualizes equity curves with interactive charts, and displays historical performance metrics.
- Backend API: A Spring Boot application adapted for AWS Lambda (using
aws-serverless-java-container). It exposes REST endpoints to trigger backtests and query history. - Simulation Engine: The core business logic that processes price arrays, executes strategy rules (Buy/Sell/Hold), and calculates financial metrics (Win Rate, Drawdown, Profit).
- Persistence Layer: Results are stored in DynamoDB for low-latency retrieval of past simulations.
- Framework: React 19 (via Vite)
- Language: TypeScript
- Styling: Modern CSS3 (Vanilla)
- Visualization: Recharts (for equity curve plotting)
- Hosting: Vercel
- Framework: Spring Boot 3.2.5
- Language: Java 21
- Compute: AWS Lambda (SnapStart enabled for fast cold starts)
- API Management: AWS API Gateway (HTTP API)
- IaC: AWS SAM (Serverless Application Model)
- Database: Amazon DynamoDB
- Data Model: Single-table design storing Backtest IDs, financial metrics, and timestamps.
The current implementation uses a threshold-based Mean Reversion logic:
- Signal Generation: Scans the price series window.
- Buy Rule: Price drops > 5% (Expect a bounce back).
- Sell Rule: Price rises > 5% (Expect a correction).
- Execution: Simulates "All-in" trades (100% cash to asset, or 100% asset to cash).
Orchestrates the backtest:
- Accepts
Starting BalanceandPrice Data. - Iterates through time, tracking cash vs. holdings.
- Calculates "Mark-to-Market" value at every step.
- Computes final Win Rate and Total Return.
- Java 21+
- Node.js 18+
- AWS CLI & SAM CLI (optional, for deployment)
The frontend uses synthetic data generation locally, so it works even without a live backend connection for testing UI flow.
cd frontend
npm install
npm run devAccess at: http://localhost:5173
You can run the Spring Boot app as a standard web server locally:
cd backend
./mvnw spring-boot:runAPI Access: http://localhost:8080
Note: To fully simulate the AWS environment locally, use
sam local start-apiif you have Docker installed.
| Method | Endpoint | Description |
|---|---|---|
POST |
/prod/api/backtest |
Accepts {startingBalance, prices[]} and returns simulation results. |
GET |
/prod/api/history |
Returns the last 10 simulation runs. |