Commit Graph

221 Commits

Author SHA1 Message Date
21in7
0a8748913e feat: add signal score detail to bot logs for HOLD reason debugging
get_signal() now returns (signal, detail) tuple with long/short scores,
ADX value, volume surge status, and HOLD reason for easier diagnosis.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 02:20:44 +09:00
21in7
c577019793 docs: update architecture and README for improved clarity and structure
- Revised the architecture document to enhance clarity on system overview, trading decision process, and technical stack.
- Updated the README to emphasize the bot's operational guidelines and risk management features.
- Added new sections in the architecture document detailing the trading decision gates and data pipeline flow.
- Improved the table of contents for better navigation and understanding of the bot's architecture.
2026-03-07 02:12:48 +09:00
21in7
2a767c35d4 feat(weekly-report): implement weekly report generation with live trade data and performance tracking
- Added functionality to fetch live trade data from the dashboard API.
- Implemented weekly report generation that includes backtest results, live trade statistics, and performance trends.
- Enhanced error handling for API requests and improved logging for better traceability.
- Updated tests to cover new features and ensure reliability of the report generation process.
2026-03-07 01:13:03 +09:00
21in7
6a6740d708 docs: update CLAUDE.md with weekly-report commands and plan status
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:53:13 +09:00
21in7
f47ad26156 fix(weekly-report): handle numpy.bool_ in JSON serialization
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:52:51 +09:00
21in7
1b1542d51f feat(weekly-report): add main orchestration, CLI, JSON save
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:49:16 +09:00
21in7
90d99a1662 feat(weekly-report): add Discord report formatting and sending
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:46:03 +09:00
21in7
58596785aa feat(weekly-report): add ML trigger check and degradation sweep
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:42:53 +09:00
21in7
3b0335f57e feat(weekly-report): add trend tracking from previous reports
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:40:39 +09:00
21in7
35177bf345 feat(weekly-report): add live trade log parser
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:39:03 +09:00
21in7
9011344aab feat(weekly-report): add data fetch and WF backtest core
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:34:48 +09:00
21in7
2e788c0d0f docs: add weekly strategy report implementation plan
8-task plan covering: data fetch, WF backtest, log parsing, trend tracking,
ML re-trigger check, degradation sweep, Discord formatting, CLI orchestration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:28:28 +09:00
21in7
771b357f28 feat: enhance strategy parameter sweep with new CLI tool and bug fixes
- Added a new CLI tool `scripts/strategy_sweep.py` for executing parameter sweeps.
- Updated `get_signal()` and `_calc_signals()` methods to accept `signal_threshold`, `adx_threshold`, and `volume_multiplier` parameters for improved signal processing.
- Fixed a bug in `WalkForwardBacktester` that prevented proper propagation of signal parameters, ensuring accurate backtesting results.
- Updated documentation to reflect changes in parameter sweeps and results.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:27:28 +09:00
21in7
d8d4bf3e20 feat: add new walk-forward backtest results and strategy sweeps for XRPUSDT
- Introduced multiple JSON files containing results from walk-forward backtests with varying configurations.
- Added strategy sweep results for different parameter combinations, showcasing performance metrics such as total trades, total PnL, win rate, and more.
- Enhanced the overall testing framework for better analysis of trading strategies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:22:39 +09:00
21in7
072910df39 fix: WalkForward ignores use_ml=False flag, always injecting trained models
WF backtester always passed trained models to Backtester.run(ml_models=...),
overriding ml_filters even when use_ml=False. This caused 0 trades in
--no-ml mode because underfitted models (trained on ~27 samples) blocked
all entries with proba < 0.55 threshold.

