fix: filter NaN in max(), remove redundant ternary, handle non-finite vbt results

This commit is contained in:
TPTBusiness
2026-05-03 00:25:58 +02:00
parent bc15434e02
commit dcd4697b75
3 changed files with 8 additions and 5 deletions
@@ -222,7 +222,7 @@ class FactorBacktester:
# Calculate return for this step
if step > 0:
prev_price = float(price_values[step - 1]) if step > 0 else current_price
prev_price = float(price_values[step - 1])
if prev_price > 0:
step_return = (current_price - prev_price) / prev_price * position
returns_history.append(step_return)