openfund-maker 2.1.10__py3-none-any.whl → 2.1.12__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.
- maker/BestFVGStrategyMaker.py +33 -34
- maker/SMCStrategyMaker.py +2 -1
- {openfund_maker-2.1.10.dist-info → openfund_maker-2.1.12.dist-info}/METADATA +1 -1
- {openfund_maker-2.1.10.dist-info → openfund_maker-2.1.12.dist-info}/RECORD +6 -6
- {openfund_maker-2.1.10.dist-info → openfund_maker-2.1.12.dist-info}/WHEEL +0 -0
- {openfund_maker-2.1.10.dist-info → openfund_maker-2.1.12.dist-info}/entry_points.txt +0 -0
maker/BestFVGStrategyMaker.py
CHANGED
@@ -44,7 +44,8 @@ class BestFVGStrategyMaker(SMCStrategyMaker):
|
|
44
44
|
重置所有缓存
|
45
45
|
"""
|
46
46
|
super().reset_all_cache(symbol)
|
47
|
-
self.htf_last_CHoCH
|
47
|
+
if symbol in self.htf_last_CHoCH:
|
48
|
+
self.htf_last_CHoCH.pop(symbol)
|
48
49
|
|
49
50
|
def process_pair(self,symbol,pair_config):
|
50
51
|
self.logger.info("=" * 60)
|
@@ -59,11 +60,8 @@ class BestFVGStrategyMaker(SMCStrategyMaker):
|
|
59
60
|
try:
|
60
61
|
# 检查是否有持仓,有持仓不进行下单
|
61
62
|
if self.check_position(symbol=symbol) :
|
62
|
-
self.
|
63
|
-
|
64
|
-
self.place_order_prices[symbol] = {}
|
65
|
-
if symbol in self.htf_last_CHoCH:
|
66
|
-
self.htf_last_CHoCH[symbol] = {}
|
63
|
+
self.reset_all_cache(symbol)
|
64
|
+
self.logger.info(f"{symbol} : 有持仓合约,不进行下单。")
|
67
65
|
return
|
68
66
|
|
69
67
|
|
@@ -87,41 +85,42 @@ class BestFVGStrategyMaker(SMCStrategyMaker):
|
|
87
85
|
|
88
86
|
|
89
87
|
# 初始化HTF趋势相关变量
|
90
|
-
htf_side, htf_last_CHoCH_label = None, None
|
88
|
+
htf_side, htf_last_CHoCH_label, valid_htf_struct = None, None, None
|
91
89
|
htf_struct = {"struct": "None"}
|
92
|
-
#
|
90
|
+
# 获取上一个周期的CHoCH结构
|
93
91
|
htf_last_CHoCH = self.htf_last_CHoCH.get(symbol,None)
|
94
|
-
|
92
|
+
# 获取最新的CHoCH结构
|
93
|
+
htf_struct = self.detect_struct(htf_df, prd=htf_prd) # HTF结构要严谨,prd周期要长一些
|
95
94
|
|
96
|
-
#
|
97
|
-
if
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
if htf_struct["struct"] == "None":
|
103
|
-
htf_struct = htf_last_CHoCH
|
104
|
-
self.logger.debug(f"{symbol} : {htf} 使用之前 {htf_entry_struct} struct。{htf_struct['struct']} prd={htf_prd}。")
|
95
|
+
# 处理最新结构未形成的情况,使用上一个周期的结构
|
96
|
+
if htf_struct["struct"] == "None":
|
97
|
+
if htf_last_CHoCH:
|
98
|
+
htf_last_CHoCH_label = htf_last_CHoCH["struct"]
|
99
|
+
valid_htf_struct = htf_last_CHoCH
|
100
|
+
self.logger.debug(f"{symbol} : {htf} 使用之前 {htf_entry_struct} struct。{valid_htf_struct['struct']} prd={htf_prd}。")
|
105
101
|
else:
|
106
|
-
self.logger.debug(f"{symbol} : {htf}
|
102
|
+
self.logger.debug(f"{symbol} : {htf} 未形成有效的 {htf_entry_struct} struct,不下单。")
|
103
|
+
return
|
104
|
+
else:
|
105
|
+
valid_htf_struct = htf_struct
|
106
|
+
self.logger.debug(f"{symbol} : {htf} 形成新的 {htf_entry_struct} struct。{valid_htf_struct['struct']} prd={htf_prd}。")
|
107
107
|
|
108
|
-
#
|
109
|
-
htf_struct_label =
|
110
|
-
htf_side =
|
111
|
-
if htf_struct_label == "None" and not htf_last_CHoCH:
|
112
|
-
|
108
|
+
# 检查是否已形成有效的结构
|
109
|
+
htf_struct_label = valid_htf_struct["struct"]
|
110
|
+
htf_side = valid_htf_struct["side"]
|
111
|
+
# if htf_struct_label == "None" and not htf_last_CHoCH:
|
112
|
+
# 20250417 优化: 最新的HTF_entry_struct结构要满足,才能下单。
|
113
|
+
if htf_entry_struct not in htf_struct_label :
|
114
|
+
# 如果是反转结构判断一下方向是否一致,不一致重置缓存。
|
115
|
+
if "CHoCH" in htf_struct_label and htf_last_CHoCH and htf_last_CHoCH["side"] != htf_side:
|
116
|
+
self.htf_last_CHoCH[symbol] = {}
|
117
|
+
self.logger.debug(f"{symbol} : {htf} is {htf_struct_label}, 未形成有效的 {htf_entry_struct} struct,不下单。")
|
113
118
|
return
|
114
|
-
|
115
|
-
# 更新最新的结构信息
|
116
|
-
if ltf_entry_struct in htf_struct_label and htf_struct_label != htf_last_CHoCH_label:
|
117
|
-
self.htf_last_CHoCH[symbol] = htf_struct
|
118
|
-
htf_last_CHoCH = htf_struct
|
119
|
-
htf_last_CHoCH_label = htf_struct_label
|
120
119
|
|
121
120
|
|
122
121
|
# 1. HTF 判断struct趋势(CHoCH\SMS\BMS) ,HTF struct 看趋势,CTF 看FVG和OB的位置
|
123
|
-
htf_pivot_high =
|
124
|
-
htf_pivot_low =
|
122
|
+
htf_pivot_high = valid_htf_struct["pivot_high"]
|
123
|
+
htf_pivot_low = valid_htf_struct["pivot_low"]
|
125
124
|
htf_mid_line = self.calculate_ce(symbol,htf_pivot_high,htf_pivot_low)
|
126
125
|
|
127
126
|
# 2. HTF 获取最新的两个极值点,设置折价(discount)区和溢价(premium)区
|
@@ -137,11 +136,11 @@ class BestFVGStrategyMaker(SMCStrategyMaker):
|
|
137
136
|
'ce': self.calculate_ce(symbol,htf_mid_line,htf_pivot_low)
|
138
137
|
}
|
139
138
|
|
140
|
-
self.logger.info(f"{symbol} : {htf} 趋势={htf_last_CHoCH_label}")
|
139
|
+
self.logger.info(f"{symbol} : {htf} 趋势={htf_last_CHoCH_label} 匹配 {htf_entry_struct} struct")
|
141
140
|
self.logger.debug(f"{symbol} : {htf}\npivot_high={htf_pivot_high} pivot_low={htf_pivot_low} mid_line={htf_mid_line}\n溢价区={premium_box}\n折价区={discount_box}")
|
142
141
|
|
143
142
|
# 3. find HTF FVG
|
144
|
-
pivot_index =
|
143
|
+
pivot_index = valid_htf_struct["pivot_low_index"] if htf_side == "buy" else valid_htf_struct["pivot_high_index"]
|
145
144
|
# TODO 优化: 缓存FVG,不用每次都计算,且被平衡
|
146
145
|
htf_fvg_boxes = self.find_fvg_boxes(htf_df,side=htf_side,threshold=htf_mid_line,check_balanced=False,pivot_index=pivot_index)
|
147
146
|
if len(htf_fvg_boxes) == 0:
|
maker/SMCStrategyMaker.py
CHANGED
@@ -524,7 +524,8 @@ class SMCStrategyMaker(ThreeLineStrategyMaker):
|
|
524
524
|
"""_summary_
|
525
525
|
重置所有缓存数据
|
526
526
|
"""
|
527
|
-
self.place_order_prices
|
527
|
+
if symbol in self.place_order_prices:
|
528
|
+
self.place_order_prices.pop(symbol)
|
528
529
|
|
529
530
|
def process_pair(self,symbol,pair_config):
|
530
531
|
self.logger.info("=" * 60)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
maker/BestFVGStrategyMaker.py,sha256=
|
1
|
+
maker/BestFVGStrategyMaker.py,sha256=oQk3o87AbL86fKWZiKykUJHLgFcfFYYbHl2NreCTKhQ,11701
|
2
2
|
maker/MACDStrategyMaker.py,sha256=iS5HO04piKHFJxUI2e5QmicxzGeK-V1aphJSr2n_4Ac,12651
|
3
|
-
maker/SMCStrategyMaker.py,sha256=
|
3
|
+
maker/SMCStrategyMaker.py,sha256=ThXxa-mfbxNavqok86fUg-HstMdVrBVS75TeCJCt2Ck,35087
|
4
4
|
maker/ThreeLineStrategyMaker.py,sha256=ArjnHlGECiD3cCFXxO0Ex5scR2agwoxZY-4mKukyKc4,30402
|
5
5
|
maker/WickReversalStrategyMaker.py,sha256=7DqPDVJot4EM0_lSAcFAHrR9rNvkIds9KLMoDOiAHEc,17486
|
6
6
|
maker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -10,7 +10,7 @@ maker/main_m.py,sha256=0PzDTnuBrxfpy5WDfsIHKAzZ_7pkuvuqqeWik0vpWio,15522
|
|
10
10
|
maker/okxapi.py,sha256=_9G0U_o0ZC8NxaT6PqpiLgxBm9gPobC9PsFHZE1c5w0,553
|
11
11
|
maker/zhen.py.bak,sha256=HNkrQbJts8G9umE9chEFsc0cLQApcM9KOVNMYPpkBXM,10918
|
12
12
|
maker/zhen_2.py,sha256=4IaHVtTCMSlrLGSTZrWpW2q-f7HZsUNRkW_-5QgWv24,10509
|
13
|
-
openfund_maker-2.1.
|
14
|
-
openfund_maker-2.1.
|
15
|
-
openfund_maker-2.1.
|
16
|
-
openfund_maker-2.1.
|
13
|
+
openfund_maker-2.1.12.dist-info/METADATA,sha256=FjmIQVq8KXxMzFunIUSKx8lhzVM2f3tz7V1J5bEuYqY,1954
|
14
|
+
openfund_maker-2.1.12.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
15
|
+
openfund_maker-2.1.12.dist-info/entry_points.txt,sha256=gKMytICEKcMRFQDFkHZLnIpID7UQFoTIM_xcpiiV6Ns,50
|
16
|
+
openfund_maker-2.1.12.dist-info/RECORD,,
|
File without changes
|
File without changes
|