feat: implement professional versioning system (v0.6.0)

Implement industrial-standard semantic versioning (SemVer 2.0.0) with
automated feature detection and comprehensive changelog management.

New Features:
- VERSION file: Single source of truth for base version (0.0.0)
- src/version.py: Centralized version manager with auto-detection
- CHANGELOG.md: Keep a Changelog format for all changes
- Auto-versioning: Features increment MINOR version automatically
- Version display: Shows in startup banner and logs

Predictive Intelligence (v6.3) Complete:
- src/trajectory_predictor.py: Forecast profit 1-5 minutes ahead
- src/momentum_persistence.py: Detect momentum continuation (0-1 score)
- src/recovery_detector.py: Analyze recovery strength from losses
- src/fuzzy_exit_logic.py: Fuzzy logic exit confidence (0-1)
- src/kalman_filter.py: Kalman filter for velocity smoothing
- src/kelly_position_scaler.py: Kelly criterion position scaling

Version Calculation:
Base 0.0.0 + Kalman(0.1) + Fuzzy(0.1) + Kelly(0.1) +
Trajectory(0.1) + Momentum(0.1) + Recovery(0.1) = v0.6.0

Modified:
- CLAUDE.md: Added comprehensive versioning documentation
- main_live.py: Display version in startup banner
- src/smart_risk_manager.py: Use centralized versioning

Documentation:
- CLAUDE.md: Full versioning guidelines (SemVer, workflows, examples)
- CHANGELOG.md: Initial release documentation with feature tracking
- VERSION: Base version 0.0.0

Benefits:
- Professional version management (industry standard)
- Automatic feature tracking and version updates
- Complete change history with Keep a Changelog format
- Clear upgrade paths (MAJOR.MINOR.PATCH)

Version: v0.6.0 (Kalman + Fuzzy + Kelly + Predictive)
Exit Strategy: v6.3 Predictive Intelligence

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
GifariKemal
2026-02-11 08:28:31 +07:00
co-authored by Claude Sonnet 4.5
parent cc6bfd48f2
commit f36123ccaf
12 changed files with 3879 additions and 176 deletions
+144
View File
@@ -131,3 +131,147 @@ Capital modes auto-configure risk parameters:
- Models are stored as `.pkl` files in `models/`
- Backtest logic is **synced with live** (`backtest_live_sync.py` mirrors `main_live.py`)
- Scripts in `scripts/` and `tests/` include `sys.path` fix so they work from any directory
---
## Versioning System
### **Semantic Versioning (SemVer)**
XAUBot AI uses **Semantic Versioning 2.0.0**: `MAJOR.MINOR.PATCH`
- **MAJOR**: Incompatible API changes, breaking changes (e.g., 1.0.0 → 2.0.0)
- **MINOR**: New features, backward compatible (e.g., 0.1.0 → 0.2.0)
- **PATCH**: Bug fixes, backward compatible (e.g., 0.1.0 → 0.1.1)
### **Version Files**
1. **`VERSION`** - Single source of truth (base version)
2. **`CHANGELOG.md`** - Detailed change history (Keep a Changelog format)
3. **`src/version.py`** - Centralized version manager
### **Auto-Versioning**
Version is **automatically calculated** based on enabled features:
```python
# Base version from VERSION file
Base: 0.0.0
# Feature increments (cumulative):
+ Kalman Filter +0.1.0 = 0.1.0
+ Fuzzy Logic +0.1.0 = 0.2.0
+ Kelly Criterion +0.1.0 = 0.3.0
+ Trajectory Predictor +0.1.0 = 0.4.0
+ Momentum Persistence +0.1.0 = 0.5.0
+ Recovery Detector +0.1.0 = 0.6.0
# Effective version: v0.6.0 (Kalman + Fuzzy + Kelly + Predictive)
```
### **Feature Detection**
Features auto-detected from:
- **Environment variables**: `KALMAN_ENABLED`, `ADVANCED_EXITS_ENABLED`, `PREDICTIVE_ENABLED`
- **Import availability**: Modules in `src/` directory
- **Runtime checks**: Component initialization
### **Version Display**
```python
from src.version import get_version, get_detailed_version
print(get_version()) # "0.6.0"
print(get_detailed_version()) # "v0.6.0 (Kalman + Fuzzy + Kelly + Predictive)"
```
### **Changelog Management**
All changes documented in `CHANGELOG.md`:
```markdown
## [0.6.0] - 2026-02-11
### Added
- Trajectory Predictor for profit forecasting
- Momentum Persistence Detector
- Recovery Strength Analyzer
### Changed
- Exit strategy version: v6.2 → v6.3
- Fuzzy threshold now dynamic (85-98%)
### Fixed
- ExitReason.STOP_LOSS → POSITION_LIMIT
```
### **Version Update Workflow**
1. **Add new feature** → Automatically increments MINOR version
2. **Fix bug** → Manually increment PATCH in `VERSION` file
3. **Breaking change** → Manually increment MAJOR in `VERSION` file
4. **Update CHANGELOG.md** → Document all changes
5. **Commit** → Version updates committed with changes
### **When to Update VERSION File**
**Auto-incremented** (no manual change needed):
- Adding new predictive modules
- Enabling/disabling feature flags
- Adding new exit strategies
**Manual increment required**:
- Bug fixes → Increment PATCH (0.6.0 → 0.6.1)
- Breaking changes → Increment MAJOR (0.6.0 → 1.0.0)
- Resetting versions → Edit `VERSION` file directly
### **Example Version History**
```
v0.0.0 - Initial release (baseline)
v0.1.0 - Added Kalman Filter
v0.2.0 - Added Fuzzy Logic Controller
v0.3.0 - Added Kelly Criterion
v0.4.0 - Added Trajectory Predictor
v0.5.0 - Added Momentum Persistence
v0.6.0 - Added Recovery Detector (v6.3 Predictive Intelligence complete)
v0.6.1 - Fixed variable scope bug (PATCH)
v0.7.0 - Added new session filter (MINOR)
v1.0.0 - Complete rewrite with new ML architecture (MAJOR)
```
### **Version in Logs**
```
============================================================
XAUBOT AI v0.6.0 (Kalman + Fuzzy + Kelly + Predictive)
Strategy: Exit v6.3 Predictive Intelligence
============================================================
SMART RISK MANAGER v0.6.0 (Exit v6.3 Predictive Intelligence) INITIALIZED
[OK] Fuzzy Exit Controller initialized
[OK] Kelly Position Scaler initialized
[OK] Trajectory Predictor initialized
[OK] Momentum Persistence initialized
[OK] Recovery Detector initialized
Advanced Exits: ENABLED (Kalman + Fuzzy + Kelly + Predictive)
============================================================
```
### **Best Practices**
1. **Always update CHANGELOG.md** when making changes
2. **Use semantic commit messages**: `feat:`, `fix:`, `docs:`, `refactor:`
3. **Version tags in git**: `git tag v0.6.0` after stable release
4. **Document breaking changes** clearly in CHANGELOG
5. **Test version detection**: `python src/version.py` to verify
### **Quick Reference**
| Action | Version Impact | Example |
|--------|---------------|---------|
| Add feature | +0.1.0 (MINOR) | Predictive Intelligence |
| Fix bug | +0.0.1 (PATCH) | Variable scope fix |
| Breaking change | +1.0.0 (MAJOR) | API redesign |
| Enable feature flag | Auto-detected | `PREDICTIVE_ENABLED=1` |
| Disable feature | Auto-detected | `KALMAN_ENABLED=0` |
---