- Skip model training when use_ml=False (saves computation)
- Only inject ml_models when use_ml=True

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:19:27 +09:00
21in7
89f44c96af fix: resolve ML filter dtype error and missing BTC/ETH correlation features
- Fix LightGBM predict_proba ValueError by filtering FEATURE_COLS and casting to float64
- Extract BTC/ETH correlation data from embedded parquet columns instead of missing separate files
- Disable ONNX priority in ML filter tests to use mocked LightGBM correctly
- Add NO_ML_FILTER=true to .env.example (ML adds no value with current signal thresholds)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:08:23 +09:00
21in7
dbc900d478 chore: trigger bot rebuild 2026-03-06 23:59:29 +09:00
21in7
90a72e4c39 fix: improve change detection logic in Jenkinsfile
- Updated the change detection script to compare the current commit with the previous successful build, falling back to HEAD~5 if no previous commit exists.
- Enhanced logging to indicate the base commit used for comparison.
2026-03-06 23:57:53 +09:00
21in7
cd9d379bc2 feat: implement multi-symbol dashboard with updated data handling
- Added support for multi-symbol trading (XRP, TRX, DOGE) in the dashboard.
- Updated bot log messages to include [SYMBOL] prefix for better tracking.
- Enhanced log parser for multi-symbol state tracking and updated database schema.
- Introduced new API endpoints and UI components for symbol filtering and display.
- Added new model files and backtest results for multi-symbol strategies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 23:43:41 +09:00
21in7
67692b3ebd chore: add strategy params to .env.example
ATR_SL_MULT, ATR_TP_MULT, SIGNAL_THRESHOLD, ADX_THRESHOLD, VOL_MULTIPLIER

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 23:42:21 +09:00
21in7
02e41881ac feat: strategy parameter sweep and production param optimization
- Add independent backtest engine (backtester.py) with walk-forward support
- Add backtest sanity check validator (backtest_validator.py)
- Add CLI tools: run_backtest.py, strategy_sweep.py (with --combined mode)
- Fix train-serve skew: unify feature z-score normalization (ml_features.py)
- Add strategy params (SL/TP ATR mult, ADX filter, volume multiplier) to
  config.py, indicators.py, dataset_builder.py, bot.py, backtester.py
- Fix WalkForwardBacktester not propagating strategy params to test folds
- Update production defaults: SL=2.0x, TP=2.0x, ADX=25, Vol=2.5
  (3-symbol combined PF: 0.71 → 1.24, MDD: 65.9% → 17.1%)
