openfund-taker 1.3.10__py3-none-any.whl → 1.3.12__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.3.10.dist-info → openfund_taker-1.3.12.dist-info}/METADATA +1 -1
- {openfund_taker-1.3.10.dist-info → openfund_taker-1.3.12.dist-info}/RECORD +5 -5
- taker/TrailingSLTaker.py +22 -5
- {openfund_taker-1.3.10.dist-info → openfund_taker-1.3.12.dist-info}/WHEEL +0 -0
- {openfund_taker-1.3.10.dist-info → openfund_taker-1.3.12.dist-info}/entry_points.txt +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
taker/MultiAssetOldTradingBot.py,sha256=uBh_BxglvcbaHIsWHM7GI9Qa_QjzsxXaXJAAWEOMO5c,15315
|
2
2
|
taker/ThreeLineTradingTaker.py,sha256=ElD9pKDO4nxw5VKNRrvXqyiU0gkV_1Mg_zk-hftfaPs,20553
|
3
3
|
taker/TrailingSLAndTPTaker.py,sha256=rx3tw9TwFCpqnz3e0WlTtFVcn8mBbPHtp62n3RF86Kg,1144
|
4
|
-
taker/TrailingSLTaker.py,sha256=
|
4
|
+
taker/TrailingSLTaker.py,sha256=lT6SrlaVcB89RGo1gUIbmnXC6mqU88wqOh-OiNKYT4E,43502
|
5
5
|
taker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
taker/chua_bitget.py,sha256=YY6XK5Bd-wlArsN5BnAfiqE0h1DPkti6i4TEB4F5zDA,12918
|
7
7
|
taker/chua_bn.py,sha256=GnTePWlgDwdHgroBbEp1Ajcsf5_m_Vn_RV63SYzu2jI,10668
|
@@ -10,7 +10,7 @@ taker/chua_ok_all.py,sha256=2XnZM6QdB3juSE1pqQIJyh2x1XuhlTlnBKNA3owlJ9E,15267
|
|
10
10
|
taker/chua_ok_bot.py,sha256=9SW0ujhi6PfN4yR1JZ9NaA37HtnXJ2QAWUfW52NG68w,13109
|
11
11
|
taker/config.py,sha256=YPxghO5i0vgRg9Cja8kGj9O7pgSbbtzOgf3RexqXXwY,1188
|
12
12
|
taker/main.py,sha256=QCEjINu3IgwWEGcuquHzeYjKJYAQrPe8ctQhMoIb9SA,2561
|
13
|
-
openfund_taker-1.3.
|
14
|
-
openfund_taker-1.3.
|
15
|
-
openfund_taker-1.3.
|
16
|
-
openfund_taker-1.3.
|
13
|
+
openfund_taker-1.3.12.dist-info/METADATA,sha256=vZ36nLePnqAhdf3xwLCHGmif8Y8Z78PiWplrSdN64sA,7528
|
14
|
+
openfund_taker-1.3.12.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
15
|
+
openfund_taker-1.3.12.dist-info/entry_points.txt,sha256=a7mG8F7aOA5-Gk2vPWuAR4537faxaHUgM_jwIDBZoEc,50
|
16
|
+
openfund_taker-1.3.12.dist-info/RECORD,,
|
taker/TrailingSLTaker.py
CHANGED
@@ -378,7 +378,7 @@ class TrailingSLTaker:
|
|
378
378
|
|
379
379
|
def round_price_to_tick(self,symbol, price):
|
380
380
|
tick_size = float(self.exchange.market(symbol)['info']['tickSz'])
|
381
|
-
# 计算 tick_size
|
381
|
+
# 计算 tick_size 的整数倍
|
382
382
|
tick_decimals = len(f"{tick_size:.10f}".rstrip('0').split('.')[1]) if '.' in f"{tick_size:.10f}" else 0
|
383
383
|
|
384
384
|
# 调整价格为 tick_size 的整数倍
|
@@ -620,17 +620,34 @@ class TrailingSLTaker:
|
|
620
620
|
|
621
621
|
# 根据持仓方向计算止损价格
|
622
622
|
side = position['side']
|
623
|
+
mark_price = position['markPrice']
|
623
624
|
if side == 'long':
|
624
|
-
sl_price = position['entryPrice'] * (1 - stop_loss_pct/100)
|
625
625
|
tp_price = position['entryPrice'] * (1 + stop_loss_pct*2/100)
|
626
|
+
sl_price = position['entryPrice'] * (1 - stop_loss_pct/100)
|
627
|
+
|
628
|
+
|
626
629
|
elif side == 'short':
|
627
|
-
sl_price = position['entryPrice'] * (1 + stop_loss_pct/100)
|
628
630
|
tp_price = position['entryPrice'] * (1 - stop_loss_pct*2/100)
|
631
|
+
sl_price = position['entryPrice'] * (1 + stop_loss_pct/100)
|
632
|
+
|
629
633
|
|
630
634
|
sl_order_price = float(self.round_price_to_tick(symbol, sl_price))
|
631
635
|
tp_order_price = float(self.round_price_to_tick(symbol, tp_price))
|
632
|
-
|
633
|
-
#
|
636
|
+
|
637
|
+
# 验证止损价格是否合理20250312
|
638
|
+
mark_price = float(position['markPrice'])
|
639
|
+
if side == 'long':
|
640
|
+
if sl_order_price >= mark_price:
|
641
|
+
self.close_all_positions(symbol,position)
|
642
|
+
self.logger.warning(f"{symbol}: !! 多头止损价格= {sl_order_price} 大于等于市场价格= {mark_price},触发止损")
|
643
|
+
return
|
644
|
+
else: # side == 'short'
|
645
|
+
if sl_order_price <= mark_price:
|
646
|
+
self.close_all_positions(symbol,position)
|
647
|
+
self.logger.warning(f"{symbol}: !! 空头止损价格= {sl_order_price} 小于等于市场价格= {mark_price},触发止损")
|
648
|
+
return
|
649
|
+
|
650
|
+
# 250228 没有指定止损回撤阈值stop_loss_pct...
|
634
651
|
if stop_loss_pct is None :
|
635
652
|
pair_config = self.trading_pairs_config.get(symbol, {})
|
636
653
|
klines_period = str(pair_config.get('klines_period', '1m'))
|
File without changes
|
File without changes
|