]> Piment Noir Git Repositories - freqai-strategies.git/commit
fix(reforcexy): harden Optuna best-params persistence
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 4 Aug 2026 19:12:20 +0000 (21:12 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 4 Aug 2026 19:12:20 +0000 (21:12 +0200)
commitdff06424a3db4a8061ab67ec01a12bc1feb71b9e
treec5b414364e104fcedc55c65403bbd66bd90c5375
parent25fe18431879670a3507d11cf547cadc1d65e0ef
fix(reforcexy): harden Optuna best-params persistence

Port the QuickAdapter Optuna best-params I/O hardening to ReforceXY's
save_best_trial_params / load_best_trial_params:

- Encode the complete pair identity in the filename via _sanitize_pair
  instead of the base currency only, so pairs sharing a base (e.g.
  BTC/USDT and BTC/USDC) no longer collide on one file.
- Warn and ignore a base-only legacy best-params file that shadows the
  pair-safe path.
- Write atomically (temp file + fsync + os.replace), preserving the
  previous file owner and mode.
- Serialize reads and writes with a flock lock file opened
  O_NOFOLLOW|O_NONBLOCK|O_CLOEXEC and guarded by an S_ISREG check.
- Fail closed when the live path is a symlink.
- Quarantine a corrupt best-params file on load and return None instead
  of raising, mirroring the existing journal quarantine.
ReforceXY/user_data/freqaimodels/ReforceXY.py