openfund-maker 1.2.4__tar.gz → 1.2.7__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.2.4
3
+ Version: 1.2.7
4
4
  Summary: Openfund-maker.
5
5
  Requires-Python: >=3.9,<4.0
6
6
  Classifier: Programming Language :: Python :: 3
@@ -9,11 +9,10 @@ Classifier: Programming Language :: Python :: 3.10
9
9
  Classifier: Programming Language :: Python :: 3.11
10
10
  Classifier: Programming Language :: Python :: 3.12
11
11
  Classifier: Programming Language :: Python :: 3.13
12
+ Requires-Dist: TA-Lib (>=0.6.3,<0.7.0)
12
13
  Requires-Dist: ccxt (>=4.4.26,<5.0.0)
13
14
  Requires-Dist: pandas (>=2.2.3,<3.0.0)
14
- Requires-Dist: pydantic-settings (>=2.1.0,<3.0.0)
15
- Requires-Dist: python-okx (>=0.3.5,<0.4.0)
16
- Requires-Dist: requests (>=2.27.1,<3.0.0)
15
+ Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
17
16
  Description-Content-Type: text/markdown
18
17
 
19
18
  # jiezhen
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "openfund-maker"
3
- version = "1.2.4"
3
+ version = "1.2.7"
4
4
  description = "Openfund-maker."
5
5
  authors = []
6
6
  readme = "README.md"
@@ -11,10 +11,9 @@ packages = [
11
11
  [tool.poetry.dependencies]
12
12
  python = "^3.9"
13
13
  ccxt = "^4.4.26"
14
- requests = "^2.27.1"
15
- pydantic-settings = "^2.1.0"
16
- python-okx = "^0.3.5"
17
14
  pandas = "^2.2.3"
15
+ TA-Lib = "^0.6.3"
16
+ pyyaml = "^6.0.2"
18
17
 
19
18
 
20
19
  [tool.poetry.group.dev.dependencies]
@@ -63,7 +63,7 @@ class MACDOrdergBot(ThreeLineOrdergBot):
63
63
  break
64
64
 
65
65
  self.logger.debug(f"{symbol} : \n- 所有cross {all_cross} \n- 零轴之上cross {last_up_crosses} \n- 零轴之下cross {last_down_crosses} \n- 其他corss {other_crosses}。")
66
- valid_klines = pair_config.get('valid_klines', 3)
66
+ valid_klines = pair_config.get('valid_klines', 5)
67
67
  # 如果最新的交叉是金叉,且又是零轴上方的金叉
68
68
  if len(last_up_crosses) > 0 and all_cross[0][0] == 'golden' and all_cross[0][1] == last_up_crosses[0][1] and len(macd) - all_cross[0][1] <= valid_klines:
69
69
  order_side = 'buy'
@@ -79,7 +79,9 @@ class MACDOrdergBot(ThreeLineOrdergBot):
79
79
  # 零轴之上的死叉-金叉-死叉模式
80
80
  if (last_up_crosses[0][0] == 'death' and
81
81
  last_up_crosses[1][0] == 'golden' and
82
- last_up_crosses[2][0] == 'death'):
82
+ last_up_crosses[2][0] == 'death' and
83
+ len(macd) - last_up_crosses[0][1] <= valid_klines
84
+ ):
83
85
  order_side = 'sell'
84
86
  self.logger.debug(f"{symbol} : 零轴之上的死叉-金叉-死叉模式 {order_side}。")
85
87
 
@@ -87,7 +89,9 @@ class MACDOrdergBot(ThreeLineOrdergBot):
87
89
  # 零轴之下的金叉-死叉-金叉模式
88
90
  if (last_down_crosses[0][0] == 'golden' and
89
91
  last_down_crosses[1][0] == 'death' and
90
- last_down_crosses[2][0] == 'golden'):
92
+ last_down_crosses[2][0] == 'golden' and
93
+ len(macd) - last_down_crosses[0][1] <= valid_klines
94
+ ):
91
95
  order_side = 'buy'
92
96
  self.logger.debug(f"{symbol} : 零轴之下的金叉-死叉-金叉模式 {order_side}。")
93
97
 
@@ -1,6 +1,5 @@
1
- import os
2
- import json
3
1
  import logging
2
+ import yaml
4
3
  from logging.handlers import TimedRotatingFileHandler
5
4
 
6
5
  from maker.WickReversalOrderBot import WickReversalOrderBot
@@ -25,13 +24,24 @@ def build_logger(log_config) -> logging.Logger:
25
24
 
26
25
  return logger
27
26
 
27
+ def read_config_file(file_path):
28
+ try:
29
+ # 打开 YAML 文件
30
+ with open(file_path, 'r', encoding='utf-8') as file:
31
+ # 使用 yaml.safe_load 方法解析 YAML 文件内容
32
+ data = yaml.safe_load(file)
33
+ return data
34
+ except FileNotFoundError:
35
+ raise Exception(f"文件 {file_path} 未找到。")
36
+ except yaml.YAMLError as e:
37
+ raise Exception(f"解析 {file_path} 文件时出错: {e}")
38
+
28
39
  def main():
29
40
  import importlib.metadata
30
41
  version = importlib.metadata.version("openfund-maker")
31
-
32
- wick_reversal_config_path = 'config.json'
33
- with open(wick_reversal_config_path, 'r') as f:
34
- config_data = json.load(f)
42
+
43
+ maker_config_path = 'maker_config.yaml'
44
+ config_data = read_config_file(maker_config_path)
35
45
 
36
46
  platform_config = config_data['okx']
37
47
  feishu_webhook_url = config_data['feishu_webhook']
File without changes