openfund-maker 1.3.13__py3-none-any.whl → 1.3.15__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.
@@ -109,22 +109,22 @@ class MACDStrategyMaker(ThreeLineStrategyMaker):
109
109
 
110
110
  # valid_klines = strategy.get('valid_klines', 5)
111
111
  # 如果最新的交叉是金叉,且又是零轴上方的金叉
112
- if (len(last_up_crosses) > 0 and
113
- all_cross[0][0] == 'golden' and
114
- all_cross[0][1] == last_up_crosses[0][1] and
115
- len(kLines) - all_cross[0][1] <= valid_klines):
116
- order_side = 'buy'
117
- self.logger.debug(f"{symbol} : 零轴之上的macd与signal形成金叉{all_cross[0]} 。")
112
+ # if (len(last_up_crosses) > 0 and
113
+ # all_cross[0][0] == 'golden' and
114
+ # all_cross[0][1] == last_up_crosses[0][1] and
115
+ # len(kLines) - all_cross[0][1] <= valid_klines):
116
+ # order_side = 'buy'
117
+ # self.logger.debug(f"{symbol} : 零轴之上的macd与signal形成金叉{all_cross[0]} 。")
118
118
 
119
- # # 如果最新的交叉是死叉,且又是零轴下方的死叉
120
- elif (len(last_down_crosses) > 0 and
121
- all_cross[0][0] == 'death' and
122
- all_cross[0][1] == last_down_crosses[0][1] and
123
- len(kLines) - all_cross[0][1] <= valid_klines):
124
- order_side ='sell'
125
- self.logger.debug(f"{symbol} : 零轴之下的macd与signal形成死叉{all_cross[0]} 。")
119
+ # # # 如果最新的交叉是死叉,且又是零轴下方的死叉
120
+ # elif (len(last_down_crosses) > 0 and
121
+ # all_cross[0][0] == 'death' and
122
+ # all_cross[0][1] == last_down_crosses[0][1] and
123
+ # len(kLines) - all_cross[0][1] <= valid_klines):
124
+ # order_side ='sell'
125
+ # self.logger.debug(f"{symbol} : 零轴之下的macd与signal形成死叉{all_cross[0]} 。")
126
126
  # 分析交叉点模式,要满足连续的三个交叉都是零上
127
- elif len(last_up_crosses) == 3 and len(all_cross) == 3:
127
+ if len(last_up_crosses) == 3 and len(all_cross) == 3:
128
128
 
129
129
  # 零轴之上的死叉-金叉-死叉模式
130
130
  if (last_up_crosses[0][0] == 'death' and
@@ -153,24 +153,28 @@ class MACDStrategyMaker(ThreeLineStrategyMaker):
153
153
 
154
154
  order_side = 'none'
155
155
  try:
156
+ # 20250312 增加validate_mode, 0: 严格模式,用MACD形态校验 1: 宽松模式,只看K线金叉死叉
157
+ validate_mode = int(strategy.get('validate_mode', 0))
156
158
  htf = str(strategy.get('HTF', '1h'))
157
159
  htf_kLines = self.get_historical_klines(symbol=symbol, bar=htf)
158
160
 
159
- # 20250312 修改为MACD形态校验,而不只是金死叉
160
- order_side = self.judge_order_side(symbol, kLines=htf_kLines)
161
- self.logger.debug(f"{symbol} : HTF={htf} , {order_side}。")
162
- # crosses = self.get_macd_cross_direction(symbol, htf_kLines, strategy)
163
- # all_cross = crosses.get('all_cross',[])
164
- # if len(all_cross) > 1:
165
- # if all_cross[0][0] == 'golden':
166
- # order_side = 'buy'
167
- # else:
168
- # order_side = 'sell'
169
-
170
- # self.logger.debug(f"{symbol} : HTF={htf} , {order_side}。")
161
+ if validate_mode == 0 : # 0: 严格模式,用MACD形态校验
162
+ # 20250312 修改为MACD形态校验,而不只是金死叉
163
+ order_side = self.judge_order_side(symbol, kLines=htf_kLines)
164
+ self.logger.debug(f"{symbol} : HTF={htf} , {order_side}。")
165
+ else: # 1: 宽松模式,只看K线金叉死叉
166
+ crosses = self.get_macd_cross_direction(symbol, htf_kLines, strategy)
167
+ all_cross = crosses.get('all_cross',[])
168
+ if len(all_cross) > 1:
169
+ if all_cross[0][0] == 'golden':
170
+ order_side = 'buy'
171
+ else:
172
+ order_side = 'sell'
173
+
174
+ self.logger.debug(f"{symbol} : HTF={htf} , {order_side}。")
171
175
 
172
- # else:
173
- # self.logger.debug(f"{symbol} : HTF={htf} ,没有满足条件的交叉点。")
176
+ else:
177
+ self.logger.debug(f"{symbol} : HTF={htf} ,没有满足条件的交叉点。")
174
178
 
175
179
  except Exception as e:
176
180
  error_message = f"程序异常退出: {str(e)}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openfund-maker
3
- Version: 1.3.13
3
+ Version: 1.3.15
4
4
  Summary: Openfund-maker.
5
5
  Requires-Python: >=3.9,<4.0
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,4 +1,4 @@
1
- maker/MACDStrategyMaker.py,sha256=7qH295CZrnGgJr9THo_EYZ65R5mni6DlSaw_8tTWSWY,12252
1
+ maker/MACDStrategyMaker.py,sha256=iS5HO04piKHFJxUI2e5QmicxzGeK-V1aphJSr2n_4Ac,12651
2
2
  maker/ThreeLineStrategyMaker.py,sha256=5uUTRMOCe0-0d2Ll7Bzhe-0WKpnfddhDEaj3XTGDgyA,30270
3
3
  maker/WickReversalStrategyMaker.py,sha256=7DqPDVJot4EM0_lSAcFAHrR9rNvkIds9KLMoDOiAHEc,17486
4
4
  maker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -8,7 +8,7 @@ maker/main_m.py,sha256=0PzDTnuBrxfpy5WDfsIHKAzZ_7pkuvuqqeWik0vpWio,15522
8
8
  maker/okxapi.py,sha256=_9G0U_o0ZC8NxaT6PqpiLgxBm9gPobC9PsFHZE1c5w0,553
9
9
  maker/zhen.py.bak,sha256=HNkrQbJts8G9umE9chEFsc0cLQApcM9KOVNMYPpkBXM,10918
10
10
  maker/zhen_2.py,sha256=4IaHVtTCMSlrLGSTZrWpW2q-f7HZsUNRkW_-5QgWv24,10509
11
- openfund_maker-1.3.13.dist-info/METADATA,sha256=82LdYVRVcA-0gddtCmDItaA2J2TgsKmopVYWqH6V9Qc,1954
12
- openfund_maker-1.3.13.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
13
- openfund_maker-1.3.13.dist-info/entry_points.txt,sha256=gKMytICEKcMRFQDFkHZLnIpID7UQFoTIM_xcpiiV6Ns,50
14
- openfund_maker-1.3.13.dist-info/RECORD,,
11
+ openfund_maker-1.3.15.dist-info/METADATA,sha256=Owok3SrtHJfxyx8TvF0gk8WKZEyqD8kFmOkS-_T9UpQ,1954
12
+ openfund_maker-1.3.15.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
13
+ openfund_maker-1.3.15.dist-info/entry_points.txt,sha256=gKMytICEKcMRFQDFkHZLnIpID7UQFoTIM_xcpiiV6Ns,50
14
+ openfund_maker-1.3.15.dist-info/RECORD,,