openfund-maker 1.3.9__tar.gz → 1.3.10__tar.gz

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-maker
3
- Version: 1.3.9
3
+ Version: 1.3.10
4
4
  Summary: Openfund-maker.
5
5
  Requires-Python: >=3.9,<4.0
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "openfund-maker"
3
- version = "1.3.9"
3
+ version = "1.3.10"
4
4
  description = "Openfund-maker."
5
5
  authors = []
6
6
  readme = "README.md"
@@ -72,6 +72,7 @@ class MACDStrategyMaker(ThreeLineStrategyMaker):
72
72
  # 使用 TA-Lib 计算 MACD
73
73
  macd[['macd', 'signal', 'hist']] = pd.DataFrame(ta.MACD(macd['close'], fastperiod=12, slowperiod=26, signalperiod=9)).T
74
74
 
75
+ # self.logger.debug(f"{symbol} : macd = \n {macd[['timestamp','close', 'macd', 'signal', 'hist']].tail(5)}")
75
76
  # 获取最新的三个hist值
76
77
  latest_hist = macd['hist'].iloc[-3:].values
77
78
 
@@ -82,7 +83,7 @@ class MACDStrategyMaker(ThreeLineStrategyMaker):
82
83
  # 判断斜率是否同向(都为正或都为负)
83
84
  is_same_trend = (slope1 > 0 and slope2 > 0) or (slope1 < 0 and slope2 < 0)
84
85
 
85
- self.logger.debug(f"{symbol} : 最近三个hist值 {latest_hist} ,斜率 {slope1} {slope2} ,是否同向 {is_same_trend}。")
86
+ self.logger.debug(f"{symbol} : 最近三个hist值 {latest_hist} ,斜率 {slope1:.10f} {slope2:.10f} ,是否同向 {is_same_trend}。")
86
87
 
87
88
 
88
89
  return is_same_trend
@@ -196,7 +197,6 @@ class MACDStrategyMaker(ThreeLineStrategyMaker):
196
197
 
197
198
  valid_klines = pair_config.get('valid_klines', 5)
198
199
  # self.logger.debug(f"{symbol} : MACD Values = \n {df.tail(5)}")
199
- side = self.judge_order_side(symbol, kLines,valid_klines, macd_strategy)
200
200
 
201
201
  # 校验一下macd的能量柱的趋势是否一致
202
202
  is_same_trend = self.get_macd_trend_of_hist(symbol, kLines)
@@ -204,6 +204,7 @@ class MACDStrategyMaker(ThreeLineStrategyMaker):
204
204
  self.logger.debug(f"{symbol} : MACD 能量柱趋势不一致,不进行下单。")
205
205
  return
206
206
 
207
+ side = self.judge_order_side(symbol, kLines,valid_klines, macd_strategy)
207
208
  # 和HTF方向进行对比
208
209
  htf_side = self.judge_HTF_side(symbol, macd_strategy)
209
210
  if htf_side != 'none' and side != htf_side:
@@ -73,10 +73,10 @@ def main():
73
73
  # 计算下一个整点分钟
74
74
  now = datetime.now()
75
75
  # 将当前时间的秒和微秒设置为0
76
- next_run = now.replace(second=59, microsecond=0)
76
+ next_run = now.replace(second=58, microsecond=0)
77
77
  # 计算下一个周期的开始时间
78
78
  current_minute = next_run.minute
79
- # 向上取整到下一个周期时间点
79
+ # 向上取整到下一个周期时间点, 然后再减去2Units,比如秒就是58秒执行。
80
80
  next_interval = ((current_minute // monitor_interval) + 1) * monitor_interval -1
81
81
  # 如果下一个周期时间点超过60分钟,需要调整为下一个小时的对应分钟数
82
82
  if next_interval >= 60: