Strategy trait and support event-driven backtesting.
Available strategies
Buy and hold
Simple long-term investment strategy that purchases and holds assets
Moving average crossover
Trend-following strategy based on short and long-term moving averages
Momentum
Rides trends by measuring price momentum over a lookback period
Mean reversion
Statistical arbitrage strategy that trades price deviations from the mean
RSI
Oscillator-based strategy using Relative Strength Index
Common features
All built-in strategies share these capabilities:Event-driven architecture
Strategies process market events in real-time and generate trading signals based on configurable parameters:Configurable parameters
Every strategy accepts custom parameters through theStrategyConfig:
Position sizing
Control risk exposure with position size limits:- position_size - Percentage of capital to deploy (0.0 to 1.0)
- max_position_size - Maximum position size cap (mean reversion only)
Performance metrics
All strategies track comprehensive performance metrics:Implementation details
Strategies are located incrates/gb-types/src/strategy.rs and implement the Strategy trait:
Quick start example
Here’s how to use a built-in strategy:Next steps
Create custom strategies
Learn how to build your own trading strategies
Backtest strategies
Run backtests with built-in strategies