- Retrain ML models with new strategy parameters

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 23:39:43 +09:00
21in7
15fb9c158a feat: add multi-symbol dashboard support (parser, API, UI)
- Add [SYMBOL] prefix to all bot/user_data_stream log messages
- Rewrite log_parser.py with multi-symbol regex, per-symbol state tracking, symbol columns in DB schema
- Rewrite dashboard_api.py with /api/symbols endpoint, symbol query params on all endpoints, SQL injection fix
- Update App.jsx with symbol filter tabs, multi-position display, dynamic header
- Add tests for log parser (8 tests) and dashboard API (7 tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 16:19:16 +09:00
21in7
2b3f39b5d1 feat: enhance data handling and model training features
- Updated .gitignore to include .venv and .worktrees.
- Removed symlink for the virtual environment.
- Added new parquet files for dogeusdt, trxusdt, and xrpusdt datasets.
- Introduced model files and training logs for dogeusdt, trxusdt, and xrpusdt.
- Enhanced fetch_history.py to support caching of correlation symbols.
- Updated train_and_deploy.sh to manage correlation cache directory.
2026-03-05 23:57:44 +09:00
d92fae13f8 Merge pull request 'feature/multi-symbol-trading' (#5) from feature/multi-symbol-trading into main
Reviewed-on: #5
2026-03-05 23:38:22 +09:00
21in7
dfcd803db5 Merge branch 'main' into feature/multi-symbol-trading 2026-03-05 23:37:12 +09:00
21in7
9f4c22b5e6 feat: add virtual environment symlink for project dependencies 2026-03-05 23:34:32 +09:00
21in7
852d3a8265 feat: implement multi-symbol trading design and plan documentation
- Added design document outlining the architecture for multi-symbol trading, including independent TradingBot instances and shared RiskManager.
- Created implementation plan detailing tasks for configuration, risk management, and execution structure for multi-symbol support.
- Updated configuration to support multiple trading symbols and correlation symbols, ensuring backward compatibility.
- Introduced shared RiskManager with constraints on position limits and direction to manage global risk effectively.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 23:34:01 +09:00
21in7
9ac839fd83 docs: update README and ARCHITECTURE for multi-symbol trading
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 23:32:14 +09:00
21in7
b03182691e docs: update architecture and commands for multi-symbol trading
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 23:26:59 +09:00
21in7
2bb2bf2896 feat: add per-symbol model/data directories and update .env.example
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 23:24:50 +09:00
21in7
909d6af944 feat: add --symbol/--all CLI to all training scripts for per-symbol pipeline
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 23:21:32 +09:00
21in7
ae5692cde4 feat: MLFilter falls back to models/ root if symbol-specific dir not found
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 23:14:38 +09:00
21in7
7acbdca3f4 feat: main.py spawns per-symbol TradingBot instances with shared RiskManager
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 23:13:52 +09:00
21in7
e7620248c7 feat: TradingBot accepts symbol and shared RiskManager, removes config.symbol dependency
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 23:13:04 +09:00
21in7
2e09f5340a feat: exchange client accepts explicit symbol parameter, removes config.symbol dependency
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 23:07:44 +09:00
21in7
9318fb887e feat: shared RiskManager with async lock, same-direction limit, per-symbol tracking
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 23:06:41 +09:00
21in7
7aef391b69 feat: add multi-symbol config (symbols list, correlation_symbols, max_same_direction)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 23:05:22 +09:00
21in7
39e55368fd feat: log technical indicators on entry and add dashboard docs to README
- Include RSI, MACD_H, ATR in bot entry log so the log parser can
  extract and store them in the trades DB for dashboard display
- Update log parser regex and _handle_entry() to persist indicator values
- Add dashboard section to README (tech stack, screens, API endpoints)
- Add dashboard/ directory to project structure in README

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 21:08:16 +09:00
21in7
aef161002d fix: filter non-numeric /proc entries in DB reset parser kill
The previous /proc-based process kill attempted to read cmdline from
non-PID entries like /proc/fb, causing NotADirectoryError in Docker.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 21:01:53 +09:00
21in7
bfecf63f1c refactor: improve log parser termination method in DB reset
- Replaced subprocess-based termination of the log parser with a Python-native approach using os and signal modules.
- Enhanced process handling to ensure proper termination of existing log parser instances before restarting.

This change improves reliability and compatibility across different environments.
2026-03-05 20:59:48 +09:00
21in7
6f3ea44edb feat: add DB reset button to dashboard
- POST /api/reset endpoint: clears all tables and restarts log parser
- UI: Reset DB button in footer with confirmation dialog

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 20:57:00 +09:00
21in7
f75ad9f6b1 fix: log parser duplicate position bug and selective CI/CD deployment
- Log parser: fix entry dedup to check direction instead of price tolerance,
  preventing duplicate OPEN trades for the same position
- Log parser: close all OPEN trades on position close, delete stale duplicates
- Jenkinsfile: detect changed files and only build/deploy affected services,
  allowing dashboard-only changes without restarting the bot

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 20:52:23 +09:00
21in7
07ba510fd8 chore: update Docker image references in docker-compose.yml
- Changed image references for cointrader, dashboard-api, and dashboard-ui services to use the new GitLab registry URL.
- Ensured consistency in image source for better maintainability and deployment.
2026-03-05 20:27:43 +09:00
21in7
565414c5e0 feat: add trading dashboard with API and UI components
- Introduced a new trading dashboard consisting of a FastAPI backend (`dashboard-api`) for data retrieval and a React frontend (`dashboard-ui`) for visualization.
- Implemented a log parser to monitor and store bot logs in an SQLite database.
- Configured Docker setup for both API and UI, including necessary Dockerfiles and a docker-compose configuration.
- Added setup documentation for running the dashboard and accessing its features.
- Enhanced the Jenkins pipeline to build and push the new dashboard images.
2026-03-05 20:25:45 +09:00
21in7
c555afbddc chore: update .gitignore, CLAUDE.md, training_log.json, and ml_filter.py
- Added .worktrees/ to .gitignore to prevent tracking of worktree files.
- Marked `optuna-precision-objective-plan` as completed in CLAUDE.md.
- Added new training log entry for a LightGBM model with updated parameters and performance metrics in training_log.json.
- Updated error handling in ml_filter.py to return False on prediction errors instead of True, improving the robustness of the ML filter.
2026-03-05 20:04:15 +09:00
21in7
2b92fd0dce feat: implement testnet and demo trading setup for XRPUSDT with 125x leverage
- Added support for demo trading on Binance Futures with a new configuration for 1-minute candles and 125x leverage.
- Updated various components including Config, Exchange, DataStream, UserDataStream, and Bot to handle demo and testnet flags.
- Enhanced the training pipeline to collect 1-minute data and adjusted the lookahead for model training.
- Updated environment variables in .env and .env.example to include demo settings.

This commit lays the groundwork for testing ML-based automated trading strategies in a controlled environment.
2026-03-04 20:43:05 +09:00
21in7
8a8c714a7c merge: resolve CLAUDE.md conflict, mark oi-derived-features as completed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 20:33:12 +09:00
21in7
b55ddd8868 feat: add OI derived features (oi_change_ma5, oi_price_spread) 2026-03-04 20:32:51 +09:00
21in7
d2773e4dbf docs: update CLAUDE.md with OI derived features plan status and 26-feature count
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 20:24:18 +09:00
21in7
f2303e1863 feat: add OI long-term collection script for cron-based data accumulation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 20:24:14 +09:00