数据清理
Some checks are pending
Update Docker Hub Description / dockerHubDescription (push) Waiting to run
Some checks are pending
Update Docker Hub Description / dockerHubDescription (push) Waiting to run
This commit is contained in:
parent
86e9a2ab61
commit
21e4c2f2ea
@ -135,7 +135,7 @@ class FreqaiExampleStrategy(IStrategy):
|
||||
|
||||
# 数据清理
|
||||
for col in ["&-buy_rsi", "%-volatility"]:
|
||||
# 使用直接操作避免链式赋值
|
||||
# 使用直接操作避免链式赋值
|
||||
dataframe[col] = dataframe[col].replace([np.inf, -np.inf], 0)
|
||||
dataframe[col] = dataframe[col].ffill() # 替代 fillna(method='ffill')
|
||||
dataframe[col] = dataframe[col].fillna(0)
|
||||
@ -241,8 +241,8 @@ class FreqaiExampleStrategy(IStrategy):
|
||||
# 改进卖出信号条件
|
||||
exit_long_conditions = [
|
||||
(df["rsi"] > df["sell_rsi_pred"]), # RSI 高于卖出阈值
|
||||
df["volume"] > df["volume"].rolling(window=10).mean(), # 成交量高于近期均值
|
||||
df["close"] < df["bb_middleband"] # 价格低于布林带中轨
|
||||
(df["volume"] > df["volume"].rolling(window=10).mean()), # 成交量高于近期均值
|
||||
(df["close"] < df["bb_middleband"]) # 价格低于布林带中轨
|
||||
]
|
||||
if exit_long_conditions:
|
||||
df.loc[
|
||||
@ -254,8 +254,8 @@ class FreqaiExampleStrategy(IStrategy):
|
||||
# 改进买入信号条件
|
||||
enter_long_conditions = [
|
||||
(df["rsi"] < df["buy_rsi_pred"]), # RSI 低于买入阈值
|
||||
df["volume"] > df["volume"].rolling(window=10).mean(), # 成交量高于近期均值
|
||||
df["close"] > df["bb_middleband"] # 价格高于布林带中轨
|
||||
(df["volume"] > df["volume"].rolling(window=10).mean()), # 成交量高于近期均值
|
||||
(df["close"] > df["bb_middleband"]) # 价格高于布林带中轨
|
||||
]
|
||||
if enter_long_conditions:
|
||||
df.loc[
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user