openfund-taker 1.3.15__py3-none-any.whl → 1.3.16__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.15.dist-info → openfund_taker-1.3.16.dist-info}/METADATA +1 -1
- {openfund_taker-1.3.15.dist-info → openfund_taker-1.3.16.dist-info}/RECORD +5 -5
- taker/TrailingSLTaker.py +8 -7
- {openfund_taker-1.3.15.dist-info → openfund_taker-1.3.16.dist-info}/WHEEL +0 -0
- {openfund_taker-1.3.15.dist-info → openfund_taker-1.3.16.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=ivFTwsNTWVudoqm6cQ-f8-qfyRWfs30o_35t-_HK6Ss,45157
|
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.16.dist-info/METADATA,sha256=g_EzHbpGM8RDz1TKojQILOF2OkWT9x2T_3m9C4iExTE,7528
|
14
|
+
openfund_taker-1.3.16.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
15
|
+
openfund_taker-1.3.16.dist-info/entry_points.txt,sha256=a7mG8F7aOA5-Gk2vPWuAR4537faxaHUgM_jwIDBZoEc,50
|
16
|
+
openfund_taker-1.3.16.dist-info/RECORD,,
|
taker/TrailingSLTaker.py
CHANGED
@@ -134,14 +134,14 @@ class TrailingSLTaker:
|
|
134
134
|
else:
|
135
135
|
raise ValueError("Unexpected response structure or missing candlestick data")
|
136
136
|
|
137
|
-
def get_last_solated_point(self,symbol,position,kLines):
|
137
|
+
def get_last_solated_point(self,symbol,position,kLines,prd=20):
|
138
138
|
# 将K线数据转换为DataFrame格式,最后一个数据可能未完成。
|
139
139
|
df = pd.DataFrame(kLines, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume'])
|
140
140
|
df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms')
|
141
141
|
|
142
142
|
# 根据position方向寻找孤立点
|
143
143
|
side = position['side']
|
144
|
-
window =
|
144
|
+
window = prd # 设置窗口大小,用于判断局部最值
|
145
145
|
|
146
146
|
if side == 'short':
|
147
147
|
# 找最近的孤立高点
|
@@ -606,7 +606,7 @@ class TrailingSLTaker:
|
|
606
606
|
return True
|
607
607
|
|
608
608
|
|
609
|
-
def set_global_stop_loss(self, symbol, position, stop_loss_pct=None):
|
609
|
+
def set_global_stop_loss(self, symbol, position, stop_loss_pct=None,find_swing_point=False):
|
610
610
|
"""设置全局止损
|
611
611
|
|
612
612
|
Args:
|
@@ -654,13 +654,13 @@ class TrailingSLTaker:
|
|
654
654
|
return
|
655
655
|
|
656
656
|
# 250228 没有指定止损回撤阈值stop_loss_pct...
|
657
|
-
if
|
657
|
+
if find_swing_point :
|
658
658
|
pair_config = self.trading_pairs_config.get(symbol, {})
|
659
659
|
klines_period = str(pair_config.get('klines_period', '1m'))
|
660
660
|
kLines = self.get_historical_klines_except_last(symbol=symbol,bar=klines_period)
|
661
|
-
|
661
|
+
swing_points_length = str(pair_config.get('swing_points_length', 20))
|
662
662
|
if kLines:
|
663
|
-
isolated_point = self.get_last_solated_point(symbol ,position , kLines)
|
663
|
+
isolated_point = self.get_last_solated_point(symbol ,position , kLines,prd=swing_points_length)
|
664
664
|
|
665
665
|
if len(isolated_point) > 0 :
|
666
666
|
last_isolated_point = float(isolated_point.iloc[-1])
|
@@ -929,7 +929,8 @@ class TrailingSLTaker:
|
|
929
929
|
else:
|
930
930
|
|
931
931
|
# 默认全局止损
|
932
|
-
|
932
|
+
find_swing_point = pair_config.get('open_swing_point', False)
|
933
|
+
self.set_global_stop_loss(symbol, position, find_swing_point=find_swing_point)
|
933
934
|
self.logger.info(f"{symbol}: 全局止损阈值: {self.stop_loss_pct:.2f}%")
|
934
935
|
|
935
936
|
return
|
File without changes
|
File without changes
|