Improve nonlinear PM diagnostics
This commit is contained in:
@@ -400,6 +400,8 @@ def _simulate_open_trades(
|
||||
trades["actual_edge_bps"] = np.where(is_long, trades["long_trade_net_edge_bps"], trades["short_trade_net_edge_bps"])
|
||||
trades["label_actual_plan_edge_bps"] = np.where(is_long, trades["actual_long_plan_edge_bps"], trades["actual_short_plan_edge_bps"])
|
||||
trades["entry_target"] = np.where(is_long, trades["long_entry_target"], trades["short_entry_target"])
|
||||
trades["target_hit"] = np.where(is_long, trades["long_target_hit"], trades["short_target_hit"]).astype(int)
|
||||
trades["stop_hit"] = np.where(is_long, trades["long_stop_hit"], trades["short_stop_hit"]).astype(int)
|
||||
effective_pm_config = pm_config or _pm_config_from_thresholds(thresholds)
|
||||
effective_price_plan = price_plan or DEFAULT_BACKTEST_PRICE_PLAN
|
||||
trades["time_to_exit_ms"] = _time_to_exit_ms(trades, is_long, effective_price_plan)
|
||||
@@ -424,6 +426,8 @@ def _simulate_open_trades(
|
||||
"label_actual_plan_edge_bps",
|
||||
"actual_edge_bps",
|
||||
"entry_target",
|
||||
"target_hit",
|
||||
"stop_hit",
|
||||
"time_to_exit_ms",
|
||||
"planned_ratio",
|
||||
"weighted_edge_bps",
|
||||
@@ -447,6 +451,8 @@ def _empty_trade_frame() -> pd.DataFrame:
|
||||
"label_actual_plan_edge_bps",
|
||||
"actual_edge_bps",
|
||||
"entry_target",
|
||||
"target_hit",
|
||||
"stop_hit",
|
||||
"time_to_exit_ms",
|
||||
"planned_ratio",
|
||||
"weighted_edge_bps",
|
||||
|
||||
Reference in New Issue
Block a user