Release Date: December 26, 2024
Focus: CLI Integration for Risk Management
v0.5.0 brings complete command-line integration for all risk management features introduced in v0.4.0. Every command (backtest, optimize, walkforward, compare) now supports stop losses, position sizing, and risk limits via CLI flags.
This release also fixes critical bugs from v0.4.0 and improves code quality with zero clippy warnings.
All commands now accept risk parameters:
# Backtest with 10% trailing stop
strataquant backtest --strategy sma --fast 20 --slow 50 \
--stop-type trailing --stop-pct 10.0
# Optimize with ATR stops
strataquant optimize --fast-range 20-50 --slow-range 50-100 \
--stop-type atr --atr-multiplier 2.0
# Walk-forward with stops
strataquant walkforward --train-ratio 0.7 \
--stop-type trailing --stop-pct 10.0
# Compare strategies with same stops
strataquant compare --stop-type trailing --stop-pct 5.0All commands support these stop types:
none- No stop loss (default)fixed- Fixed percentage from entrytrailing- Moves up with price, never downatr- ATR-based dynamic stopstime- Exit after N bars (backtest only)
# Trade with 50% of equity
--position-sizing fixed-pct --position-size 50.0
# Trade with fixed $10,000
--position-sizing fixed-dollar --position-size 10000# Stop trading at -30% drawdown
--max-drawdown 30.0--stop-type <type> Stop loss type: none, fixed, trailing, atr
--stop-pct <percent> Percentage for fixed/trailing (default: 10.0)
--atr-multiplier <mult> ATR multiplier (default: 2.0)
--atr-period <period> ATR period (default: 14)
--position-sizing <type> fixed-pct, fixed-dollar (default: fixed-pct)
--position-size <value> Size value (default: 100.0)
--max-drawdown <percent> Drawdown threshold (default: 50.0)
--time-limit <bars> Time-based stop (default: 100)
All tests conducted on BTC/USDT daily data (Sept 2019 - Dec 2024).
Baseline (no stops):
Return: 429.25%
Max DD: -37.37%
Sharpe: 0.88
Trades: 18
With 10% Trailing Stop:
Return: 418.26% (-2.6% from baseline)
Max DD: -36.49% (slightly better)
Sharpe: 0.88 (unchanged)
Trades: 52 (34 additional stop exits)
With ATR Stop (2x14):
Return: 463.49% (+8% from baseline!)
Max DD: -33.09% (best risk control)
Sharpe: 0.91 (improved)
Trades: 18
Key Finding: ATR stops outperform fixed percentage stops for crypto.
With 50% Position Sizing:
Return: 158.37% (linear scaling confirmed)
Max DD: -35.20%
Trades: 22
-
Risk limits applied incorrectly
- v0.4.0 applied default 30% drawdown threshold even when user didn't set it
- Fixed: Risk limits only applied when explicitly set
- Impact: Baseline results now match programmatic API
-
Drawdown check off-by-one
- Used
<instead of<=for threshold comparison - Fixed: Now uses
<=for correct threshold behavior
- Used
-
Results mismatch
- CLI showed different results than programmatic API
- Fixed: Both now produce identical results
All warnings fixed with proper solutions (no #[allow] suppressions):
Before v0.5.0:
warning: this function has too many arguments (14/7)
warning: this function has too many arguments (10/7)
warning: field assignment outside of initializer
After v0.5.0:
✓ Zero warnings
✓ All functions ≤7 parameters
✓ Proper struct initialization
Introduced RiskConfig struct:
struct RiskConfig {
stop_type: String,
stop_pct: f64,
atr_multiplier: f64,
atr_period: usize,
time_limit: usize,
position_sizing: String,
position_size: f64,
max_drawdown: f64,
}Simplified function signatures:
run_backtest: 14 params → 7 paramsrun_optimization: 10 params → 6 paramsrun_walkforward: 8 params → 4 paramsrun_comparison: 7 params → 3 params
pub fn sweep_sma_periods_with_stops(
&self,
fast_range: (usize, usize),
slow_range: (usize, usize),
step: usize,
stop_loss: StopLossMethod,
) -> Vec<OptimizationResult>Tests all parameter combinations with specified stop loss.
pub fn run_with_stops(
&self,
train_ratio: f64,
stop_loss: StopLossMethod
) -> WalkForwardResultOptimizes and validates with stop loss enabled.
# Test different stop configurations
strataquant optimize --fast-range 20-50 --slow-range 50-100 \
--stop-type trailing --stop-pct 10.0
# Compare with ATR stops
strataquant optimize --fast-range 20-50 --slow-range 50-100 \
--stop-type atr --atr-multiplier 2.0# Walk-forward validation with trailing stops
strataquant walkforward --train-ratio 0.7 \
--stop-type trailing --stop-pct 10.0# Compare strategies with different stops
strataquant compare --stop-type none
strataquant compare --stop-type trailing --stop-pct 5.0
strataquant compare --stop-type trailing --stop-pct 10.0
strataquant compare --stop-type atr --atr-multiplier 2.0# 50% position sizing + 10% trailing stop + 30% drawdown limit
strataquant backtest --strategy sma --fast 20 --slow 50 \
--position-sizing fixed-pct --position-size 50.0 \
--stop-type trailing --stop-pct 10.0 \
--max-drawdown 30.0- Zero overhead from CLI integration
- Same speed as programmatic API
- Parallel optimization fully functional
- Memory usage unchanged
None. All v0.4.0 functionality preserved.
- New CLI flags are optional with sensible defaults
- Programmatic API unchanged
- Existing scripts continue to work
No changes required.
All v0.4.0 code continues to work. CLI flags are additive:
# v0.4.0 command still works
strataquant backtest --strategy sma --fast 20 --slow 50
# v0.5.0 adds optional risk parameters
strataquant backtest --strategy sma --fast 20 --slow 50 \
--stop-type trailing --stop-pct 10.0Follow v0.4.0 migration guide first, then upgrade to v0.5.0.
-
Long-only strategies
- Short positions not supported
- Planned for future release
-
Single asset
- Multi-asset portfolios planned for v0.7.0
- Will support BTC, ETH, LTC, BCH, SOL
-
Kelly criterion
- Not yet implemented
- Planned for v0.6.0
-
No GUI
- Command-line only (by design)
- Focus on automation and scripting
- Kelly criterion position sizing
- Volatility-based position sizing
- Multiple timeframe support
- Advanced indicator library
- RSI, MACD, Bollinger Bands
- Portfolio support for BTC, ETH, LTC, BCH, SOL
- Correlation analysis
- Portfolio optimization
- Asset allocation strategies
- Rust 1.70+
- 100 MB disk space
- Internet connection (for data download)
git clone https://github.com/ChronoCoders/strataquant.git
cd strataquant
git checkout v0.5.0
cargo build --release# Download data
cargo run --release --bin strataquant -- download
# Run backtest with stops
cargo run --release --bin strataquant -- backtest \
--strategy sma --fast 20 --slow 50 \
--stop-type trailing --stop-pct 10.0All commands tested and validated:
# Build
cargo build --release
# Verify zero warnings
cargo clippy
# Test all commands
cargo run --release --bin strataquant -- backtest --strategy sma --fast 20 --slow 50
cargo run --release --bin strataquant -- backtest --strategy sma --fast 20 --slow 50 --stop-type trailing --stop-pct 10.0
cargo run --release --bin strataquant -- optimize --fast-range 20-50 --slow-range 50-100 --stop-type atr --atr-multiplier 2.0
cargo run --release --bin strataquant -- walkforward --train-ratio 0.7 --stop-type trailing --stop-pct 10.0
cargo run --release --bin strataquant -- compare --stop-type trailing --stop-pct 5.0Developer: Altug Tatlisu (ChronoCoders)
Company: Distributed Systems Labs, LLC
Repository: https://github.com/ChronoCoders/strataquant
License: MIT
- Issues: https://github.com/ChronoCoders/strataquant/issues
- Discussions: https://github.com/ChronoCoders/strataquant/discussions
StrataQuant remains committed to honest backtesting:
- Real drawdowns shown
- Execution costs included
- No cherry-picking
- Walk-forward validation
- Risk management first
"Truth in crypto backtesting."
Full Changelog: CHANGELOG.md
Previous Release: v0.4.0
Repository: github.com/ChronoCoders/strataquant