mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-09 04:07:24 -04:00
feat: transform to REST API service with SQLite persistence (v0.3.0)
Major architecture transformation from batch-only to API service with
database persistence for Windmill integration.
## REST API Implementation
- POST /simulate/trigger - Start simulation jobs
- GET /simulate/status/{job_id} - Monitor job progress
- GET /results - Query results with filters (job_id, date, model)
- GET /health - Service health checks
## Database Layer
- SQLite persistence with 6 tables (jobs, job_details, positions,
holdings, reasoning_logs, tool_usage)
- Foreign key constraints with cascade deletes
- Replaces JSONL file storage
## Backend Components
- JobManager: Job lifecycle management with concurrency control
- RuntimeConfigManager: Thread-safe isolated runtime configs
- ModelDayExecutor: Single model-day execution engine
- SimulationWorker: Date-sequential, model-parallel orchestration
## Testing
- 102 unit and integration tests (85% coverage)
- Database: 98% coverage
- Job manager: 98% coverage
- API endpoints: 81% coverage
- Pydantic models: 100% coverage
- TDD approach throughout
## Docker Deployment
- Dual-mode: API server (persistent) + batch (one-time)
- Health checks with 30s interval
- Volume persistence for database and logs
- Separate entrypoints for each mode
## Validation Tools
- scripts/validate_docker_build.sh - Build validation
- scripts/test_api_endpoints.sh - Complete API testing
- scripts/test_batch_mode.sh - Batch mode validation
- DOCKER_API.md - Deployment guide
- TESTING_GUIDE.md - Testing procedures
## Configuration
- API_PORT environment variable (default: 8080)
- Backwards compatible with existing configs
- FastAPI, uvicorn, pydantic>=2.0 dependencies
Co-Authored-By: AI Assistant <noreply@example.com>
This commit is contained in:
25
requirements-dev.txt
Normal file
25
requirements-dev.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
# Development and Testing Dependencies
|
||||
|
||||
# Testing framework
|
||||
pytest==7.4.3
|
||||
pytest-cov==4.1.0
|
||||
pytest-asyncio==0.21.1
|
||||
pytest-benchmark==4.0.0
|
||||
|
||||
# Mocking and fixtures
|
||||
pytest-mock==3.12.0
|
||||
|
||||
# Code quality
|
||||
ruff==0.1.7
|
||||
black==23.11.0
|
||||
isort==5.12.0
|
||||
mypy==1.7.1
|
||||
|
||||
# Security
|
||||
bandit==1.7.5
|
||||
|
||||
# Load testing
|
||||
locust==2.18.3
|
||||
|
||||
# Type stubs
|
||||
types-requests==2.31.0.10
|
||||
Reference in New Issue
Block a user