Fix portfolio construction NaN handling

This commit is contained in:
Yuxuan Yan
2026-06-10 14:58:06 +08:00
parent 94ab679a75
commit 98a4f99300
7 changed files with 109 additions and 20 deletions
+2 -2
View File
@@ -122,7 +122,7 @@ class ReferenceSimulator(ExecutionSimulator):
FILL_COLUMNS / PNL_COLUMNS.
Args:
positions_df: POSITION_COLUMNS (uses ``target_shares``).
positions_df: POSITION_COLUMNS (uses constructed ``position_shares``).
data_df: DATA_COLUMNS (open/close/preclose/amount/tradestatus/isST).
rule_engine: For per-name price-limit bands; default built if None.
@@ -145,7 +145,7 @@ class ReferenceSimulator(ExecutionSimulator):
return df.pivot_table(index="date", columns="symbol_id",
values=col, aggfunc="first").sort_index()
tgt = wide(positions_df, "target_shares")
tgt = wide(positions_df, "position_shares")
opn = wide(data_df, "open")
close = wide(data_df, "close")
preclose = wide(data_df, "preclose") if "preclose" in data_df.columns else close.shift(1)