A comprehensive, full-stack trading strategy development and backtesting platform with real-time monitoring capabilities. Build, test, and deploy trading strategies without coding using our visual strategy builder.
- Features
- Architecture
- Installation
- Quick Start
- Strategy Builder Guide
- Performance Analytics
- Real-time Monitoring
- API Documentation
- Configuration
- Contributing
- License
- Drag-and-drop interface for creating trading strategies
- No coding required - build complex strategies visually
- 20+ technical indicators (RSI, MACD, Bollinger Bands, Moving Averages)
- Custom conditions and logic (AND, OR, crossovers, thresholds)
- Risk management tools (stop loss, take profit, position sizing)
- Comprehensive backtesting on historical data
- Enhanced trading metrics including:
- Average trade duration
- Largest win/loss percentages
- Portfolio turnover rate
- Risk-adjusted returns (Sharpe, Sortino, Calmar ratios)
- Risk analysis with drawdown monitoring and VaR calculations
- Visual performance reports with heatmaps and distribution analysis
- Live strategy monitoring with WebSocket connections
- Real-time signal generation and trade execution simulation
- Performance tracking with live P&L updates
- Strategy health monitoring and alerts
- Multi-source data integration (Yahoo Finance, Alpha Vantage, Polygon.io)
- Bulk data download with parallel processing
- Data quality analysis and validation
- CSV upload support for custom datasets
- Advanced caching for optimal performance
├── frontend/ # React.js frontend application
│ ├── src/
│ │ ├── components/ # React components
│ │ │ ├── StrategyBuilder/ # Visual strategy builder
│ │ │ ├── PerformanceAnalytics/ # Analytics dashboard
│ │ │ ├── RealtimeDashboard/ # Real-time monitoring
│ │ │ └── BulkDownload/ # Data management
│ │ ├── services/ # API and WebSocket services
│ │ └── utils/ # Utility functions
│ └── public/ # Static assets
│
├── backend/ # FastAPI backend application
│ ├── app/
│ │ ├── routers/ # API route handlers
│ │ │ ├── strategy.py # Strategy management
│ │ │ ├── realtime_strategy.py # Real-time operations
│ │ │ ├── enhanced_data.py # Data management
│ │ │ └── websocket.py # WebSocket handling
│ │ ├── services/ # Business logic services
│ │ │ ├── strategy_engine.py # Strategy execution
│ │ │ ├── realtime_strategy_engine.py # Real-time engine
│ │ │ ├── performance_analytics.py # Analytics engine
│ │ │ └── technical_indicators.py # Technical analysis
│ │ └── models/ # Data models
│ └── requirements.txt # Python dependencies
│
└── docs/ # Documentation
- Node.js (v16+)
- Python (3.8+)
- Git
- Clone the repository
git clone https://github.com/yourusername/trading-strategy-platform.git
cd trading-strategy-platform- Set up Python environment
cd backend
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate- Install Python dependencies
pip install -r requirements.txt- Start the backend server
python -m uvicorn app.main:app --reload --port 8000- Install Node.js dependencies
cd frontend
npm install- Start the development server
npm start- Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
-
Navigate to Strategy Builder in the web interface
-
Select technical indicators from the left panel:
- Add RSI indicator
- Set period to 14
-
Create entry condition:
- RSI < 30 (oversold condition)
- Connect to BUY action
-
Create exit condition:
- RSI > 70 (overbought condition)
- Connect to SELL action
-
Set risk management:
- Stop loss: 2%
- Take profit: 4%
-
You can also use example strategies like RSI or SMI crossover
-
Save your strategy
- Select symbol (e.g., AAPL, BTC-USD)
- Choose date range (e.g., 2022-01-01 to 2024-01-01)
- Click "Run Backtest"
- Review performance metrics:
- Total return, Sharpe ratio, maximum drawdown
- Trade analysis and risk metrics
- Visual performance charts
- Click "Deploy Live"
- Configure real-time parameters:
- Position size, maximum positions
- Risk limits
- Monitor in Real-time Dashboard:
- Live signals and trade execution
- Performance tracking
- Strategy health monitoring
| Indicator | Description | Parameters |
|---|---|---|
| RSI | Relative Strength Index | Period (default: 14) |
| SMA | Simple Moving Average | Period (default: 20) |
| EMA | Exponential Moving Average | Period (default: 20) |
| MACD | Moving Average Convergence Divergence | Fast: 12, Slow: 26, Signal: 9 |
| Bollinger Bands | Volatility-based bands | Period: 20, Std Dev: 2 |
| Stochastic | Momentum oscillator | %K: 14, %D: 3 |
| Williams %R | Momentum indicator | Period: 14 |
| ATR | Average True Range | Period: 14 |
| Volume | Trading volume analysis | - |
| Price Action | OHLC price data | - |
- Comparison:
>,<,>=,<=,==,!= - Logic:
AND,OR,NOT - Crossover:
crosses_above,crosses_below - Threshold:
above,below,between
Entry: RSI(14) < 40
Exit: RSI(14) > 60
Stop Loss: 2%
Take Profit: 4%
Entry: SMA(10) crosses above SMA(20)
Exit: SMA(10) crosses below SMA(20)
Stop Loss: 3%
- Average Trade Duration: Mean time positions are held
- Largest Win/Loss: Best and worst individual trade performance
- Turnover Rate: Annual portfolio turnover percentage
- Risk-Adjusted Returns: Sharpe, Sortino, and Calmar ratios
- Total Return: Overall strategy performance
- Win Rate: Percentage of profitable trades
- Profit Factor: Gross profit ÷ gross loss
- Maximum Drawdown: Largest peak-to-trough decline
- Volatility: Standard deviation of returns
- 95% VaR: Maximum expected loss 95% of the time
- 99% VaR: Maximum expected loss 99% of the time
- Historical simulation and parametric methods
- Maximum drawdown: Worst loss from peak
- Drawdown duration: Time to recover from losses
- Underwater curve: Visual representation of drawdown periods
- Portfolio Value Timeline: Track growth over time
- Return Distribution Heatmap: Monthly performance patterns
- Drawdown Analysis Chart: Visualize risk periods
- P&L Distribution: Histogram of trade returns
- Trade Duration Analysis: Performance by holding period
- Rolling Risk Metrics: Dynamic risk measurement
- Live Strategy Execution: Strategies run continuously on market data
- WebSocket Connections: Real-time updates for all connected clients
- Signal Generation: Live buy/sell signals based on market conditions
- Trade Simulation: Paper trading with realistic execution
- Performance Tracking: Real-time P&L and portfolio updates
// Connect to WebSocket
const ws = new WebSocket('ws://localhost:8000/ws');
// Subscribe to strategy updates
ws.send(JSON.stringify({
type: 'subscribe_strategy',
strategy_id: 'your_strategy_id'
}));
// Handle real-time events
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
switch(data.type) {
case 'signal_generated':
// Handle new trading signals
console.log('New signal:', data.data);
break;
case 'trade_executed':
// Handle trade executions
console.log('Trade executed:', data.data);
break;
case 'performance_update':
// Handle performance metrics updates
console.log('Performance update:', data.data);
break;
}
};- Deploy from Backtest: One-click deployment from successful backtests
- Configure Parameters: Set position sizing and risk limits
- Monitor Health: Real-time strategy status and error handling
- Stop/Start Control: Manual control over strategy execution
# Create strategy
POST /api/strategy/create
{
"name": "RSI Strategy",
"rules": [...],
"risk_management": {...}
}
# Test strategy
POST /api/strategy/test?symbol=AAPL&start_date=2023-01-01
{...strategy_config...}
# Run backtest
POST /api/strategy/backtest
{...strategy_config...}# Start real-time strategy
POST /api/realtime/start-realtime-strategy
{
"strategy_name": "Live RSI Strategy",
"symbol": "AAPL",
"initial_capital": 100000
}
# Get active strategies
GET /api/realtime/active-realtime-strategies
# Stop strategy
POST /api/realtime/stop-realtime-strategy/{strategy_id}# Bulk download
POST /api/enhanced-data/bulk-download
{
"symbols": ["AAPL", "GOOGL", "MSFT"],
"period": "1y",
"interval": "1d"
}
# Get job status
GET /api/enhanced-data/jobs/{job_id}
# Data quality report
GET /api/enhanced-data/data/analyze/{symbol}For production deployment, implement authentication:
# Add to backend/app/middleware/auth.py
from fastapi import HTTPException, Depends
from fastapi.security import HTTPBearer
security = HTTPBearer()
async def verify_token(token: str = Depends(security)):
# Implement your authentication logic
if not is_valid_token(token):
raise HTTPException(status_code=401, detail="Invalid token")
return get_user_from_token(token)Create .env files for configuration:
REACT_APP_ENABLE_REAL_TIME=true REACT_APP_ENABLE_BULK_DOWNLOAD=true REACT_APP_MAX_SYMBOLS_PER_STRATEGY=10
### Data Source Configuration
Configure multiple data sources in `backend/app/config/data_sources.py`:
```python
DATA_SOURCES = {
"yahoo_finance": {
"name": "Yahoo Finance",
"free": True,
"rate_limit": 2000, # requests per hour
"intervals": ["1m", "5m", "15m", "30m", "1h", "1d", "1wk", "1mo"]
},
"alpha_vantage": {
"name": "Alpha Vantage",
"requires_api_key": True,
"rate_limit": 500, # requests per day
"intervals": ["1min", "5min", "15min", "30min", "60min", "daily"]
}
}
# Install production server
pip install gunicorn
# Start with Gunicorn
gunicorn app.main:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000# Build production bundle
npm run build
# Serve with nginx or host on Vercel/Netlify
npm install -g serve
serve -s build -l 3000Add custom technical indicators:
# backend/app/services/custom_indicators.py
def custom_momentum(prices: List[float], period: int = 10) -> List[float]:
"""Custom momentum indicator implementation"""
momentum = []
for i in range(len(prices)):
if i >= period:
mom = (prices[i] - prices[i - period]) / prices[i - period] * 100
momentum.append(mom)
else:
momentum.append(0)
return momentumCreate reusable strategy templates:
# backend/app/templates/strategy_templates.py
RSI_MEAN_REVERSION = {
"name": "RSI Mean Reversion",
"description": "Buy oversold, sell overbought conditions",
"rules": [
{
"name": "Buy Oversold",
"signal_type": "buy",
"conditions": [
{
"indicator": "RSI",
"parameters": {"period": 14},
"operator": "<",
"value": 30
}
]
}
],
"risk_management": {
"stop_loss_percent": 2.0,
"take_profit_percent": 4.0
}
}- Async processing for data downloads
- Caching for frequently accessed data
- Database indexing for query optimization
- Connection pooling for external APIs
- React.memo for component optimization
- useMemo/useCallback for expensive calculations
- Lazy loading for large datasets
- WebSocket connection management
# Check if backend is running
curl http://localhost:8000/health
# Verify WebSocket endpoint
wscat -c ws://localhost:8000/ws# Check API limits
curl http://localhost:8000/api/enhanced-data/data-sources
# Verify symbol format
curl "http://localhost:8000/api/data/market-data?symbol=AAPL&period=1mo"# Validate strategy configuration
curl -X POST http://localhost:8000/api/strategy/validate \
-H "Content-Type: application/json" \
-d '{"name": "Test", "rules": [...]}'Enable debug logging:
# backend/app/config/logging.py
import logging
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)- Fork the repository
- Create feature branch
git checkout -b feature/amazing-feature- Make changes and test
# Backend tests
cd backend && pytest
# Frontend tests
cd frontend && npm test- Commit changes
git commit -m "Add amazing feature"- Push to branch
git push origin feature/amazing-feature- Open Pull Request
- Black for code formatting
- flake8 for linting
- mypy for type checking
black app/
flake8 app/
mypy app/- Prettier for code formatting
- ESLint for linting
npm run format
npm run lint- Write tests for new features
- Update documentation for API changes
- Follow existing code patterns
- Add type hints for Python code
- Use meaningful commit messages
This project is licensed under the MIT License - see the LICENSE file for details.
- Technical Analysis Library - TA-Lib for technical indicators
- Financial Data - Yahoo Finance, Alpha Vantage APIs
- UI Components - Material-UI for React components
- WebSocket - FastAPI WebSocket support
- Visualization - Recharts for performance charts
- Documentation: Full Documentation
- Email: pratyushyadav0106@gmail.com
- Options trading support
- Portfolio optimization algorithms
- Machine learning indicators
- Advanced order types (limit, stop-limit)
- Multi-asset strategies (stocks + crypto + forex)
- Social trading features
- Mobile app (React Native)
- Cloud deployment templates
- AI-powered strategy generation
- Institutional features (prime brokerage integration)
- Advanced risk management (portfolio-level risk)
- Real broker integration (Interactive Brokers, TD Ameritrade)