openfund-taker 2.1.1__py3-none-any.whl → 2.1.2__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-2.1.1.dist-info → openfund_taker-2.1.2.dist-info}/METADATA +1 -1
- {openfund_taker-2.1.1.dist-info → openfund_taker-2.1.2.dist-info}/RECORD +6 -6
- taker/SMCSLAndTPTaker.py +6 -4
- taker/TrailingSLTaker.py +16 -13
- {openfund_taker-2.1.1.dist-info → openfund_taker-2.1.2.dist-info}/WHEEL +0 -0
- {openfund_taker-2.1.1.dist-info → openfund_taker-2.1.2.dist-info}/entry_points.txt +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
taker/MultiAssetOldTradingBot.py,sha256=uBh_BxglvcbaHIsWHM7GI9Qa_QjzsxXaXJAAWEOMO5c,15315
|
2
|
-
taker/SMCSLAndTPTaker.py,sha256=
|
2
|
+
taker/SMCSLAndTPTaker.py,sha256=ad8C94XKiJOdQxZw1vj7RI4iZhjwJ-CWkcpTWx6tRPY,21055
|
3
3
|
taker/ThreeLineTradingTaker.py,sha256=ElD9pKDO4nxw5VKNRrvXqyiU0gkV_1Mg_zk-hftfaPs,20553
|
4
4
|
taker/TrailingSLAndTPTaker.py,sha256=OPD1ZNqyM8jZ7Im-bWm_6Cu4_qfwKmNZ30XpbP6-l00,2746
|
5
|
-
taker/TrailingSLTaker.py,sha256=
|
5
|
+
taker/TrailingSLTaker.py,sha256=Luz2Ph2-iD3cN9XqOeJCKyiPB4Y6m_3YeQRxQT2L_58,47314
|
6
6
|
taker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
taker/chua_bitget.py,sha256=YY6XK5Bd-wlArsN5BnAfiqE0h1DPkti6i4TEB4F5zDA,12918
|
8
8
|
taker/chua_bn.py,sha256=GnTePWlgDwdHgroBbEp1Ajcsf5_m_Vn_RV63SYzu2jI,10668
|
@@ -11,7 +11,7 @@ taker/chua_ok_all.py,sha256=2XnZM6QdB3juSE1pqQIJyh2x1XuhlTlnBKNA3owlJ9E,15267
|
|
11
11
|
taker/chua_ok_bot.py,sha256=9SW0ujhi6PfN4yR1JZ9NaA37HtnXJ2QAWUfW52NG68w,13109
|
12
12
|
taker/config.py,sha256=YPxghO5i0vgRg9Cja8kGj9O7pgSbbtzOgf3RexqXXwY,1188
|
13
13
|
taker/main.py,sha256=Ulz22BV34Mp8ugh-Dior1mIS8n8si8bMi5RCBit2G4U,2774
|
14
|
-
openfund_taker-2.1.
|
15
|
-
openfund_taker-2.1.
|
16
|
-
openfund_taker-2.1.
|
17
|
-
openfund_taker-2.1.
|
14
|
+
openfund_taker-2.1.2.dist-info/METADATA,sha256=vpEluDSD2KO5q5OM68AyeupRN4eLp0HNyTfHM_i5yC0,7527
|
15
|
+
openfund_taker-2.1.2.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
16
|
+
openfund_taker-2.1.2.dist-info/entry_points.txt,sha256=a7mG8F7aOA5-Gk2vPWuAR4537faxaHUgM_jwIDBZoEc,50
|
17
|
+
openfund_taker-2.1.2.dist-info/RECORD,,
|
taker/SMCSLAndTPTaker.py
CHANGED
@@ -341,14 +341,15 @@ class SMCSLAndTPTaker(TrailingSLTaker):
|
|
341
341
|
|
342
342
|
return df_valid_liquidities.loc[result_indices].sort_index(ascending=False)
|
343
343
|
|
344
|
-
def calculate_tp_price_by_liquidity(self, symbol, position, df_liquidities, tp_sl_ratio=1.5, offset=1) -> float:
|
344
|
+
def calculate_tp_price_by_liquidity(self, symbol, position, df_liquidities, stop_loss_pct=2, tp_sl_ratio=1.5, offset=1) -> float:
|
345
345
|
"""_summary_
|
346
346
|
计算止盈价格,根据流动性,做多则止盈价格在流动性之上,做空则止盈价格在流动性之下。
|
347
347
|
Args:
|
348
348
|
symbol (_type_): _description_
|
349
349
|
position (_type_): _description_
|
350
350
|
df_liquidities (_type_): _description_
|
351
|
-
|
351
|
+
stop_loss_pct (int, optional): _description_. Defaults to 2.
|
352
|
+
tp_sl_ratio (float, optional): _description_. Defaults to 1.5.
|
352
353
|
offset (int, optional): _description_. Defaults to 1.
|
353
354
|
|
354
355
|
Returns:
|
@@ -361,8 +362,9 @@ class SMCSLAndTPTaker(TrailingSLTaker):
|
|
361
362
|
is_buy = position['side'] == 'long'
|
362
363
|
price_col = 'Up' if is_buy else 'Dn'
|
363
364
|
|
364
|
-
sl_price = self.global_symbol_stop_loss_price.get(symbol, float(position['markPrice']))
|
365
|
+
# sl_price = self.global_symbol_stop_loss_price.get(symbol, float(position['markPrice']))
|
365
366
|
entry_price = float(position['entryPrice'])
|
367
|
+
sl_price = self.calculate_sl_price_by_pct(symbol, position['side'], stop_loss_pct)
|
366
368
|
threshold = 0.0
|
367
369
|
if is_buy and sl_price > 0 :
|
368
370
|
threshold = float(self.round_price_to_tick(symbol, (entry_price - sl_price ) * tp_sl_ratio + entry_price))
|
@@ -435,7 +437,7 @@ class SMCSLAndTPTaker(TrailingSLTaker):
|
|
435
437
|
self.logger.info(f"{symbol} : 没有找到流动性,不设置止盈")
|
436
438
|
return
|
437
439
|
|
438
|
-
tp_price = self.calculate_tp_price_by_liquidity(symbol, position, htf_liquidity, self.all_TP_SL_ratio)
|
440
|
+
tp_price = self.calculate_tp_price_by_liquidity(symbol, position, htf_liquidity, self.stop_loss_pct, self.all_TP_SL_ratio)
|
439
441
|
|
440
442
|
self.cancel_all_algo_orders(symbol=symbol, attachType='TP')
|
441
443
|
|
taker/TrailingSLTaker.py
CHANGED
@@ -661,6 +661,19 @@ class TrailingSLTaker:
|
|
661
661
|
|
662
662
|
return True
|
663
663
|
|
664
|
+
|
665
|
+
def calculate_sl_price_by_pct(self, symbol, side, sl_pct) -> float:
|
666
|
+
|
667
|
+
if side == 'long':
|
668
|
+
sl_price = position['entryPrice'] * (1 - sl_pct/100)
|
669
|
+
|
670
|
+
elif side == 'short':
|
671
|
+
sl_price = position['entryPrice'] * (1 + sl_pct/100)
|
672
|
+
|
673
|
+
|
674
|
+
sl_order_price = float(self.round_price_to_tick(symbol, sl_price))
|
675
|
+
|
676
|
+
return sl_order_price
|
664
677
|
|
665
678
|
def set_global_stop_loss(self, symbol, position, pair_config , stop_loss_pct=None, kLines=None) -> bool:
|
666
679
|
"""设置全局止损
|
@@ -681,19 +694,9 @@ class TrailingSLTaker:
|
|
681
694
|
stop_loss_pct = self.stop_loss_pct
|
682
695
|
|
683
696
|
# 根据持仓方向计算止损价格
|
684
|
-
side = position['side']
|
685
|
-
mark_price = position['markPrice']
|
686
|
-
if side == 'long':
|
687
|
-
# tp_price = position['entryPrice'] * (1 + stop_loss_pct*2/100)
|
688
|
-
sl_price = position['entryPrice'] * (1 - stop_loss_pct/100)
|
689
|
-
|
690
|
-
|
691
|
-
elif side == 'short':
|
692
|
-
# tp_price = position['entryPrice'] * (1 - stop_loss_pct*2/100)
|
693
|
-
sl_price = position['entryPrice'] * (1 + stop_loss_pct/100)
|
694
|
-
|
697
|
+
side = position['side']
|
695
698
|
|
696
|
-
sl_order_price =
|
699
|
+
sl_order_price = self.calculate_sl_price_by_pct(symbol, side, stop_loss_pct)
|
697
700
|
# tp_order_price = float(self.round_price_to_tick(symbol, tp_price))
|
698
701
|
|
699
702
|
# 验证止损价格是否合理20250312
|
@@ -781,7 +784,7 @@ class TrailingSLTaker:
|
|
781
784
|
|
782
785
|
# 计算回撤止盈价格
|
783
786
|
def calculate_stop_loss_price(self, symbol, position, stop_loss_pct, offset=1) -> float:
|
784
|
-
tick_size = float(self.
|
787
|
+
tick_size = float(self.get_tick_size(symbol))
|
785
788
|
market_price = position['markPrice']
|
786
789
|
entry_price = position['entryPrice']
|
787
790
|
side = position['side']
|
File without changes
|
File without changes
|