From 1958544106395b588aafa261c23890cfbff6455a Mon Sep 17 00:00:00 2001 From: TPTBusiness Date: Thu, 23 Apr 2026 20:21:21 +0200 Subject: [PATCH] fix(strategies): handle None ic/sharpe/dd in rejected strategy log output Co-Authored-By: Claude Sonnet 4.6 --- scripts/predix_gen_strategies_real_bt.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/predix_gen_strategies_real_bt.py b/scripts/predix_gen_strategies_real_bt.py index bcdb9688..5b070343 100644 --- a/scripts/predix_gen_strategies_real_bt.py +++ b/scripts/predix_gen_strategies_real_bt.py @@ -636,9 +636,10 @@ def main(target_count=10): oos_info = f"OOS_Sharpe={oos_sharpe:+.2f} OOS_Mon={oos_monthly:+.2f}%" if oos_sharpe is not None else "" mc_info = f" MC_p={mc_pvalue:.2f}" if mc_pvalue is not None else "" wf_info = f" WF_consistency={wf_consistency:.0%}" if wf_consistency is not None else "" - _log.info(f"REJECTED IC={ic:.4f} Sharpe={sharpe:.2f} Trades={trades} DD={dd:.1%} {oos_info}{mc_info}{wf_info}") + _ic = ic or 0; _sh = sharpe or 0; _dd = dd or 0 + _log.info(f"REJECTED IC={_ic:.4f} Sharpe={_sh:.2f} Trades={trades} DD={_dd:.1%} {oos_info}{mc_info}{wf_info}") feedback_history.append( - f"Failed: IC={ic:.4f}, Sharpe={sharpe:.2f}, Trades={trades}, DD={dd:.1%}, " + f"Failed: IC={_ic:.4f}, Sharpe={_sh:.2f}, Trades={trades}, DD={_dd:.1%}, " f"OOS_Sharpe={oos_sharpe:+.2f}, OOS_Monthly={oos_monthly:+.2f}%" + (f", MC_p={mc_pvalue:.2f}" if mc_pvalue is not None else "") + (f", WF_consistency={wf_consistency:.0%}" if wf_consistency is not None else "")