Fix portfolio construction NaN handling
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user