$ show imsatoshi/GeneTrader
GeneTrader is a Python application that optimizes trading strategy hyperparameters for Freqtrade using genetic algorithms (default) and Optuna. It runs as a CLI tool (`main.py`) or a systemd daemon, generating candidate strategies, executing Freqtrade backtests via subprocess, and scoring candidates with a multi-component fitness function designed to prevent overfitting (minimum trades, drawdown cap, profit factor requirement, complexity penalty). The architecture is modular: `genetic_algorithm/` provides generic GA operators (crossover, mutation, tournament selection, diversity maintenance), `optimization/` contains optimizer base classes and implementations, `strategy/` handles backtest execution, walk-forward validation, and a selection bar (false-discovery diagnostic), and `scripts/` includes deployment workflows and utility scripts. The repo is hybridβit is a software application that performs data research for trading strategy optimization, with strong emphasis on statistical rigor (walk-forward, Monte Carlo robustness, selection bar). External dependencies include Freqtrade (Docker image), Binance (for pair listing and delisting data), and SSH/SCP for deployment. The codebase is well-structured with tests, but shows signs of personal project maintenance (script sprawl, hardcoded paths, potential overfitting in sample results).
The LLM identified 5 files worth highlighting for reuse:
Implements generic GA operators (tournament selection, uniform crossover, Gaussian mutation, diversity penalty) using numpy. Self-contained and could be extracted for any optimization problem requiring a GA. Demonstrates non-obvious skill in diversity maintenance via distance-based penalty to prevent premature convergence.
Abstract base class for optimizers (GA, Optuna) providing a common interface with methods like `optimize()`, `save_checkpoint()`, `load_checkpoint()`. Enables plugin-style addition of new optimizers. Reusable pattern for any optimization framework.
WalkForwardValidator class generates rolling, expanding, and anchored time-series splits for backtesting. Self-contained, uses pandas, and can be reused for any time-series model validation. Demonstrates clean implementation of a common financial validation pattern.
Implements the selection bar (Bailey and LΓ³pez de Prado) to estimate the expected best Sharpe ratio under no skill, providing a significance test for optimization results. Self-contained script that can be applied to any optimization producing a distribution of scores. Demonstrates non-obvious statistical technique for overfitting detection.
Reads a base Freqtrade strategy file, extracts all `IntParameter`, `DecimalParameter`, `RealParameter` definitions, and generates a new template with placeholder values. Self-contained pattern for parameterized code generation, reusable for any framework with similar declarative parameter definitions.