试试ai
This commit is contained in:
parent
d9cdc6666e
commit
bcb29ff9dc
@ -394,7 +394,7 @@ class FreqaiPrimer(IStrategy):
|
||||
|
||||
# 将 1h 数据重新索引到主时间框架 (3m),并填充缺失值
|
||||
# 确保重新索引时不引入未来数据
|
||||
df_1h = df_1h.set_index('date').reindex(dataframe['date']).ffill().fillna(method='bfill').reset_index()
|
||||
df_1h = df_1h.set_index('date').reindex(dataframe['date']).ffill().bfill().reset_index()
|
||||
df_1h = df_1h.rename(columns={'index': 'date'})
|
||||
|
||||
# Include macd_1h and macd_signal_1h in the column selection
|
||||
@ -423,7 +423,7 @@ class FreqaiPrimer(IStrategy):
|
||||
df_1h = df_1h[required_columns] # 确保包含 macd_1h 和 macd_signal_1h
|
||||
|
||||
# 合并 1h 数据
|
||||
dataframe = dataframe.merge(df_1h, how='left', on='date').fillna(method='ffill')
|
||||
dataframe = dataframe.merge(df_1h, how='left', on='date').ffill()
|
||||
|
||||
# 验证合并后的列
|
||||
logger.info(f"[{metadata['pair']}] 合并后的数据框列名: {list(dataframe.columns)}")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user