quant1x 0.6.26__tar.gz → 0.6.28__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.
Files changed (39) hide show
  1. {quant1x-0.6.26 → quant1x-0.6.28}/PKG-INFO +2 -1
  2. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/base.py +5 -1
  3. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/cache.py +11 -4
  4. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x.egg-info/PKG-INFO +2 -1
  5. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x.egg-info/requires.txt +1 -0
  6. {quant1x-0.6.26 → quant1x-0.6.28}/LICENSE +0 -0
  7. {quant1x-0.6.26 → quant1x-0.6.28}/README.md +0 -0
  8. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/__init__.py +0 -0
  9. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/__init__.py +0 -0
  10. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/app.py +0 -0
  11. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/basic.py +0 -0
  12. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/config.py +0 -0
  13. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/device.py +0 -0
  14. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/devp.py +0 -0
  15. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/exchange.py +0 -0
  16. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/file.py +0 -0
  17. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/logger.py +0 -0
  18. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/market.py +0 -0
  19. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/network.py +0 -0
  20. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/numerics.py +0 -0
  21. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/pattern.py +0 -0
  22. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/timestamp.py +0 -0
  23. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/base/version.py +0 -0
  24. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/chart.py +0 -0
  25. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/data/__init__.py +0 -0
  26. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/data/quotes.py +0 -0
  27. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/formula/__init__.py +0 -0
  28. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/formula/formula.py +0 -0
  29. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/formula/formula_plus.py +0 -0
  30. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/indicators/__init__.py +0 -0
  31. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/indicators/ma1x.py +0 -0
  32. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/util/__init__.py +0 -0
  33. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x/util/font.py +0 -0
  34. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x.egg-info/SOURCES.txt +0 -0
  35. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x.egg-info/dependency_links.txt +0 -0
  36. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x.egg-info/not-zip-safe +0 -0
  37. {quant1x-0.6.26 → quant1x-0.6.28}/quant1x.egg-info/top_level.txt +0 -0
  38. {quant1x-0.6.26 → quant1x-0.6.28}/setup.cfg +0 -0
  39. {quant1x-0.6.26 → quant1x-0.6.28}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quant1x
3
- Version: 0.6.26
3
+ Version: 0.6.28
4
4
  Summary: Quant1X量化研究
5
5
  Home-page: https://gitee.com/quant1x/quant1x
6
6
  Author: WangFeng
@@ -46,6 +46,7 @@ Requires-Dist: scipy~=1.16.0
46
46
  Requires-Dist: caerus~=1.0.1
47
47
  Requires-Dist: joblib~=1.5.1
48
48
  Requires-Dist: numba~=0.61.2
49
+ Requires-Dist: inflection~=0.5.1
49
50
  Dynamic: author
50
51
  Dynamic: author-email
51
52
  Dynamic: classifier
@@ -16,8 +16,12 @@ def get_quant1x_config_filename() -> str:
16
16
  yaml_filename = os.path.join('~', 'runtime', 'etc', default_config_filename)
17
17
  yaml_filename = os.path.expanduser(yaml_filename)
18
18
  user_home = file.homedir()
19
+ quant1x_work = 'quant1x'
20
+ quant1x_work_env = file.env('QUANT1X_WORK')
21
+ if len(quant1x_work_env) > 0:
22
+ quant1x_work = quant1x_work_env
19
23
  if not os.path.isfile(yaml_filename):
20
- quant1x_root = os.path.join(user_home, '.quant1x')
24
+ quant1x_root = os.path.join(user_home, f'.{quant1x_work}')
21
25
  yaml_filename = os.path.join(quant1x_root, default_config_filename)
22
26
  yaml_filename = os.path.expanduser(yaml_filename)
23
27
  yaml_filename = os.path.expanduser(yaml_filename)
@@ -10,6 +10,7 @@ from dateutil import parser
10
10
  from pandas import DataFrame
11
11
 
12
12
  from quant1x.base import base, exchange
13
+ import inflection
13
14
 
14
15
 
15
16
  @lru_cache(maxsize=None)
@@ -43,19 +44,23 @@ def stock_name(code: str) -> str:
43
44
  return name
44
45
 
45
46
 
46
- def klines(code: str) -> pd.DataFrame | None:
47
+ def klines(code: str, freq:str = 'D') -> pd.DataFrame | None:
47
48
  """
48
49
  获取缓存的日线数据
49
50
  """
50
51
  corrected_symbol = exchange.correct_security_code(code)
51
52
  suffix_length = 3 # 修正拼写并明确表示后缀长度
52
- symbol_directory = os.path.join(base.config.kline_path, corrected_symbol[:-suffix_length]) # 更清晰表达目录用途
53
+ freq_path = 'day' if freq == 'D' else freq
54
+ symbol_directory = os.path.join(base.config.data_path, freq_path, corrected_symbol[:-suffix_length]) # 更清晰表达目录用途
53
55
  file_extension = '.csv'
54
56
  filename = f"{corrected_symbol}{file_extension}" # 使用f-string格式化
55
57
  full_path = os.path.join(symbol_directory, filename)
56
58
 
57
59
  if os.path.isfile(full_path):
58
- return pd.read_csv(full_path)
60
+ df = pd.read_csv(full_path)
61
+ # 转换所有列名为 snake_case
62
+ df.columns = [inflection.underscore(col) for col in df.columns]
63
+ return df
59
64
  return None
60
65
 
61
66
 
@@ -243,7 +248,9 @@ def get_tick_transaction(code: str, date: str) -> DataFrame | None:
243
248
  full_path = os.path.join(base_path, year, cache_date, filename)
244
249
 
245
250
  if os.path.isfile(full_path):
246
- return pd.read_csv(full_path)
251
+ df = pd.read_csv(full_path)
252
+ df.columns = [col.lower() for col in df.columns]
253
+ return df
247
254
  return None
248
255
 
249
256
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quant1x
3
- Version: 0.6.26
3
+ Version: 0.6.28
4
4
  Summary: Quant1X量化研究
5
5
  Home-page: https://gitee.com/quant1x/quant1x
6
6
  Author: WangFeng
@@ -46,6 +46,7 @@ Requires-Dist: scipy~=1.16.0
46
46
  Requires-Dist: caerus~=1.0.1
47
47
  Requires-Dist: joblib~=1.5.1
48
48
  Requires-Dist: numba~=0.61.2
49
+ Requires-Dist: inflection~=0.5.1
49
50
  Dynamic: author
50
51
  Dynamic: author-email
51
52
  Dynamic: classifier
@@ -23,3 +23,4 @@ scipy~=1.16.0
23
23
  caerus~=1.0.1
24
24
  joblib~=1.5.1
25
25
  numba~=0.61.2
26
+ inflection~=0.5.1
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes