openfund-taker 2.0.6__py3-none-any.whl → 2.1.1__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.0.6.dist-info → openfund_taker-2.1.1.dist-info}/METADATA +1 -1
- {openfund_taker-2.0.6.dist-info → openfund_taker-2.1.1.dist-info}/RECORD +6 -6
- taker/SMCSLAndTPTaker.py +13 -6
- taker/TrailingSLTaker.py +8 -2
- {openfund_taker-2.0.6.dist-info → openfund_taker-2.1.1.dist-info}/WHEEL +0 -0
- {openfund_taker-2.0.6.dist-info → openfund_taker-2.1.1.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=nBCT6bRxD5ZP8HJRYTSALNIAiHdZwukvpyDn99J6_T4,20821
|
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=KpQKPiUtBiP2uursW9gMnyFbiTzZJwYUSrX5UOAZ_NE,47301
|
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.
|
15
|
-
openfund_taker-2.
|
16
|
-
openfund_taker-2.
|
17
|
-
openfund_taker-2.
|
14
|
+
openfund_taker-2.1.1.dist-info/METADATA,sha256=oYLwkyUp-G4kD4E-oHGTSno6erhCOAtw5Osoo0DXCdw,7527
|
15
|
+
openfund_taker-2.1.1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
16
|
+
openfund_taker-2.1.1.dist-info/entry_points.txt,sha256=a7mG8F7aOA5-Gk2vPWuAR4537faxaHUgM_jwIDBZoEc,50
|
17
|
+
openfund_taker-2.1.1.dist-info/RECORD,,
|
taker/SMCSLAndTPTaker.py
CHANGED
@@ -283,7 +283,10 @@ class SMCSLAndTPTaker(TrailingSLTaker):
|
|
283
283
|
else:
|
284
284
|
|
285
285
|
# 默认全局止损
|
286
|
-
self.set_global_stop_loss(symbol=symbol, position=position, pair_config=pair_config ,kLines = kLines)
|
286
|
+
if_success = self.set_global_stop_loss(symbol=symbol, position=position, pair_config=pair_config ,kLines = kLines)
|
287
|
+
if if_success:
|
288
|
+
# 更新回撤止损价格
|
289
|
+
self.global_symbol_take_profit_flag[symbol] = False
|
287
290
|
|
288
291
|
def find_liquidity(self, symbol, data, side) -> pd.DataFrame:
|
289
292
|
"""
|
@@ -360,19 +363,23 @@ class SMCSLAndTPTaker(TrailingSLTaker):
|
|
360
363
|
|
361
364
|
sl_price = self.global_symbol_stop_loss_price.get(symbol, float(position['markPrice']))
|
362
365
|
entry_price = float(position['entryPrice'])
|
363
|
-
|
366
|
+
threshold = 0.0
|
364
367
|
if is_buy and sl_price > 0 :
|
365
|
-
threshold = (entry_price - sl_price ) * tp_sl_ratio + entry_price
|
368
|
+
threshold = float(self.round_price_to_tick(symbol, (entry_price - sl_price ) * tp_sl_ratio + entry_price))
|
366
369
|
elif not is_buy and sl_price > 0:
|
367
|
-
threshold =
|
368
|
-
|
370
|
+
threshold = float(self.round_price_to_tick(symbol, entry_price - (sl_price - entry_price ) * tp_sl_ratio))
|
371
|
+
|
369
372
|
|
370
373
|
# 过滤有效的流动性价格
|
371
374
|
valid_mask = df_liquidities[price_col] > threshold if is_buy else df_liquidities[price_col] < threshold
|
372
375
|
df_valid_liquidities = df_liquidities[valid_mask]
|
373
376
|
self.logger.debug(f"{symbol} : threshold={threshold} sl_price={sl_price} 有效的流动=\n {df_valid_liquidities[['timestamp','Up','Dn']]}")
|
374
377
|
# 获取止盈价格
|
375
|
-
tp_price = df_valid_liquidities.iloc[0][price_col] if len(df_valid_liquidities) > 0 else
|
378
|
+
tp_price = df_valid_liquidities.iloc[0][price_col] if len(df_valid_liquidities) > 0 else threshold
|
379
|
+
if is_buy:
|
380
|
+
tp_price = max(tp_price, threshold)
|
381
|
+
else:
|
382
|
+
tp_price = min(tp_price, threshold)
|
376
383
|
tick_size = self.get_tick_size(symbol)
|
377
384
|
|
378
385
|
# 计算止盈价格 , 做多则止盈价格在流动性之下tick_size,做空则止盈价格在流动性之上tick_size。
|
taker/TrailingSLTaker.py
CHANGED
@@ -662,7 +662,7 @@ class TrailingSLTaker:
|
|
662
662
|
return True
|
663
663
|
|
664
664
|
|
665
|
-
def set_global_stop_loss(self, symbol, position, pair_config , stop_loss_pct=None, kLines=None):
|
665
|
+
def set_global_stop_loss(self, symbol, position, pair_config , stop_loss_pct=None, kLines=None) -> bool:
|
666
666
|
"""设置全局止损
|
667
667
|
|
668
668
|
Args:
|
@@ -672,7 +672,7 @@ class TrailingSLTaker:
|
|
672
672
|
|
673
673
|
"""
|
674
674
|
# 如果已经触发过全局止损并且有止损单,则跳过
|
675
|
-
self.logger.debug(f"{symbol} : 是否设置过全局止损 {self.global_symbol_stop_loss_flag.get(symbol, False)} ")
|
675
|
+
self.logger.debug(f"{symbol} : 是否设置过全局止损 {self.global_symbol_stop_loss_flag.get(symbol, False)} global_sl_price={self.global_symbol_stop_loss_price.get(symbol, 0.0)}")
|
676
676
|
if self.global_symbol_stop_loss_flag.get(symbol, False):
|
677
677
|
return
|
678
678
|
|
@@ -753,6 +753,8 @@ class TrailingSLTaker:
|
|
753
753
|
self.global_symbol_stop_loss_flag[symbol] = True
|
754
754
|
self.global_symbol_stop_loss_price[symbol] = sl_order_price
|
755
755
|
|
756
|
+
return if_success
|
757
|
+
|
756
758
|
except Exception as e:
|
757
759
|
error_msg = f"{symbol} : 设置止损时发生错误, {str(e)}"
|
758
760
|
self.logger.error(error_msg)
|
@@ -1041,6 +1043,10 @@ class TrailingSLTaker:
|
|
1041
1043
|
self.reset_all_cache(symbol)
|
1042
1044
|
self.positions_entry_price[symbol] = cur_entry_price
|
1043
1045
|
|
1046
|
+
msg = f"{symbol} : ## 新开仓。 入场方向={position['side']} 入场价格={cur_entry_price} ##"
|
1047
|
+
self.logger.info(msg)
|
1048
|
+
self.send_feishu_notification(msg)
|
1049
|
+
|
1044
1050
|
self.check_total_profit(symbol, position)
|
1045
1051
|
time.sleep(0.1)
|
1046
1052
|
# 检查仓位和挂单是否有问题
|
File without changes
|
File without changes
|