feat: enhance trade tracking with fees, PnL, and refined logging (v1.7.3)

- Implement real-time fee and realized PnL tracking using get_executions.
- Rename 'side' column to 'trade' in CSV log and dashboard (Enter/Exit labels).
- Add automatic CSV header migration (side -> trade).
- Enhance dashboard with session PnL (USD/BTC), total fees, and used leverage.
- Improve signal detection with candle-internal crossover logic.
- Add robust retry mechanism with failure window tracking.
- Sync exchange leverage automatically based on direction.
- Update config with robustness and mode-specific leverage settings.
This commit is contained in:
Gemini CLI
2026-03-07 22:57:51 +01:00
parent 8fe8224762
commit f544b06753
3 changed files with 275 additions and 34 deletions

View File

@ -36,10 +36,10 @@ uvicorn src.api.server:app --reload --host 0.0.0.0 --port 8000
### Testing
```bash
# Test database connection
python test_db.py
python -c "from src.data_collector.database import get_db; print('Database connection test successful')"
# Run single test (no existing test framework found but for any future tests)
python -m pytest <test_file>.py::test_<function_name> -v
# Run single test (using pytest framework)
python -m pytest tests/ -v -k "test_function_name"
```
### Environment Setup
@ -157,4 +157,4 @@ DB_PASSWORD=your_password
- Only add dependencies to requirements.txt when necessary
- Check for conflicts with existing dependencies
- Keep dependency versions pinned to avoid breaking changes
- Avoid adding heavyweight dependencies unless truly required
- Avoid adding heavyweight dependencies unless truly required