docs: add development mode documentation

Add comprehensive development mode documentation to README.md, API_REFERENCE.md, and CLAUDE.md:

README.md:
- New "Development Mode" section after Configuration
- Quick start guide with environment variables
- Explanation of DEV vs PROD mode behavior
- Mock AI behavior and stock rotation details
- Environment variables reference
- Use cases and limitations

API_REFERENCE.md:
- New "Deployment Mode" section after health check
- Response format with deployment_mode fields
- DEV mode behavior explanation
- Health check example with deployment fields
- Use cases for testing and CI/CD

CLAUDE.md:
- New "Development Mode" subsection in Important Implementation Details
- Deployment modes overview
- DEV mode characteristics
- Implementation details with file references
- Testing commands and mock behavior notes

All sections explain:
- DEPLOYMENT_MODE environment variable (PROD/DEV)
- PRESERVE_DEV_DATA flag for dev data persistence
- Mock AI provider with deterministic stock rotation
- Separate dev database and data paths
- Use cases for development and testing
This commit is contained in:
2025-11-01 11:33:58 -04:00
parent 6e9c0b4971
commit 6905a10f05
3 changed files with 152 additions and 0 deletions

View File

@@ -365,6 +365,71 @@ Edit `configs/default_config.json`:
---
## 🛠️ Development Mode
AI-Trader supports a development mode that mocks AI API calls for testing without costs.
### Quick Start
```bash
# Set environment variables
export DEPLOYMENT_MODE=DEV
export PRESERVE_DEV_DATA=false
# Run simulation (uses mock AI, isolated dev database)
python main.py configs/default_config.json
```
### How It Works
**DEPLOYMENT_MODE=DEV:**
- Mock AI responses (no API calls to OpenAI/Anthropic)
- Separate database: `data/trading_dev.db`
- Separate data directory: `data/dev_agent_data/`
- Dev database reset on startup (unless PRESERVE_DEV_DATA=true)
- Warnings logged if production API keys detected
**DEPLOYMENT_MODE=PROD** (default):
- Real AI API calls
- Production database: `data/trading.db`
- Production data directory: `data/agent_data/`
### Mock AI Behavior
The mock provider returns deterministic responses that rotate through stocks:
- Day 1: AAPL
- Day 2: MSFT
- Day 3: GOOGL
- Etc. (cycles through 10 stocks)
Each mock response includes:
- Price queries for selected stock
- Buy order for 5 shares
- Finish signal to end session
### Environment Variables
```bash
DEPLOYMENT_MODE=PROD # PROD or DEV (default: PROD)
PRESERVE_DEV_DATA=false # Keep dev data between runs (default: false)
```
### Use Cases
- **Orchestration testing:** Verify agent loop, position tracking, logging
- **CI/CD pipelines:** Run tests without API costs
- **Configuration validation:** Test date ranges, model configs
- **Development iteration:** Rapid testing of code changes
### Limitations
- Mock responses are static (not context-aware)
- No actual market analysis
- Fixed trading pattern
- For logic testing only, not trading strategy validation
---
## 📊 Database Schema
SQLite database at `data/jobs.db` contains: