fix issue
This commit is contained in:
parent
295f071e1e
commit
516813f427
@ -248,8 +248,10 @@ class FreqaiPrimer(IStrategy):
|
||||
|
||||
# 确保df_15m中包含rsi_15m列,如果没有则计算
|
||||
if 'rsi_15m' not in df_15m.columns:
|
||||
# 使用talib计算14期RSI
|
||||
df_15m['rsi_15m'] = self.talib.RSI(df_15m['close'], timeperiod=14)
|
||||
# 使用pandas_ta计算14期RSI
|
||||
import pandas_ta as ta
|
||||
rsi_series = ta.rsi(df_15m['close'], length=14)
|
||||
df_15m['rsi_15m'] = rsi_series
|
||||
|
||||
df_15m = df_15m.rename(columns={'date': 'date_15m'})
|
||||
merged_data = dataframe.merge(df_15m[['date_15m', 'rsi_15m']], how='left', left_on='date', right_on='date_15m')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user