equal-data 0.0.1__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.
@@ -0,0 +1,78 @@
1
+ Metadata-Version: 2.4
2
+ Name: equal-data
3
+ Version: 0.0.1
4
+ Summary: 金融数据获取 Skill,支持 100+ 个金融数据接口。kjiujing 官方提供的SKILL工具包。
5
+ Project-URL: Homepage, https://github.com/username/my_project
6
+ Project-URL: Documentation, https://readthedocs.org
7
+ Project-URL: Repository, https://github.com/username/my_project.git
8
+ Project-URL: Issues, https://github.com/username/my_project/issues
9
+ Author-email: wangyanlei <wangyanlei310@163.com>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: package,pypi,tutorial
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Requires-Python: >=3.8
23
+ Provides-Extra: dev
24
+ Requires-Dist: black; extra == 'dev'
25
+ Requires-Dist: mypy; extra == 'dev'
26
+ Requires-Dist: pytest>=7.0; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # My Package
30
+
31
+ TuShare
32
+ ===============
33
+
34
+
35
+ * easy to use as most of the data returned are pandas DataFrame objects
36
+ * can be easily saved as csv, excel or json files
37
+ * can be inserted into MySQL or Mongodb
38
+
39
+ Target Users
40
+ --------------
41
+
42
+ * financial market analyst of China
43
+ * learners of financial data analysis with pandas/NumPy
44
+ * people who are interested in China financial data
45
+
46
+ Installation
47
+ --------------
48
+
49
+ pip install kjiujing
50
+
51
+ Upgrade
52
+ ---------------
53
+
54
+ pip install kjiujing --upgrade
55
+
56
+ Quick Start
57
+ --------------
58
+
59
+ ::
60
+
61
+ import kjiujing as kjj
62
+
63
+ ts.get_hist_data('600848')
64
+
65
+ return::
66
+
67
+ open high close low volume p_change ma5
68
+ date
69
+ 2012-01-11 6.880 7.380 7.060 6.880 14129.96 2.62 7.060
70
+ 2012-01-12 7.050 7.100 6.980 6.900 7895.19 -1.13 7.020
71
+ 2012-01-13 6.950 7.000 6.700 6.690 6611.87 -4.01 6.913
72
+ 2012-01-16 6.680 6.750 6.510 6.480 2941.63 -2.84 6.813
73
+ 2012-01-17 6.660 6.880 6.860 6.460 8642.57 5.38 6.822
74
+ 2012-01-18 7.000 7.300 6.890 6.880 13075.40 0.44 6.788
75
+ 2012-01-19 6.690 6.950 6.890 6.680 6117.32 0.00 6.770
76
+ 2012-01-20 6.870 7.080 7.010 6.870 6813.09 1.74 6.832
77
+
78
+
@@ -0,0 +1,10 @@
1
+ kjj/__init__.py,sha256=sw20U7F2s_ZjK8A7eB4UeE3LukBcNHKaqNBuIti6zlk,125
2
+ kjj/core.py,sha256=GajYHpaWpH-3zas7yLikrnIZgIatZbMVurHjpoYjCFI,1761
3
+ kjj/common/__init__.py,sha256=xMCjtvFG_DyqxQdbo447ct3g2y9gk1fMImU7OFReS6k,232
4
+ kjj/common/conf.py,sha256=1i6MjxDUkT-5ezhoc2t-r5erWP1htCHmnGv-CBqADD4,303
5
+ kjj/utils/__init__.py,sha256=YG9D83G5wFQxfNVc4m_-sK28akWj3IJ-iRoEbPSrEXQ,232
6
+ kjj/utils/common_tools.py,sha256=4hv9D-8tiPGFeN1V55oKrvVFwrk0QiJhrpx4hfOpLP4,477
7
+ equal_data-0.0.1.dist-info/METADATA,sha256=SG5QkRM5q_neOKyuu0r9pyyoa71eZDDFPEKJ54PH9t4,2453
8
+ equal_data-0.0.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
9
+ equal_data-0.0.1.dist-info/licenses/LICENSE,sha256=uWhtT-4fO0SC4MkKp8gAAg7Kn-OO4GQSiuYcGFklb50,257
10
+ equal_data-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,10 @@
1
+
2
+ ### LICENSE
3
+ ```text
4
+ MIT License
5
+
6
+ Copyright (c) 2024 Your Name
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction...
kjj/__init__.py ADDED
@@ -0,0 +1,8 @@
1
+ """ 通过请求api 返回最终金融数据"""
2
+
3
+ __version__ = "0.0.3"
4
+ from .core import (
5
+ KjjApi
6
+ )
7
+
8
+ __all__ = ["KjjApi"]
kjj/common/__init__.py ADDED
@@ -0,0 +1,12 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+
5
+ curPath = os.path.abspath(os.path.dirname(__file__))
6
+ sys.path.append(curPath)
7
+ """
8
+ @Description
9
+ @Author:yanlei.wang
10
+ @file: __init__.py.py
11
+ @date:2026/3/13 15:47
12
+ """
kjj/common/conf.py ADDED
@@ -0,0 +1,13 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+
5
+ curPath = os.path.abspath(os.path.dirname(__file__))
6
+ sys.path.append(curPath)
7
+ """
8
+ @Description
9
+ @Author:yanlei.wang
10
+ @file: conf.py
11
+ @date:2026/3/13 15:47
12
+ """
13
+ base_url = "https://equaldata.kanjiujing.cn/equal-data/api/tool/common/invoke"
kjj/core.py ADDED
@@ -0,0 +1,57 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+
5
+ import requests
6
+
7
+ curPath = os.path.abspath(os.path.dirname(__file__))
8
+ sys.path.append(curPath)
9
+ """
10
+ @Description
11
+ @Author:yanlei.wang
12
+ @file: core.py
13
+ @date:2026/3/10 11:57
14
+ """
15
+ from datetime import datetime, timedelta
16
+ from kjj.utils.common_tools import to_camel_case
17
+ from kjj.common.conf import base_url
18
+
19
+
20
+ class KjjApi:
21
+ def __init__(self, token):
22
+ self.token = token
23
+ self.base_url = base_url
24
+
25
+ def query_kjj_data(self, **kwargs):
26
+ """
27
+ ?interfaceId=15&requestType=GET&pageIndex=0&pageSize=10&changeType=1&startDate=2026-02-11&endDate=2026-03-13
28
+ """
29
+ params = kwargs if kwargs else {}
30
+ # 注意:request 参数是服务端注入的,客户端无需传递
31
+ headers = {"Content-Type": "application/x-www-form-urlencoded",
32
+ "Token": self.token}
33
+ # 过滤 None 值
34
+ payload = {to_camel_case(k): v for k, v in params.items() if v is not None}
35
+ payload.update({"requestType": "GET"})
36
+ response = requests.get(self.base_url, params=payload, headers=headers)
37
+ response.raise_for_status()
38
+ data_lst = response.json().get("data", [])
39
+ if data_lst:
40
+ return data_lst
41
+ return response.json().get("msg", "接口请求异常!!")
42
+
43
+
44
+ if __name__ == '__main__':
45
+ api = KjjApi('bear ')
46
+ # 查询最近30天的增持记录
47
+ data = api.query_kjj_data(
48
+ interfaceId=115,
49
+ page_index=0,
50
+ page_size=50,
51
+ change_type=1, # 假设1为增持,请根据实际枚举值调整
52
+ start_date=(datetime.now() - timedelta(days=30)).strftime("%Y-%m-%d"),
53
+ end_date=datetime.now().strftime("%Y-%m-%d"),
54
+ )
55
+
56
+ print(data)
57
+
kjj/utils/__init__.py ADDED
@@ -0,0 +1,12 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+
5
+ curPath = os.path.abspath(os.path.dirname(__file__))
6
+ sys.path.append(curPath)
7
+ """
8
+ @Description
9
+ @Author:yanlei.wang
10
+ @file: __init__.py.py
11
+ @date:2026/3/13 13:36
12
+ """
@@ -0,0 +1,17 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+
5
+ curPath = os.path.abspath(os.path.dirname(__file__))
6
+ sys.path.append(curPath)
7
+ """
8
+ @Description
9
+ @Author:yanlei.wang
10
+ @file: tools.py
11
+ @date:2026/3/13 13:37
12
+ """
13
+ def to_camel_case(snake_str):
14
+ """将 snake_case 转换为 camelCase"""
15
+ components = snake_str.split('_')
16
+ # 第一个单词保持小写,其余单词首字母大写
17
+ return components[0] + ''.join(x.capitalize() for x in components[1:])