Getting Started
Overview
This guide will walk you through setting up the Strategy Execution Platform on your local machine. By the end, you’ll have a fully functional development environment with all services running.
Prerequisites
Before you begin, ensure you have the following installed:
- Docker and Docker Compose - For running infrastructure services
- Python 3.13+ - The main backend language
- Rust toolchain - Via
rustupfor the performance core - uv - The Python package manager (
pip install uv) - Node.js 18+ - For the frontend development server
Quick Start
Step 1: Clone the Repository
git clone <repository_url>
cd <repository_directory>Step 2: Configure Environment
Copy the example environment file and customize it:
cp .env.example .envOpen the .env file and ensure the default ports for the database, Redis, etc., are free. You will also need to add an Ethereum RPC URL (e.g., from Infura or Alchemy) for the chain monitor to connect to.
Step 3: Start Infrastructure
This command uses Docker Compose to spin up TimescaleDB, Redis, NATS, and Ray:
make docker-upYou can verify that all containers are running with docker ps.
Step 4: Install Dependencies & Build Rust Core
This command will install all Python dependencies using uv and then compile the Rust extensions via maturin:
make buildStep 5: Run the Platform
This command starts the main FastAPI application:
python main.pyYou should now be able to access the API at http://localhost:8000 and the auto-generated docs at http://localhost:8000/docs.
Step 6: Run the Frontend
Navigate to the frontend directory and start the development server:
cd <frontend_directory>
npm install
npm run devYou can now access the dashboard at http://localhost:3000.
Development Environment Details
Infrastructure Services
The platform uses several infrastructure services that are managed via Docker Compose:
- TimescaleDB: PostgreSQL extension optimized for time-series data
- Redis: High-performance in-memory data store for caching and read models
- NATS: Lightweight messaging system for real-time communication
- Ray.io: Framework for distributed Python applications
Backend Services
The backend consists of several Python services:
- API Server: FastAPI application serving REST and WebSocket endpoints
- Intent Manager: Handles intent submission and validation
- Execution Planner: Creates execution plans from intents
- Execution Orchestrator: Executes plans step-by-step
- State Coordinator: Manages system state and event persistence
Frontend Application
The frontend is a Next.js 14 application with:
- Real-time Dashboard: Live trading interface with WebSocket updates
- Strategy Management: Interface for creating and monitoring strategies
- Portfolio View: Real-time portfolio tracking and analysis
- Intent Submission: Forms for submitting new trading intents
Project Structure
platform/
├── app/ # Next.js frontend application
├── content/ # Documentation (this directory)
├── platform/ # Python backend code
│ ├── api/ # FastAPI routes and handlers
│ ├── core/ # Core business logic
│ ├── strategies/ # Strategy framework and examples
│ ├── types/ # Pydantic data models
│ └── streaming/ # Event streaming and NATS integration
├── src/ # Rust performance core
├── docker-compose.yml # Infrastructure services
├── .env.example # Environment configuration template
├── main.py # Backend entry point
├── next.config.mjs # Next.js configuration
├── package.json # Frontend dependencies
└── pyproject.toml # Python dependenciesConfiguration
Environment Variables
Key environment variables you may need to configure:
ETHEREUM_RPC_URL: RPC endpoint for Ethereum network accessDATABASE_URL: Connection string for TimescaleDBREDIS_URL: Connection string for RedisNATS_URL: Connection string for NATS messagingJWT_SECRET: Secret for JWT token generationPRIVATE_KEY: Private key for transaction signing (development only)
Docker Compose Configuration
The docker-compose.yml file defines the infrastructure services:
- TimescaleDB: Port 5432
- Redis: Port 6379
- NATS: Port 4222
- Ray Dashboard: Port 8265
Running Tests
Backend Tests
# Run all tests
pytest
# Run specific test file
pytest tests/test_intent_manager.py
# Run with coverage
pytest --cov=platformFrontend Tests
cd app
npm testIntegration Tests
# Run integration tests that require infrastructure
pytest tests/integration/ --dockerDevelopment Workflow
1. Start Infrastructure
make docker-up2. Start Backend
# Terminal 1
python main.py3. Start Frontend
# Terminal 2
cd app
npm run dev4. Monitor Services
- Backend API: http://localhost:8000/docs
- Frontend: http://localhost:3000
- Ray Dashboard: http://localhost:8265
- TimescaleDB: Connect via your preferred PostgreSQL client
Common Development Tasks
Adding New API Endpoints
- Create a new route file in
platform/api/ - Define your Pydantic models in
platform/types/ - Add the route to the main FastAPI app
- Write tests in
tests/
Creating New Strategies
- Inherit from
BaseStrategyinplatform/strategies/ - Implement the required abstract methods
- Add configuration schema to your strategy
- Test with the strategy framework
Adding New Market Venues
- Create a new adapter inheriting from
VenueAdapter - Implement the required interface methods
- Add venue configuration to the system
- Update tests and documentation
Troubleshooting
Common Issues
Issue: make build fails with Rust compilation errors
Solution: Ensure your Rust toolchain is up to date (rustup update). Run cargo clean inside the src/ directory to clear any cached artifacts and try the build again.
Issue: Application starts but cannot connect to NATS or Redis
Solution: Verify the infrastructure containers are running (docker ps). Use docker logs <container_name> to check for any startup errors within the services themselves.
Issue: Ray actors are failing to start
Solution: The Ray dashboard is accessible at http://localhost:8265. This UI provides detailed logs for each actor and can help diagnose resource allocation issues.
Issue: Frontend shows “offline” or WebSocket does not connect
Solution: Check the browser’s developer console for errors. This is often a CORS issue if the frontend and backend are on different origins.
Getting Help
- Documentation: This documentation site
- Code Issues: Check the GitHub repository issues
- Community: Join our Discord or Slack channels
- Logs: Check service logs for detailed error information
Next Steps
Now that you have the platform running locally:
- Explore the API: Visit http://localhost:8000/docs to see all available endpoints
- Try the Frontend: Navigate to http://localhost:3000 to see the dashboard
- Read the Code: Start with the main entry points and follow the flow
- Build Something: Try creating a simple strategy or adding a new feature
Continue reading the documentation to understand:
- System Foundation - High-level architecture and design decisions
- Backend Engine - Core components and intent lifecycle
- Frontend Dashboard - UI architecture and real-time features
- Development Guide - Building trading strategies