openfund-taker 1.0.17__py3-none-any.whl → 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openfund_taker-1.0.17.dist-info → openfund_taker-1.1.0.dist-info}/METADATA +1 -1
- {openfund_taker-1.0.17.dist-info → openfund_taker-1.1.0.dist-info}/RECORD +5 -5
- taker/MultiAssetNewTradingBot.py +25 -5
- {openfund_taker-1.0.17.dist-info → openfund_taker-1.1.0.dist-info}/WHEEL +0 -0
- {openfund_taker-1.0.17.dist-info → openfund_taker-1.1.0.dist-info}/entry_points.txt +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
taker/MultiAssetNewTradingBot.py,sha256=
|
1
|
+
taker/MultiAssetNewTradingBot.py,sha256=GTuzCyI1SfCez-G1tI_B-pINLOPcJtcOqTrQiBPcWGo,35952
|
2
2
|
taker/MultiAssetOldTradingBot.py,sha256=uBh_BxglvcbaHIsWHM7GI9Qa_QjzsxXaXJAAWEOMO5c,15315
|
3
3
|
taker/ThreeLineTradingBot.py,sha256=oXIoQ8z9AzKzk0z13d0ufj2KGBOk5iHJTJNZQRDKA5U,20625
|
4
4
|
taker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -9,7 +9,7 @@ taker/chua_ok_all.py,sha256=2XnZM6QdB3juSE1pqQIJyh2x1XuhlTlnBKNA3owlJ9E,15267
|
|
9
9
|
taker/chua_ok_bot.py,sha256=9SW0ujhi6PfN4yR1JZ9NaA37HtnXJ2QAWUfW52NG68w,13109
|
10
10
|
taker/config.py,sha256=YPxghO5i0vgRg9Cja8kGj9O7pgSbbtzOgf3RexqXXwY,1188
|
11
11
|
taker/main.py,sha256=8cLWzEvQDeELbY5Av7JqkEyYbaNqSbAbVl1tQHXzU8s,1954
|
12
|
-
openfund_taker-1.0.
|
13
|
-
openfund_taker-1.0.
|
14
|
-
openfund_taker-1.0.
|
15
|
-
openfund_taker-1.0.
|
12
|
+
openfund_taker-1.1.0.dist-info/METADATA,sha256=LVhdFLOtAZJ9Kp9P2IdbmUsrx4q0sUbIkif7oOhMeyc,7502
|
13
|
+
openfund_taker-1.1.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
14
|
+
openfund_taker-1.1.0.dist-info/entry_points.txt,sha256=a7mG8F7aOA5-Gk2vPWuAR4537faxaHUgM_jwIDBZoEc,50
|
15
|
+
openfund_taker-1.1.0.dist-info/RECORD,,
|
taker/MultiAssetNewTradingBot.py
CHANGED
@@ -81,9 +81,9 @@ class MultiAssetNewTradingBot:
|
|
81
81
|
payload = {"msg_type": "text", "content": {"text": message}}
|
82
82
|
response = requests.post(self.feishu_webhook, json=payload, headers=headers)
|
83
83
|
if response.status_code == 200:
|
84
|
-
self.logger.
|
84
|
+
self.logger.debug("飞书通知发送成功")
|
85
85
|
else:
|
86
|
-
self.logger.
|
86
|
+
self.logger.warn("飞书通知发送失败,状态码: %s", response.status_code)
|
87
87
|
except Exception as e:
|
88
88
|
self.logger.error("发送飞书通知时出现异常: %s", str(e))
|
89
89
|
|
@@ -180,6 +180,25 @@ class MultiAssetNewTradingBot:
|
|
180
180
|
|
181
181
|
# 定义根据均线斜率判断 K 线方向的函数: 0 空 1 多 -1 平
|
182
182
|
|
183
|
+
def judge_range_diff(self,symbol,pair_config,prices:pd.Series) -> bool:
|
184
|
+
"""
|
185
|
+
计算价格列表中最后一个价格与第一个价格的差值。
|
186
|
+
Args:
|
187
|
+
prices: 价格列表。
|
188
|
+
Returns:
|
189
|
+
diff: 计算最高价列的最大值与最小值的差值
|
190
|
+
。
|
191
|
+
"""
|
192
|
+
limit = int(pair_config.get('ema_range_limit', 1))
|
193
|
+
period = int(pair_config.get('ema_range_period', 3))
|
194
|
+
tick_size = self.get_tick_size(symbol)
|
195
|
+
if prices.empty:
|
196
|
+
return None
|
197
|
+
|
198
|
+
diff = prices.tail(period).max() - prices.tail(period).min()
|
199
|
+
self.logger.debug(f"{symbol}: 最高价列的最大值与最小值的差值 = {diff:.9f}")
|
200
|
+
return abs(diff) <= tick_size * limit
|
201
|
+
|
183
202
|
# 定义根据均线斜率判断 K 线方向的函数: 0 空 1 多 -1 平
|
184
203
|
def judge_k_line_direction(self, symbol, pair_config, ema: pd.Series, klines) -> int:
|
185
204
|
"""
|
@@ -235,16 +254,17 @@ class MultiAssetNewTradingBot:
|
|
235
254
|
is_apex = self.judge_ma_apex(symbol=symbol,pair_config=pair_config, fastklines=fastk,slowklines=slowk)
|
236
255
|
|
237
256
|
kline_direction = self.judge_k_line_direction(symbol=symbol, pair_config=pair_config, ema=fastk, klines=klines)
|
257
|
+
# if_inner_range = self.judge_range_diff(symbol=symbol, pair_config=pair_config, prices=fastk)
|
238
258
|
|
239
|
-
self.logger.debug(f"{symbol} cross={last_cross_direction}
|
259
|
+
self.logger.debug(f"{symbol} cross={last_cross_direction},两线收缩={is_apex},持仓方向={side}")
|
240
260
|
# 金叉逻辑 ,如果是金叉,且是周期顶部,且K线方向是空头,就清仓多单
|
241
261
|
if last_cross_direction and last_cross_direction['cross'] == 1 and is_apex and side == 'long' and kline_direction == 0:
|
242
|
-
self.logger.debug(f"{symbol} 金叉:{last_cross_direction['cross']}
|
262
|
+
self.logger.debug(f"{symbol} 金叉:{last_cross_direction['cross']},两线收缩={is_apex},持仓方向={side} ,开始清理多单!!")
|
243
263
|
self.close_all_positions(symbol=symbol, position=position)
|
244
264
|
|
245
265
|
# 死叉逻辑 ,如果是死叉,且是周期底部,且K线方向是多头,就清仓空单
|
246
266
|
elif last_cross_direction and last_cross_direction['cross'] == 0 and is_apex and side == 'short' and kline_direction == 1:
|
247
|
-
self.logger.debug(f"{symbol} 死叉:{last_cross_direction['cross']}
|
267
|
+
self.logger.debug(f"{symbol} 死叉:{last_cross_direction['cross']},两线收缩={is_apex},持仓方向={side} ,开始清理空单!!")
|
248
268
|
self.close_all_positions(symbol=symbol, position=position)
|
249
269
|
|
250
270
|
except KeyboardInterrupt:
|
File without changes
|
File without changes
|