Skip to content

Commit b10d351

Browse files
TPTBusinessclaude
andcommitted
fix(strategies): handle None ic/sharpe/dd in rejected strategy log output
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d75cba9 commit b10d351

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

scripts/predix_gen_strategies_real_bt.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,10 @@ def main(target_count=10):
636636
oos_info = f"OOS_Sharpe={oos_sharpe:+.2f} OOS_Mon={oos_monthly:+.2f}%" if oos_sharpe is not None else ""
637637
mc_info = f" MC_p={mc_pvalue:.2f}" if mc_pvalue is not None else ""
638638
wf_info = f" WF_consistency={wf_consistency:.0%}" if wf_consistency is not None else ""
639-
_log.info(f"REJECTED IC={ic:.4f} Sharpe={sharpe:.2f} Trades={trades} DD={dd:.1%} {oos_info}{mc_info}{wf_info}")
639+
_ic = ic or 0; _sh = sharpe or 0; _dd = dd or 0
640+
_log.info(f"REJECTED IC={_ic:.4f} Sharpe={_sh:.2f} Trades={trades} DD={_dd:.1%} {oos_info}{mc_info}{wf_info}")
640641
feedback_history.append(
641-
f"Failed: IC={ic:.4f}, Sharpe={sharpe:.2f}, Trades={trades}, DD={dd:.1%}, "
642+
f"Failed: IC={_ic:.4f}, Sharpe={_sh:.2f}, Trades={trades}, DD={_dd:.1%}, "
642643
f"OOS_Sharpe={oos_sharpe:+.2f}, OOS_Monthly={oos_monthly:+.2f}%"
643644
+ (f", MC_p={mc_pvalue:.2f}" if mc_pvalue is not None else "")
644645
+ (f", WF_consistency={wf_consistency:.0%}" if wf_consistency is not None else "")

0 commit comments

Comments
 (0)