fix issue
This commit is contained in:
parent
39f04ab9be
commit
973b06bfe1
@ -76,17 +76,17 @@ class FreqaiPrimer(IStrategy):
|
||||
dataframe[f"%-macd_{period}"] = macd[0]
|
||||
dataframe[f"%-macd_signal_{period}"] = macd[1]
|
||||
else:
|
||||
dataframe[f"%-macd_{period}"] = macd['macd']
|
||||
dataframe[f"%-macd_signal_{period}"] = macd['macdsignal']
|
||||
dataframe[f"%-macd_{period}"] = macd['MACD_12_26_9']
|
||||
dataframe[f"%-macd_signal_{period}"] = macd['MACDs_12_26_9']
|
||||
|
||||
# 布林带特征
|
||||
bbands = pta.bbands(dataframe['close'], length=period)
|
||||
bbands = pta.bbands(dataframe['close'], length=period, std=self.bb_std)
|
||||
if isinstance(bbands, list):
|
||||
dataframe[f"%-bb_upper_{period}"] = bbands[0]
|
||||
dataframe[f"%-bb_lower_{period}"] = bbands[1]
|
||||
else:
|
||||
dataframe[f"%-bb_upper_{period}"] = bbands['upperband']
|
||||
dataframe[f"%-bb_lower_{period}"] = bbands['lowerband']
|
||||
dataframe[f"%-bb_upper_{period}"] = bbands[f'BBU_{period}_{self.bb_std}']
|
||||
dataframe[f"%-bb_lower_{period}"] = bbands[f'BBL_{period}_{self.bb_std}']
|
||||
|
||||
# 计算布林带宽度
|
||||
if f"%-bb_upper_{period}" in dataframe.columns and f"%-bb_lower_{period}" in dataframe.columns:
|
||||
@ -142,8 +142,8 @@ class FreqaiPrimer(IStrategy):
|
||||
stochrsi = pta.stochrsi(dataframe['close'], length=14)
|
||||
if isinstance(stochrsi, list):
|
||||
dataframe["&-ideal_stochrsi"] = stochrsi[0] # 假设第一个元素是fastk
|
||||
elif 'fastk' in stochrsi:
|
||||
dataframe["&-ideal_stochrsi"] = stochrsi['fastk']
|
||||
elif 'STOCHRSIk_14_14_3_3' in stochrsi:
|
||||
dataframe["&-ideal_stochrsi"] = stochrsi['STOCHRSIk_14_14_3_3']
|
||||
|
||||
# 预测市场状态
|
||||
dataframe["&-market_state"] = np.where(dataframe['close'] > dataframe['ema_50_1h'], 1, 0)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user