Files
docker-configs/backtest/PROJECT_STRUCTURE.md
2025-07-19 00:00:01 -05:00

4.3 KiB

Enhanced Emotional Damage Strategy - Project Structure

🎯 Quick Start

cd /home/will/docker/backtest/strategy/emotional-damage/
# Edit config.json to modify parameters
python3 run_strategy_with_config.py

📁 Directory Structure

Core Strategy Files

/strategy/emotional-damage/
├── config.json                              # 🔧 Configuration parameters
├── run_strategy_with_config.py              # 🚀 Main strategy runner
├── README_CONFIG.md                         # 📖 Usage documentation  
├── backtest_emotional_damage_enhanced_v2.py # 💎 Enhanced strategy implementation
├── backtest_emotional_damage.py             # 📚 Original strategy (reference)
└── enhanced-emotional-damage.txt            # 📝 Strategy description

Data & Database

/data/
├── stock_data.db                            # 💾 Main SQLite database
├── data_manager.py                          # 🔧 Database management
└── __init__.py

Reports & Results

/reports/                                    # 📊 Generated reports
├── enhanced_strategy_report_*.pdf           # 📈 PDF performance report
├── enhanced_trades_*.csv                    # 📋 Trade history CSV
└── detailed_trades_*.txt                    # 🔍 Detailed trade log

/results/                                    # 💾 Strategy objects  
└── enhanced_strategy_*.pkl                  # 🎯 Serialized strategy

Chat History

/chat_history/                               # 💬 Conversation logs
├── enhanced_strategy_configuration_session.json
├── enhanced_emotional_damage_full_conversation.json
└── ...

Infrastructure

/
├── Dockerfile                               # 🐳 Docker container setup
├── docker-compose.yml                       # 🐳 Docker orchestration
├── requirements.txt                         # 📦 Python dependencies
├── download_data.py                         # 📥 Data download scripts
├── download_qqq_data.py
└── create_fear_greed_index.py               # 🧮 F&G index creation

🎛️ Configuration System

Key Files:

  • config.json: All strategy parameters
  • run_strategy_with_config.py: Zero-token parameter testing
  • README_CONFIG.md: Complete usage guide

Configuration Categories:

  1. Strategy Parameters: Capital, thresholds, stop-loss
  2. Technical Indicators: RSI, MACD, SMA settings
  3. Output Settings: PDF, CSV, console output control
  4. Data Settings: Date ranges, ticker filters

📈 Strategy Features

Enhanced Capabilities:

  • Gradual Transitions: 4-step position changes over 4 weeks
  • Technical Filtering: RSI, MACD, SMA with 2/3 requirement
  • Stop-Loss Protection: 15% threshold with automatic QQQ replacement
  • Integer Shares: Realistic whole-share trading
  • Complete Audit Trail: F&G index, cash, portfolio state per trade

Risk Management:

  • Stop-Loss: Configurable threshold (default 15%)
  • Volatility Filtering: 30-day historical volatility calculation
  • Technical Validation: Multiple indicator confirmation
  • Gradual Execution: Reduced market impact

🔧 Maintenance

Regular Tasks:

  1. Data Updates: Run download scripts periodically
  2. Parameter Tuning: Modify config.json and test
  3. Report Review: Check /reports/ for latest results
  4. Backup: Save important .pkl files from /results/

File Cleanup:

  • Old reports are automatically cleaned during major updates
  • Keep latest strategy pickle files for analysis
  • Chat history preserved for reference

🚀 Usage Examples

Basic Run:

python3 run_strategy_with_config.py

Conservative Strategy:

{
  "fear_threshold": 30,
  "greed_threshold": 70,
  "stop_loss_threshold": 0.10
}

Aggressive Strategy:

{
  "fear_threshold": 20,
  "greed_threshold": 80,
  "required_indicators": 1
}

📊 Output Files

Every run generates:

  • PDF Report: Visual performance analysis
  • CSV Data: Machine-readable trade history
  • Detailed Log: Human-readable trade breakdown
  • Strategy Object: For advanced analysis

Last Updated: 2025-07-18 Status: Production Ready