tqx-data 0.1.0__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.
- tqx_data-0.1.0/.gitignore +281 -0
- tqx_data-0.1.0/PKG-INFO +20 -0
- tqx_data-0.1.0/pyproject.toml +56 -0
- tqx_data-0.1.0/tqx_data/__init__.py +63 -0
- tqx_data-0.1.0/tqx_data/auth_manager.py +563 -0
- tqx_data-0.1.0/tqx_data/client/__init__.py +11 -0
- tqx_data-0.1.0/tqx_data/client/live_market_client.py +638 -0
- tqx_data-0.1.0/tqx_data/client/service.py +412 -0
- tqx_data-0.1.0/tqx_data/client/ws_auth.py +106 -0
- tqx_data-0.1.0/tqx_data/config/__init__.py +98 -0
- tqx_data-0.1.0/tqx_data/core/__init__.py +2 -0
- tqx_data-0.1.0/tqx_data/core/service.py +49 -0
- tqx_data-0.1.0/tqx_data/exceptions.py +275 -0
- tqx_data-0.1.0/tqx_data/readers/__init__.py +0 -0
- tqx_data-0.1.0/tqx_data/readers/hk_reader.py +137 -0
- tqx_data-0.1.0/tqx_data/readers/init_token.py +157 -0
- tqx_data-0.1.0/tqx_data/readers/oversea_reader.py +1338 -0
- tqx_data-0.1.0/tqx_data/readers/trading_tools_reader.py +253 -0
- tqx_data-0.1.0/tqx_data/readers/us_reader.py +127 -0
- tqx_data-0.1.0/tqx_data/tqx_data.md +3130 -0
- tqx_data-0.1.0/tqx_data/tqx_data_bk.md +3595 -0
- tqx_data-0.1.0/tqx_data/transport/__init__.py +6 -0
- tqx_data-0.1.0/tqx_data/transport/http.py +1287 -0
- tqx_data-0.1.0/tqx_data/utils/common_utils.py +52 -0
- tqx_data-0.1.0/tqx_data/utils/param_check_utils.py +2550 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
*.manifest
|
|
31
|
+
*.spec
|
|
32
|
+
|
|
33
|
+
# Installer logs
|
|
34
|
+
pip-log.txt
|
|
35
|
+
pip-delete-this-directory.txt
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.nox/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage.xml
|
|
46
|
+
*.cover
|
|
47
|
+
*.py,cover
|
|
48
|
+
.hypothesis/
|
|
49
|
+
.pytest_cache/
|
|
50
|
+
cover/
|
|
51
|
+
|
|
52
|
+
# Translations
|
|
53
|
+
*.mo
|
|
54
|
+
*.pot
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
local_settings.py
|
|
59
|
+
db.sqlite3
|
|
60
|
+
db.sqlite3-journal
|
|
61
|
+
|
|
62
|
+
# Flask stuff:
|
|
63
|
+
instance/
|
|
64
|
+
.webassets-cache
|
|
65
|
+
|
|
66
|
+
# Scrapy stuff:
|
|
67
|
+
.scrapy
|
|
68
|
+
|
|
69
|
+
# Sphinx documentation
|
|
70
|
+
docs/_build/
|
|
71
|
+
|
|
72
|
+
# PyBuilder
|
|
73
|
+
.pybuilder/
|
|
74
|
+
target/
|
|
75
|
+
|
|
76
|
+
# Jupyter Notebook
|
|
77
|
+
.ipynb_checkpoints
|
|
78
|
+
*.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
.python-version
|
|
86
|
+
|
|
87
|
+
# pipenv
|
|
88
|
+
Pipfile.lock
|
|
89
|
+
|
|
90
|
+
# poetry
|
|
91
|
+
poetry.lock
|
|
92
|
+
|
|
93
|
+
# pdm
|
|
94
|
+
.pdm.toml
|
|
95
|
+
|
|
96
|
+
# PEP 582
|
|
97
|
+
__pypackages__/
|
|
98
|
+
|
|
99
|
+
# Celery stuff
|
|
100
|
+
celerybeat-schedule
|
|
101
|
+
celerybeat.pid
|
|
102
|
+
|
|
103
|
+
# SageMath parsed files
|
|
104
|
+
*.sage.py
|
|
105
|
+
|
|
106
|
+
# Spyder project settings
|
|
107
|
+
.spyderproject
|
|
108
|
+
.spyproject
|
|
109
|
+
|
|
110
|
+
# Rope project settings
|
|
111
|
+
.ropeproject
|
|
112
|
+
|
|
113
|
+
# mkdocs documentation
|
|
114
|
+
/site
|
|
115
|
+
|
|
116
|
+
# mypy
|
|
117
|
+
.mypy_cache/
|
|
118
|
+
.dmypy.json
|
|
119
|
+
dmypy.json
|
|
120
|
+
|
|
121
|
+
# Pyre type checker
|
|
122
|
+
.pyre/
|
|
123
|
+
|
|
124
|
+
# pytype static type analyzer
|
|
125
|
+
.pytype/
|
|
126
|
+
|
|
127
|
+
# Cython debug symbols
|
|
128
|
+
cython_debug/
|
|
129
|
+
|
|
130
|
+
# IDEs
|
|
131
|
+
.idea/
|
|
132
|
+
.vscode/
|
|
133
|
+
*.swp
|
|
134
|
+
*.swo
|
|
135
|
+
*~
|
|
136
|
+
.project
|
|
137
|
+
.classpath
|
|
138
|
+
.settings/
|
|
139
|
+
*.sublime-project
|
|
140
|
+
*.sublime-workspace
|
|
141
|
+
|
|
142
|
+
# PyCharm
|
|
143
|
+
.idea/
|
|
144
|
+
*.iml
|
|
145
|
+
*.iws
|
|
146
|
+
*.ipr
|
|
147
|
+
|
|
148
|
+
# VS Code
|
|
149
|
+
.vscode/
|
|
150
|
+
*.code-workspace
|
|
151
|
+
|
|
152
|
+
# macOS
|
|
153
|
+
.DS_Store
|
|
154
|
+
.AppleDouble
|
|
155
|
+
.LSOverride
|
|
156
|
+
Icon
|
|
157
|
+
._*
|
|
158
|
+
.DocumentRevisions-V100
|
|
159
|
+
.fseventsd
|
|
160
|
+
.Spotlight-V100
|
|
161
|
+
.TemporaryItems
|
|
162
|
+
.Trashes
|
|
163
|
+
.VolumeIcon.icns
|
|
164
|
+
.com.apple.timemachine.donotpresent
|
|
165
|
+
.AppleDB
|
|
166
|
+
.AppleDesktop
|
|
167
|
+
Network Trash Folder
|
|
168
|
+
Temporary Items
|
|
169
|
+
.apdisk
|
|
170
|
+
|
|
171
|
+
# Windows
|
|
172
|
+
Thumbs.db
|
|
173
|
+
Thumbs.db:encryptable
|
|
174
|
+
ehthumbs.db
|
|
175
|
+
ehthumbs_vista.db
|
|
176
|
+
*.stackdump
|
|
177
|
+
[Dd]esktop.ini
|
|
178
|
+
$RECYCLE.BIN/
|
|
179
|
+
*.cab
|
|
180
|
+
*.msi
|
|
181
|
+
*.msix
|
|
182
|
+
*.msm
|
|
183
|
+
*.msp
|
|
184
|
+
*.lnk
|
|
185
|
+
|
|
186
|
+
# Linux
|
|
187
|
+
*~
|
|
188
|
+
.fuse_hidden*
|
|
189
|
+
.directory
|
|
190
|
+
.Trash-*
|
|
191
|
+
.nfs*
|
|
192
|
+
|
|
193
|
+
# Logs
|
|
194
|
+
*.log
|
|
195
|
+
logs/
|
|
196
|
+
*.log.*
|
|
197
|
+
|
|
198
|
+
# Data files
|
|
199
|
+
*.parquet
|
|
200
|
+
# *.csv
|
|
201
|
+
# *.json
|
|
202
|
+
# *.xlsx
|
|
203
|
+
# *.xls
|
|
204
|
+
|
|
205
|
+
# Export directories
|
|
206
|
+
export/
|
|
207
|
+
exports/
|
|
208
|
+
output/
|
|
209
|
+
outputs/
|
|
210
|
+
|
|
211
|
+
# Temporary files
|
|
212
|
+
*.tmp
|
|
213
|
+
*.temp
|
|
214
|
+
*.bak
|
|
215
|
+
*.backup
|
|
216
|
+
*.old
|
|
217
|
+
*.orig
|
|
218
|
+
|
|
219
|
+
# Docker
|
|
220
|
+
.dockerignore
|
|
221
|
+
|
|
222
|
+
# MongoDB
|
|
223
|
+
*.bson
|
|
224
|
+
|
|
225
|
+
# Redis
|
|
226
|
+
dump.rdb
|
|
227
|
+
|
|
228
|
+
# Configuration files with sensitive data
|
|
229
|
+
config.ini
|
|
230
|
+
config.local.ini
|
|
231
|
+
secrets.yaml
|
|
232
|
+
.secrets
|
|
233
|
+
|
|
234
|
+
# Test files
|
|
235
|
+
.pytest_cache/
|
|
236
|
+
test_output/
|
|
237
|
+
test_results/
|
|
238
|
+
|
|
239
|
+
# Coverage reports
|
|
240
|
+
htmlcov/
|
|
241
|
+
.coverage
|
|
242
|
+
.coverage.*
|
|
243
|
+
|
|
244
|
+
# Jupyter Notebook outputs (keep notebooks but ignore outputs)
|
|
245
|
+
# Uncomment if you want to ignore notebook outputs
|
|
246
|
+
# *.ipynb
|
|
247
|
+
|
|
248
|
+
# Large binary files
|
|
249
|
+
*.zip
|
|
250
|
+
*.tar.gz
|
|
251
|
+
*.rar
|
|
252
|
+
*.7z
|
|
253
|
+
|
|
254
|
+
# Compiled files
|
|
255
|
+
*.class
|
|
256
|
+
*.exe
|
|
257
|
+
*.dll
|
|
258
|
+
*.dylib
|
|
259
|
+
|
|
260
|
+
# Node modules (if any)
|
|
261
|
+
node_modules/
|
|
262
|
+
npm-debug.log*
|
|
263
|
+
yarn-debug.log*
|
|
264
|
+
yarn-error.log*
|
|
265
|
+
|
|
266
|
+
# Environment variables
|
|
267
|
+
.env.local
|
|
268
|
+
.env.*.local
|
|
269
|
+
.env.development
|
|
270
|
+
.env.production
|
|
271
|
+
|
|
272
|
+
# Database files
|
|
273
|
+
*.db
|
|
274
|
+
*.sqlite
|
|
275
|
+
*.sqlite3
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
# Keep specific important files
|
|
279
|
+
!README.md
|
|
280
|
+
!*.md
|
|
281
|
+
!.gitignore
|
tqx_data-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: tqx_data
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: TQX DataQuant
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Requires-Dist: duckdb
|
|
7
|
+
Requires-Dist: numpy<2.0,>=1.22
|
|
8
|
+
Requires-Dist: pandas>=2.0.0
|
|
9
|
+
Requires-Dist: pyarrow
|
|
10
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
11
|
+
Requires-Dist: python-snappy>=0.7.3
|
|
12
|
+
Requires-Dist: pyyaml>=6.0
|
|
13
|
+
Requires-Dist: requests
|
|
14
|
+
Requires-Dist: websockets>=13.0
|
|
15
|
+
Requires-Dist: zstandard>=0.22.0
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: httpx; extra == 'dev'
|
|
18
|
+
Requires-Dist: jupyterlab>=3.5.0; extra == 'dev'
|
|
19
|
+
Requires-Dist: pytest-asyncio; extra == 'dev'
|
|
20
|
+
Requires-Dist: pytest>=8.3.5; extra == 'dev'
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tqx_data"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "TQX DataQuant"
|
|
5
|
+
requires-python = ">=3.10"
|
|
6
|
+
dependencies = [
|
|
7
|
+
"pandas>=2.0.0",
|
|
8
|
+
"numpy>=1.22,<2.0",
|
|
9
|
+
"python-snappy>=0.7.3",
|
|
10
|
+
"python-dotenv>=1.0.0",
|
|
11
|
+
"PyYAML>=6.0",
|
|
12
|
+
"zstandard>=0.22.0",
|
|
13
|
+
"duckdb",
|
|
14
|
+
"pyarrow",
|
|
15
|
+
"websockets>=13.0",
|
|
16
|
+
"requests"
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[dependency-groups]
|
|
20
|
+
dev = ["pytest>=8.3.5", "pytest-asyncio", "httpx", "jupyterlab>=3.5.0", "pymysql>=1.1.0"]
|
|
21
|
+
|
|
22
|
+
[build-system]
|
|
23
|
+
requires = ["hatchling"]
|
|
24
|
+
build-backend = "hatchling.build"
|
|
25
|
+
|
|
26
|
+
[project.optional-dependencies]
|
|
27
|
+
dev = ["pytest>=8.3.5", "pytest-asyncio", "httpx", "jupyterlab>=3.5.0"]
|
|
28
|
+
|
|
29
|
+
# 打包时排除本地脚本(仍保留在仓库中供开发使用)
|
|
30
|
+
[tool.hatch.build.targets.wheel]
|
|
31
|
+
packages = ["tqx_data"]
|
|
32
|
+
exclude = [
|
|
33
|
+
"tqx_data/test.py",
|
|
34
|
+
"tqx_data/test_tick.py",
|
|
35
|
+
"tqx_data/demo.py",
|
|
36
|
+
"tqx_data/resources/conflicts.json",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[tool.hatch.build.targets.sdist]
|
|
40
|
+
packages = ["tqx_data"]
|
|
41
|
+
exclude = [
|
|
42
|
+
"tqx_data/test.py",
|
|
43
|
+
"tqx_data/test_tick.py",
|
|
44
|
+
"tqx_data/demo.py",
|
|
45
|
+
"tqx_data/resources/conflicts.json",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[tool.pytest.ini_options]
|
|
49
|
+
# 禁用输出捕获,显示 print 输出
|
|
50
|
+
addopts = "-v -s"
|
|
51
|
+
# 指定测试文件命名模式
|
|
52
|
+
python_files = ["test_*.py", "*_test.py"]
|
|
53
|
+
# 忽略来自 pytest 内部的断言重写警告
|
|
54
|
+
filterwarnings = [
|
|
55
|
+
"ignore:Module already imported so cannot be rewritten:pytest.PytestAssertRewriteWarning:_pytest.config"
|
|
56
|
+
]
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""tqx_data SDK public interface."""
|
|
2
|
+
import warnings
|
|
3
|
+
|
|
4
|
+
warnings.filterwarnings("ignore", message=".*Unable to find acceptable character detection dependency.*")
|
|
5
|
+
|
|
6
|
+
from .client import get_client, get_factory, init, TickStreamClient
|
|
7
|
+
from .auth_manager import (
|
|
8
|
+
is_authenticated,
|
|
9
|
+
auth_remaining_seconds,
|
|
10
|
+
auth_expires_at,
|
|
11
|
+
get_token_ttl,
|
|
12
|
+
auth_info,
|
|
13
|
+
clear_auth,
|
|
14
|
+
)
|
|
15
|
+
from .readers import (
|
|
16
|
+
hk_reader,
|
|
17
|
+
trading_tools_reader,
|
|
18
|
+
us_reader,
|
|
19
|
+
oversea_reader,
|
|
20
|
+
init_token,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# 交易工具(交易日历等,exchange 支持 HK/US)
|
|
24
|
+
get_trade_cal = trading_tools_reader.get_trade_cal
|
|
25
|
+
get_prev_trade_date = trading_tools_reader.get_prev_trade_date
|
|
26
|
+
get_last_trade_date = trading_tools_reader.get_last_trade_date
|
|
27
|
+
get_trade_list = trading_tools_reader.get_trade_list
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# 港美股(用 market 参数区分 hk/us;日线/分钟线接口保持分开,见下方港股/美股)
|
|
32
|
+
get_stock_detail = oversea_reader.get_stock_detail
|
|
33
|
+
get_stock_detail_all = oversea_reader.get_stock_detail_all
|
|
34
|
+
get_stock_dividend_event = oversea_reader.get_stock_dividend_event
|
|
35
|
+
get_stock_market_event = oversea_reader.get_stock_market_event
|
|
36
|
+
get_stock_meeting_event = oversea_reader.get_stock_meeting_event
|
|
37
|
+
get_stock_financial_event = oversea_reader.get_stock_financial_event
|
|
38
|
+
get_stock_ir_event = oversea_reader.get_stock_ir_event
|
|
39
|
+
get_stock_investor_concentration = oversea_reader.get_stock_investor_concentration
|
|
40
|
+
get_stock_top20_concentration = oversea_reader.get_stock_top20_concentration
|
|
41
|
+
get_stock_investor_ranking = oversea_reader.get_stock_investor_ranking
|
|
42
|
+
get_stock_insider_trade = oversea_reader.get_stock_insider_trade
|
|
43
|
+
get_stock_shareholder_holding = oversea_reader.get_stock_shareholder_holding
|
|
44
|
+
get_stock_industry_median = oversea_reader.get_stock_industry_median
|
|
45
|
+
get_stock_pv_indicator = oversea_reader.get_stock_pv_indicator
|
|
46
|
+
get_stock_ncycl_consensus = oversea_reader.get_stock_ncycl_consensus
|
|
47
|
+
get_stock_operating_indicator = oversea_reader.get_stock_operating_indicator
|
|
48
|
+
get_stock_mktfin_indicator = oversea_reader.get_stock_mktfin_indicator
|
|
49
|
+
get_financial_statement = oversea_reader.get_financial_statement
|
|
50
|
+
|
|
51
|
+
# 24 合并
|
|
52
|
+
|
|
53
|
+
# 港股(日线/分钟线,不与美股合并)
|
|
54
|
+
get_hk_daily = hk_reader.get_hk_daily
|
|
55
|
+
|
|
56
|
+
# 美股(日线/分钟线,不与港股合并)
|
|
57
|
+
get_us_daily = us_reader.get_us_daily
|
|
58
|
+
init_token = init_token.init_token
|
|
59
|
+
__all__ = [name for name in globals().keys() if name.startswith('get_')] + [
|
|
60
|
+
'init', 'init_token', 'get_client', 'get_factory', 'TickStreamClient',
|
|
61
|
+
'is_authenticated', 'auth_remaining_seconds', 'auth_expires_at',
|
|
62
|
+
'auth_info', 'clear_auth',
|
|
63
|
+
]
|