openfund-taker 2.0.6__py3-none-any.whl → 2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openfund-taker
3
- Version: 2.0.6
3
+ Version: 2.1.0
4
4
  Summary: Openfund-taker
5
5
  Requires-Python: >=3.9,<4.0
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,8 +1,8 @@
1
1
  taker/MultiAssetOldTradingBot.py,sha256=uBh_BxglvcbaHIsWHM7GI9Qa_QjzsxXaXJAAWEOMO5c,15315
2
- taker/SMCSLAndTPTaker.py,sha256=LsigckUTA3Hu9HCrZTPjnkPrf-MNiPNZNPof-JMpJxc,20437
2
+ taker/SMCSLAndTPTaker.py,sha256=rCWoZX3ajjXCeMvBRfGy_WCClsv9UBRc4Ki5CWhRpqY,20670
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=1BNmvyK06sp5-dFW6GcYVHd3FqMcHzKQjm1U-9nFnno,46921
5
+ taker/TrailingSLTaker.py,sha256=RF6Kip3SNw7glzwbI0Wcg5Zm1LKPrd-4uPqyvwDd0xw,47231
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.0.6.dist-info/METADATA,sha256=ihptvIDo87yqixvlIb6M708tN8EGjE0jzLUG4eXW5l4,7527
15
- openfund_taker-2.0.6.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
16
- openfund_taker-2.0.6.dist-info/entry_points.txt,sha256=a7mG8F7aOA5-Gk2vPWuAR4537faxaHUgM_jwIDBZoEc,50
17
- openfund_taker-2.0.6.dist-info/RECORD,,
14
+ openfund_taker-2.1.0.dist-info/METADATA,sha256=h9SUZZ3vuoYTqPjjeeVgh9UdIwO_DmwECi1YDLYVEPw,7527
15
+ openfund_taker-2.1.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
16
+ openfund_taker-2.1.0.dist-info/entry_points.txt,sha256=a7mG8F7aOA5-Gk2vPWuAR4537faxaHUgM_jwIDBZoEc,50
17
+ openfund_taker-2.1.0.dist-info/RECORD,,
taker/SMCSLAndTPTaker.py CHANGED
@@ -360,19 +360,23 @@ class SMCSLAndTPTaker(TrailingSLTaker):
360
360
 
361
361
  sl_price = self.global_symbol_stop_loss_price.get(symbol, float(position['markPrice']))
362
362
  entry_price = float(position['entryPrice'])
363
-
363
+ threshold = 0.0
364
364
  if is_buy and sl_price > 0 :
365
- threshold = (entry_price - sl_price ) * tp_sl_ratio + entry_price
365
+ threshold = float(self.round_price_to_tick(symbol, (entry_price - sl_price ) * tp_sl_ratio + entry_price))
366
366
  elif not is_buy and sl_price > 0:
367
- threshold = entry_price - (sl_price - entry_price ) * tp_sl_ratio
368
-
367
+ threshold = float(self.round_price_to_tick(symbol, entry_price - (sl_price - entry_price ) * tp_sl_ratio))
368
+
369
369
 
370
370
  # 过滤有效的流动性价格
371
371
  valid_mask = df_liquidities[price_col] > threshold if is_buy else df_liquidities[price_col] < threshold
372
372
  df_valid_liquidities = df_liquidities[valid_mask]
373
373
  self.logger.debug(f"{symbol} : threshold={threshold} sl_price={sl_price} 有效的流动=\n {df_valid_liquidities[['timestamp','Up','Dn']]}")
374
374
  # 获取止盈价格
375
- tp_price = df_valid_liquidities.iloc[0][price_col] if len(df_valid_liquidities) > 0 else 0.0
375
+ tp_price = df_valid_liquidities.iloc[0][price_col] if len(df_valid_liquidities) > 0 else threshold
376
+ if is_buy:
377
+ tp_price = max(tp_price, threshold)
378
+ else:
379
+ tp_price = min(tp_price, threshold)
376
380
  tick_size = self.get_tick_size(symbol)
377
381
 
378
382
  # 计算止盈价格 , 做多则止盈价格在流动性之下tick_size,做空则止盈价格在流动性之上tick_size。
taker/TrailingSLTaker.py CHANGED
@@ -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)} ={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
 
@@ -1041,6 +1041,10 @@ class TrailingSLTaker:
1041
1041
  self.reset_all_cache(symbol)
1042
1042
  self.positions_entry_price[symbol] = cur_entry_price
1043
1043
 
1044
+ msg = f"{symbol} : ## 新开仓。 入场方向={position['side']} 入场价格={cur_entry_price} ##"
1045
+ self.logger.info(msg)
1046
+ self.send_feishu_notification(msg)
1047
+
1044
1048
  self.check_total_profit(symbol, position)
1045
1049
  time.sleep(0.1)
1046
1050
  # 检查仓位和挂单是否有问题