tickflow 0.1.0.dev0__tar.gz → 0.1.0.dev2__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.
- tickflow-0.1.0.dev2/PKG-INFO +103 -0
- tickflow-0.1.0.dev2/README.md +71 -0
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/pyproject.toml +22 -25
- tickflow-0.1.0.dev2/tickflow/__init__.py +75 -0
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/tickflow/_base_client.py +213 -70
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/tickflow/client.py +20 -13
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/tickflow/generated_model.py +86 -84
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/tickflow/resources/__init__.py +3 -3
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/tickflow/resources/exchanges.py +49 -23
- tickflow-0.1.0.dev2/tickflow/resources/instruments.py +180 -0
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/tickflow/resources/klines.py +263 -29
- tickflow-0.1.0.dev2/tickflow.egg-info/PKG-INFO +103 -0
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/tickflow.egg-info/SOURCES.txt +1 -1
- tickflow-0.1.0.dev2/tickflow.egg-info/requires.txt +12 -0
- tickflow-0.1.0.dev0/PKG-INFO +0 -36
- tickflow-0.1.0.dev0/README.md +0 -0
- tickflow-0.1.0.dev0/tickflow/__init__.py +0 -136
- tickflow-0.1.0.dev0/tickflow/resources/symbols.py +0 -176
- tickflow-0.1.0.dev0/tickflow.egg-info/PKG-INFO +0 -36
- tickflow-0.1.0.dev0/tickflow.egg-info/requires.txt +0 -14
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/setup.cfg +0 -0
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/tickflow/_exceptions.py +0 -0
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/tickflow/_types.py +0 -0
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/tickflow/resources/_base.py +0 -0
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/tickflow/resources/quotes.py +0 -0
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/tickflow/resources/universes.py +0 -0
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/tickflow.egg-info/dependency_links.txt +0 -0
- {tickflow-0.1.0.dev0 → tickflow-0.1.0.dev2}/tickflow.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tickflow
|
|
3
|
+
Version: 0.1.0.dev2
|
|
4
|
+
Summary: TickFlow Python Client
|
|
5
|
+
Author: TickFlow Team
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Documentation, https://docs.tickflow.org
|
|
8
|
+
Project-URL: Repository, https://github.com/tickflow/tickflow-python
|
|
9
|
+
Keywords: finance,stock,market-data,trading,api-client
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
Requires-Dist: httpx>=0.25.0
|
|
24
|
+
Requires-Dist: typing-extensions>=4.0.0
|
|
25
|
+
Provides-Extra: pandas
|
|
26
|
+
Requires-Dist: pandas>=1.5.0; extra == "pandas"
|
|
27
|
+
Provides-Extra: progress
|
|
28
|
+
Requires-Dist: tqdm>=4.60.0; extra == "progress"
|
|
29
|
+
Provides-Extra: all
|
|
30
|
+
Requires-Dist: pandas>=1.5.0; extra == "all"
|
|
31
|
+
Requires-Dist: tqdm>=4.60.0; extra == "all"
|
|
32
|
+
|
|
33
|
+
# TickFlow Python SDK
|
|
34
|
+
|
|
35
|
+
高性能行情数据 Python 客户端,支持 A股、美股、港股。
|
|
36
|
+
|
|
37
|
+
## 安装
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install tickflow[all]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 快速开始
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from tickflow import TickFlow
|
|
47
|
+
|
|
48
|
+
# 初始化客户端
|
|
49
|
+
tf = TickFlow(api_key="your-api-key")
|
|
50
|
+
|
|
51
|
+
# 获取 K 线数据
|
|
52
|
+
df = tf.klines.get("600000.SH", period="1d", count=100, as_dataframe=True)
|
|
53
|
+
print(df.tail())
|
|
54
|
+
|
|
55
|
+
# 获取实时行情
|
|
56
|
+
quotes = tf.quotes.get(symbols=["600000.SH", "AAPL.US"])
|
|
57
|
+
for q in quotes:
|
|
58
|
+
print(f"{q['symbol']}: {q['last_price']}")
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 异步使用
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import asyncio
|
|
65
|
+
from tickflow import AsyncTickFlow
|
|
66
|
+
|
|
67
|
+
async def main():
|
|
68
|
+
async with AsyncTickFlow(api_key="your-api-key") as tf:
|
|
69
|
+
df = await tf.klines.get("600000.SH", as_dataframe=True)
|
|
70
|
+
print(df.tail())
|
|
71
|
+
|
|
72
|
+
asyncio.run(main())
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 批量获取
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
# 批量获取大量股票数据,自动分批并发请求
|
|
79
|
+
symbols = tf.exchanges.get_symbols("SH")[:500]
|
|
80
|
+
df = tf.klines.batch(
|
|
81
|
+
symbols,
|
|
82
|
+
period="1d",
|
|
83
|
+
as_dataframe=True,
|
|
84
|
+
show_progress=True # 显示进度条
|
|
85
|
+
)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 特性
|
|
89
|
+
|
|
90
|
+
- ✅ 同步/异步双接口
|
|
91
|
+
- ✅ DataFrame 原生支持
|
|
92
|
+
- ✅ 自动重试(网络错误、服务器错误)
|
|
93
|
+
- ✅ 批量请求自动分片
|
|
94
|
+
- ✅ 进度条支持
|
|
95
|
+
- ✅ 完整类型注解
|
|
96
|
+
|
|
97
|
+
## 文档
|
|
98
|
+
|
|
99
|
+
完整文档请访问:https://docs.tickflow.org
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
MIT
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# TickFlow Python SDK
|
|
2
|
+
|
|
3
|
+
高性能行情数据 Python 客户端,支持 A股、美股、港股。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install tickflow[all]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 快速开始
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from tickflow import TickFlow
|
|
15
|
+
|
|
16
|
+
# 初始化客户端
|
|
17
|
+
tf = TickFlow(api_key="your-api-key")
|
|
18
|
+
|
|
19
|
+
# 获取 K 线数据
|
|
20
|
+
df = tf.klines.get("600000.SH", period="1d", count=100, as_dataframe=True)
|
|
21
|
+
print(df.tail())
|
|
22
|
+
|
|
23
|
+
# 获取实时行情
|
|
24
|
+
quotes = tf.quotes.get(symbols=["600000.SH", "AAPL.US"])
|
|
25
|
+
for q in quotes:
|
|
26
|
+
print(f"{q['symbol']}: {q['last_price']}")
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 异步使用
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
import asyncio
|
|
33
|
+
from tickflow import AsyncTickFlow
|
|
34
|
+
|
|
35
|
+
async def main():
|
|
36
|
+
async with AsyncTickFlow(api_key="your-api-key") as tf:
|
|
37
|
+
df = await tf.klines.get("600000.SH", as_dataframe=True)
|
|
38
|
+
print(df.tail())
|
|
39
|
+
|
|
40
|
+
asyncio.run(main())
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 批量获取
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
# 批量获取大量股票数据,自动分批并发请求
|
|
47
|
+
symbols = tf.exchanges.get_symbols("SH")[:500]
|
|
48
|
+
df = tf.klines.batch(
|
|
49
|
+
symbols,
|
|
50
|
+
period="1d",
|
|
51
|
+
as_dataframe=True,
|
|
52
|
+
show_progress=True # 显示进度条
|
|
53
|
+
)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 特性
|
|
57
|
+
|
|
58
|
+
- ✅ 同步/异步双接口
|
|
59
|
+
- ✅ DataFrame 原生支持
|
|
60
|
+
- ✅ 自动重试(网络错误、服务器错误)
|
|
61
|
+
- ✅ 批量请求自动分片
|
|
62
|
+
- ✅ 进度条支持
|
|
63
|
+
- ✅ 完整类型注解
|
|
64
|
+
|
|
65
|
+
## 文档
|
|
66
|
+
|
|
67
|
+
完整文档请访问:https://docs.tickflow.org
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
MIT
|
|
@@ -1,47 +1,44 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "tickflow"
|
|
3
|
-
version = "0.1.0-
|
|
4
|
-
description = "TickFlow Python Client
|
|
3
|
+
version = "0.1.0-dev2"
|
|
4
|
+
description = "TickFlow Python Client"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.9"
|
|
7
|
-
license = {
|
|
7
|
+
license = {text = "MIT"}
|
|
8
8
|
authors = [
|
|
9
|
-
{
|
|
9
|
+
{name = "TickFlow Team"}
|
|
10
10
|
]
|
|
11
|
-
keywords = ["finance", "
|
|
11
|
+
keywords = ["finance", "stock", "market-data", "trading", "api-client"]
|
|
12
12
|
classifiers = [
|
|
13
13
|
"Development Status :: 4 - Beta",
|
|
14
14
|
"Intended Audience :: Developers",
|
|
15
15
|
"Intended Audience :: Financial and Insurance Industry",
|
|
16
16
|
"License :: OSI Approved :: MIT License",
|
|
17
|
-
"Operating System :: OS Independent",
|
|
18
17
|
"Programming Language :: Python :: 3",
|
|
19
18
|
"Programming Language :: Python :: 3.9",
|
|
20
19
|
"Programming Language :: Python :: 3.10",
|
|
21
20
|
"Programming Language :: Python :: 3.11",
|
|
22
21
|
"Programming Language :: Python :: 3.12",
|
|
23
22
|
"Topic :: Office/Business :: Financial :: Investment",
|
|
24
|
-
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
25
23
|
"Typing :: Typed",
|
|
26
24
|
]
|
|
27
|
-
|
|
28
25
|
dependencies = [
|
|
29
|
-
"httpx>=0.
|
|
30
|
-
"pandas>=1.3.0",
|
|
26
|
+
"httpx>=0.25.0",
|
|
31
27
|
"typing-extensions>=4.0.0",
|
|
32
28
|
]
|
|
33
29
|
|
|
34
30
|
[project.optional-dependencies]
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
# DataFrame support
|
|
32
|
+
pandas = ["pandas>=1.5.0"]
|
|
33
|
+
# Progress bar for batch operations
|
|
34
|
+
progress = ["tqdm>=4.60.0"]
|
|
35
|
+
# All optional features
|
|
36
|
+
all = [
|
|
37
|
+
"pandas>=1.5.0",
|
|
38
|
+
"tqdm>=4.60.0",
|
|
41
39
|
]
|
|
42
40
|
|
|
43
41
|
[project.urls]
|
|
44
|
-
Homepage = "https://tickflow.org"
|
|
45
42
|
Documentation = "https://docs.tickflow.org"
|
|
46
43
|
Repository = "https://github.com/tickflow/tickflow-python"
|
|
47
44
|
|
|
@@ -50,13 +47,13 @@ requires = ["setuptools>=61.0", "wheel"]
|
|
|
50
47
|
build-backend = "setuptools.build_meta"
|
|
51
48
|
|
|
52
49
|
[tool.setuptools.packages.find]
|
|
53
|
-
where = ["."]
|
|
54
50
|
include = ["tickflow*"]
|
|
55
51
|
|
|
56
|
-
[
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
[dependency-groups]
|
|
53
|
+
dev = [
|
|
54
|
+
"datamodel-code-generator[http]>=0.45.0",
|
|
55
|
+
"pytest>=7.0.0",
|
|
56
|
+
"pytest-asyncio>=0.21.0",
|
|
57
|
+
"ruff>=0.1.0",
|
|
58
|
+
"mypy>=1.0.0",
|
|
59
|
+
]
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""TickFlow Python SDK - 高性能行情数据客户端。
|
|
2
|
+
|
|
3
|
+
支持 A股、美股、港股的行情数据查询,提供同步和异步两种接口。
|
|
4
|
+
|
|
5
|
+
Examples
|
|
6
|
+
--------
|
|
7
|
+
同步使用:
|
|
8
|
+
|
|
9
|
+
>>> from tickflow import TickFlow
|
|
10
|
+
>>> client = TickFlow(api_key="your-api-key")
|
|
11
|
+
>>> df = client.klines.get("600000.SH", as_dataframe=True)
|
|
12
|
+
>>> print(df.tail())
|
|
13
|
+
|
|
14
|
+
异步使用:
|
|
15
|
+
|
|
16
|
+
>>> import asyncio
|
|
17
|
+
>>> from tickflow import AsyncTickFlow
|
|
18
|
+
>>>
|
|
19
|
+
>>> async def main():
|
|
20
|
+
... async with AsyncTickFlow(api_key="your-api-key") as client:
|
|
21
|
+
... df = await client.klines.get("600000.SH", as_dataframe=True)
|
|
22
|
+
... print(df.tail())
|
|
23
|
+
>>>
|
|
24
|
+
>>> asyncio.run(main())
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
from ._exceptions import (
|
|
28
|
+
APIError,
|
|
29
|
+
AuthenticationError,
|
|
30
|
+
BadRequestError,
|
|
31
|
+
ConnectionError,
|
|
32
|
+
InternalServerError,
|
|
33
|
+
NotFoundError,
|
|
34
|
+
PermissionError,
|
|
35
|
+
RateLimitError,
|
|
36
|
+
TickFlowError,
|
|
37
|
+
TimeoutError,
|
|
38
|
+
)
|
|
39
|
+
from .client import AsyncTickFlow, TickFlow
|
|
40
|
+
from .generated_model import (
|
|
41
|
+
CompactKlineData,
|
|
42
|
+
Instrument,
|
|
43
|
+
InstrumentType,
|
|
44
|
+
Period,
|
|
45
|
+
Quote,
|
|
46
|
+
Region,
|
|
47
|
+
SessionStatus,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
__version__ = "0.1.0"
|
|
51
|
+
|
|
52
|
+
__all__ = [
|
|
53
|
+
# Main clients
|
|
54
|
+
"TickFlow",
|
|
55
|
+
"AsyncTickFlow",
|
|
56
|
+
# Exceptions
|
|
57
|
+
"TickFlowError",
|
|
58
|
+
"APIError",
|
|
59
|
+
"AuthenticationError",
|
|
60
|
+
"PermissionError",
|
|
61
|
+
"NotFoundError",
|
|
62
|
+
"BadRequestError",
|
|
63
|
+
"RateLimitError",
|
|
64
|
+
"InternalServerError",
|
|
65
|
+
"ConnectionError",
|
|
66
|
+
"TimeoutError",
|
|
67
|
+
# Types
|
|
68
|
+
"CompactKlineData",
|
|
69
|
+
"Instrument",
|
|
70
|
+
"InstrumentType",
|
|
71
|
+
"Period",
|
|
72
|
+
"Quote",
|
|
73
|
+
"Region",
|
|
74
|
+
"SessionStatus",
|
|
75
|
+
]
|