up
Some checks are pending
Update Docker Hub Description / dockerHubDescription (push) Waiting to run

This commit is contained in:
zhangkun9038@dingtalk.com 2025-04-28 12:20:59 +08:00
parent e0884d4349
commit 244b91ebd3

View File

@ -209,33 +209,19 @@ class FreqaiExampleStrategy(IStrategy):
return dataframe
def populate_entry_trend(self, df: DataFrame, metadata: dict) -> DataFrame:
# 改进买入信号条件
enter_long_conditions = [
(df["rsi"] < df["buy_rsi_pred"]) & (df["rsi"].shift(1) >= df["buy_rsi_pred"]), # RSI 下穿买入阈值
df["volume"] > df["volume"].rolling(window=10).mean(), # 成交量高于近期均值
df["close"] > df["bb_middleband"] # 价格高于布林带中轨
]
if enter_long_conditions:
df.loc[
reduce(lambda x, y: x & y, enter_long_conditions),
["enter_long", "enter_tag"]
] = (1, "long")
return df
def populate_exit_trend(self, df: DataFrame, metadata: dict) -> DataFrame:
# 改进卖出信号条件
exit_long_conditions = [
(df["rsi"] > df["sell_rsi_pred"]) & (df["rsi"].shift(1) <= df["sell_rsi_pred"]), # RSI 上穿卖出阈值
df["volume"] > df["volume"].rolling(window=10).mean(), # 成交量高于近期均值
df["close"] < df["bb_middleband"] # 价格低于布林带中轨
]
if exit_long_conditions:
df.loc[
reduce(lambda x, y: x & y, exit_long_conditions),
"exit_long"
] = 1
return df
exit_long_conditions = [
(df["rsi"] > df["sell_rsi_pred"]) & (df["rsi"].shift(1) <= df["sell_rsi_pred"]), # RSI 上穿卖出阈值
df["volume"] > df["volume"].rolling(window=10).mean(), # 成交量高于近期均值
df["close"] < df["bb_middleband"] # 价格低于布林带中轨
]
if exit_long_conditions:
df.loc[
reduce(lambda x, y: x & y, exit_long_conditions),
"exit_long"
] = 1
return df
def confirm_trade_entry(
self, pair: str, order_type: str, amount: float, rate: float,