Repository navigation
Omnibot v2.4
Omnibot v2.4 Release Notes
Overview
Version 2.4 is a critical security and stability update that fixes database authentication issues present in v2.3 and adds comprehensive safety features for live trading migration.
🔒 Security Fixes
| Issue | v2.3 | v2.4 |
|---|---|---|
| Database password handling | Hardcoded placeholder your_password caused authentication failures |
Dynamic password generation with openssl rand -base64 32 |
| Environment variable conflicts | Duplicate DATABASE_URL entries in .bashrc |
Single source of truth, validated setup |
| Systemd service configuration | Used $DATABASE_URL variable expansion |
Hardcoded password in service file to prevent env leakage |
| Password persistence | No guidance on password management | Clear instructions to save and protect generated passwords |
🗄️ Database Improvements
v2.3
# Prone to authentication errors
export DATABASE_URL='postgresql://omnibot:your_password@localhost:5432/omnibot_db'v2.4
# Generate secure unique password
openssl rand -base64 32
# Example: xK9#mP2$vL5@nQ8*wR4&jH7(bU3!cY6%
# Use in both .bashrc AND systemd service
export DATABASE_URL='postgresql://omnibot:xK9#mP2$vL5@nQ8*wR4&jH7(bU3!cY6%@localhost:5432/omnibot_db'Changes:
- Added password generation step in Stage 2.3
- PostgreSQL user creation uses generated password
- Service file hardcodes password (no variable expansion)
- Validation commands to verify connectivity before starting bot
🛡️ Live Trading Safety (New in v2.4)
v2.3 had no live trading guidance. v2.4 adds:
| Feature | Description |
|---|---|
| Paper trading verification | 2+ week profitable history required |
| Graduated position sizing | 50% → 75% → 100% over 3 weeks |
| Daily loss limits | Auto-shutdown at configurable loss threshold |
| Live mode warnings | 10-second countdown with cancel option |
| Emergency liquidation | Ctrl+C or service stop triggers position close |
| API key separation | Distinct ALPACA_API_KEY_ENC_LIVE variables |
New Live Trading Code
# TradingEngineV24.__init__
if not secure_settings.alpaca_paper:
print("🚨 LIVE TRADING MODE ACTIVATED")
# 10-second cancel window
# 50% position reduction
# Daily loss circuit breaker📁 File Structure Changes
v2.3 v2.4
─────────────────────────────────────────────────────────────
omnibot/ omnibot/
├── src/ ├── src/
│ ├── config/ │ ├── config/
│ │ ├── settings.py │ │ ├── settings.py (unchanged)
│ │ └── __init__.py │ │ └── __init__.py
│ ├── risk/ │ ├── risk/
│ │ ├── manager.py │ │ ├── manager.py (unchanged)
│ │ └── __init__.py │ │ └── __init__.py
│ ├── ml/ │ ├── ml/
│ │ ├── regime_detector.py │ │ ├── regime_detector.py (unchanged)
│ │ ├── signal_enhancer.py │ │ ├── signal_enhancer.py (unchanged)
│ │ └── __init__.py │ │ └── __init__.py
│ ├── data/ │ ├── data/
│ │ ├── hybrid_client.py │ │ ├── hybrid_client.py (unchanged)
│ │ └── __init__.py │ │ └── __init__.py
│ ├── database/ │ ├── database/
│ │ ├── manager.py │ │ ├── manager.py (unchanged)
│ │ └── __init__.py │ │ └── __init__.py
│ ├── utils/ │ ├── utils/
│ │ ├── monitoring.py │ │ ├── monitoring.py (unchanged)
│ │ └── __init__.py │ │ └── __init__.py
│ ├── trading/ │ ├── trading/
│ │ ├── engine.py │ │ ├── engine.py ← LIVE SAFETY ADDED
│ │ └── __init__.py │ │ └── __init__.py
│ ├── main.py │ ├── main.py (unchanged)
│ └── __init__.py │ └── __init__.py
├── secrets/ ├── secrets/
│ ├── .key │ ├── .key
│ └── encrypt_value.py │ └── encrypt_value.py
├── logs/ ├── logs/
├── data/ ├── data/
└── deploy/ └── deploy/
└── old_v2.2_archive/ (cleanup)
⚙️ Configuration Differences
Environment Variables
| Variable | v2.3 | v2.4 |
|---|---|---|
DATABASE_URL |
postgresql://omnibot:your_password@... |
postgresql://omnibot:[GENERATED_PASSWORD]@... |
ALPACA_PAPER |
'true' or 'false' |
Same, but with live migration guide |
OMNIBOT_RISK_MODE |
❌ Not present | ✅ CONSERVATIVE/MODERATE/AGGRESSIVE |
Systemd Service
v2.3 (broken):
Environment="DATABASE_URL=$(echo $DATABASE_URL)"v2.4 (fixed):
Environment="DATABASE_URL=postgresql://omnibot:actual_password@localhost:5432/omnibot_db"📊 Monitoring & Debugging
New Validation Commands (v2.4)
# Verify database before starting
sudo -u postgres psql -d omnibot_db -c "SELECT COUNT(*) FROM trades;"
# Check for duplicate env vars
grep -c "DATABASE_URL" ~/.bashrc # Should be 1
# Test live API without trading
python3 -c "from alpaca.trading.client import TradingClient; ..."Enhanced Logging
| Event | v2.3 | v2.4 |
|---|---|---|
| Live mode start | Standard startup | 10-second countdown with cancel |
| Position reduction | Not logged | ⚠️ LIVE SAFETY: Reduced position from X to Y |
| Daily loss hit | Standard log | 🚨 DAILY LOSS LIMIT HIT: $XXX.XX + auto-shutdown |
| Emergency liquidation | Basic message | 🚨 EMERGENCY LIQUIDATION with position details |
🔄 Upgrade Path
From v2.2 → v2.3 (Old)
- Basic file migration
- No database password guidance
- Prone to auth failures
From v2.2 → v2.4 (Recommended)
- Generate secure password:
openssl rand -base64 32 - Create PostgreSQL user with generated password
- Update
.bashrc(single DATABASE_URL entry) - Hardcode password in systemd service
- Verify connectivity:
psql -c "SELECT COUNT(*) FROM trades;" - Deploy with validated configuration
🐛 Bug Fixes
| Bug | v2.3 | v2.4 Fix |
|---|---|---|
FATAL: password authentication failed |
Common due to placeholder password | Password generation + validation steps |
relation "trades" does not exist |
Database not initialized | Pre-start connectivity test |
| Service restart loop | Env var expansion failure | Hardcoded values in systemd |
| Duplicate env vars | Silent overwriting | grep validation in setup |
| No live trading safety | N/A | Comprehensive safety framework |
📚 Documentation
| Guide | v2.3 | v2.4 |
|---|---|---|
| Fresh install | Basic | Enhanced with password generation |
| Upgrade guide | v2.2 → v2.3 | v2.2 → v2.4 (v2.3 skipped) |
| Troubleshooting | Basic table | Expanded with password checks |
| Emergency procedures | N/A | Stop, liquidate, revert commands |
🎯 Quick Diff Summary
# Key Changes: v2.3 → v2.4
+ Added: Secure password generation (openssl)
+ Added: Database connectivity validation
+ Added: Live trading safety framework
+ Added: Graduated position sizing
+ Added: Daily loss circuit breakers
+ Added: Emergency stop procedures
+ Added: Paper ↔ Live switch guide
~ Fixed: Systemd service hardcodes DATABASE_URL
~ Fixed: Single DATABASE_URL in .bashrc
~ Fixed: PostgreSQL auth with generated passwords
Migration Recommendation
Do NOT install v2.3. Use v2.4 directly to avoid known database authentication issues.
# For new users
git checkout v2.4
# For v2.2 users upgrading
# Follow Part 2: Upgrade Guide (v2.2 → v2.4)Full documentation: See Omnibot-v2.4-Complete-Setup-Guide.pdf