quantdb-sdk 0.1.2__tar.gz → 0.1.4__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.
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/CHANGELOG.md +13 -0
- {quantdb_sdk-0.1.2/quantdb_sdk.egg-info → quantdb_sdk-0.1.4}/PKG-INFO +2 -2
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/README.md +1 -1
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/pyproject.toml +1 -1
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/quantdb_sdk/async_client.py +12 -6
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/quantdb_sdk/client.py +617 -612
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4/quantdb_sdk.egg-info}/PKG-INFO +2 -2
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/quantdb_sdk.egg-info/SOURCES.txt +0 -1
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/tests/test_async_client.py +5 -2
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/tests/test_client.py +6 -4
- quantdb_sdk-0.1.2/requirements.txt +0 -4
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/LICENSE +0 -0
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/MANIFEST.in +0 -0
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/quantdb_sdk/__init__.py +0 -0
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/quantdb_sdk/__main__.py +0 -0
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/quantdb_sdk/_utils.py +0 -0
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/quantdb_sdk/errors.py +0 -0
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/quantdb_sdk/py.typed +0 -0
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/quantdb_sdk.egg-info/dependency_links.txt +0 -0
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/quantdb_sdk.egg-info/entry_points.txt +0 -0
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/quantdb_sdk.egg-info/requires.txt +0 -0
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/quantdb_sdk.egg-info/top_level.txt +0 -0
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/setup.cfg +0 -0
- {quantdb_sdk-0.1.2 → quantdb_sdk-0.1.4}/tests/test_technical_indicators.py +0 -0
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
所有 notable 变更都会记录在此文件。格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),
|
|
4
4
|
版本号遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/)。
|
|
5
5
|
|
|
6
|
+
## [0.1.4] - 2026-07-25
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
- **用户名密码登录**:先初始化 HTTP 会话再登录,修复 `QuantDBClient(username=..., password=...)` 初始化时访问未创建会话的错误。
|
|
10
|
+
- **API Key 删除**:`delete_api_key()` / `a_delete_api_key()` 改为调用服务端实际的 `DELETE /api/v1/auth/api-keys/{id}` 接口,并明确接受 API Key ID。
|
|
11
|
+
- **流量用量**:`get_usage()` / `a_get_usage()` 将余额购买的额外流量纳入剩余流量和活跃状态计算,并新增 `purchased_gb` 返回字段。
|
|
12
|
+
|
|
13
|
+
## [0.1.3] - 2026-07-25
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- **User-Agent 统一规范**:同步同步客户端 (`client.py`) 与异步客户端 (`async_client.py`) 的 `User-Agent` 标头为 `QuantDB-Python-SDK/0.1.3`,提升服务端请求追踪与日志分流精度。
|
|
17
|
+
- **服务端 Redis 集中式缓存兼容**:完全兼容服务端网关新上线的 Redis 集中缓存层(自动接收 `X-Cache-Hit` 响应标头)。
|
|
18
|
+
|
|
6
19
|
## [0.1.2] - 2026-07-25
|
|
7
20
|
|
|
8
21
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quantdb-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: QuantDB 量化数据平台官方 Python SDK
|
|
5
5
|
Author: QuantDB Team
|
|
6
6
|
License: MIT
|
|
@@ -90,7 +90,7 @@ client = QuantDBClient(username="admin", password="admin123")
|
|
|
90
90
|
|
|
91
91
|
## 流量说明
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
免费注册用户获赠 100 MB 一次性体验流量;订阅用户每月含 30 GB 下载流量,超出部分按 ¥1/GB 从账户余额扣减。余额不足时下载会被拦截。
|
|
94
94
|
|
|
95
95
|
## 文档
|
|
96
96
|
|
|
@@ -35,7 +35,7 @@ class AsyncQuantDBClient:
|
|
|
35
35
|
):
|
|
36
36
|
self.api_host = api_host.rstrip("/")
|
|
37
37
|
self.timeout = timeout
|
|
38
|
-
headers = {"User-Agent": "QuantDB-Python-SDK/0.1.
|
|
38
|
+
headers = {"User-Agent": "QuantDB-Python-SDK/0.1.4"}
|
|
39
39
|
if api_key:
|
|
40
40
|
headers["X-API-Key"] = api_key
|
|
41
41
|
elif token:
|
|
@@ -82,6 +82,10 @@ class AsyncQuantDBClient:
|
|
|
82
82
|
resp = await self._request("POST", path, json=json)
|
|
83
83
|
return self._check_response(resp)
|
|
84
84
|
|
|
85
|
+
async def _delete(self, path: str) -> dict:
|
|
86
|
+
resp = await self._request("DELETE", path)
|
|
87
|
+
return self._check_response(resp)
|
|
88
|
+
|
|
85
89
|
def _check_response(self, response: httpx.Response) -> dict:
|
|
86
90
|
if response.status_code == 200:
|
|
87
91
|
try:
|
|
@@ -123,15 +127,17 @@ class AsyncQuantDBClient:
|
|
|
123
127
|
used = data.get("used_traffic", 0)
|
|
124
128
|
limit = data.get("traffic_limit", 0)
|
|
125
129
|
credit = data.get("credit_limit", 0)
|
|
130
|
+
purchased = data.get("purchased_traffic", 0)
|
|
126
131
|
subscription = data.get("subscription", {}) or {}
|
|
127
132
|
return {
|
|
128
133
|
"used_gb": bytes_to_gb(used),
|
|
129
134
|
"limit_gb": bytes_to_gb(limit),
|
|
130
135
|
"credit_gb": bytes_to_gb(credit),
|
|
131
|
-
"
|
|
136
|
+
"purchased_gb": bytes_to_gb(purchased),
|
|
137
|
+
"remaining_gb": max(0.0, bytes_to_gb(limit + credit + purchased - used)),
|
|
132
138
|
"balance_yuan": data.get("balance_yuan", 0.0),
|
|
133
139
|
"subscription": subscription,
|
|
134
|
-
"is_active": subscription.get("status") == "active" and used < limit + credit,
|
|
140
|
+
"is_active": subscription.get("status") == "active" and used < limit + credit + purchased,
|
|
135
141
|
}
|
|
136
142
|
|
|
137
143
|
async def a_register(self, username: str, email: str, password: str) -> Dict[str, Any]:
|
|
@@ -159,16 +165,16 @@ class AsyncQuantDBClient:
|
|
|
159
165
|
"""创建新的 API Key(每个账号限制 1 个有效 Key)。"""
|
|
160
166
|
return await self._post("/api/v1/auth/api-keys", json={"description": description})
|
|
161
167
|
|
|
162
|
-
async def a_delete_api_key(self,
|
|
168
|
+
async def a_delete_api_key(self, key_id: int) -> Dict[str, Any]:
|
|
163
169
|
"""删除指定的 API Key。
|
|
164
170
|
|
|
165
171
|
Args:
|
|
166
|
-
|
|
172
|
+
key_id: ``a_list_api_keys()`` 返回的 API Key ID。
|
|
167
173
|
|
|
168
174
|
Returns:
|
|
169
175
|
删除结果信息。
|
|
170
176
|
"""
|
|
171
|
-
return await self.
|
|
177
|
+
return await self._delete(f"/api/v1/auth/api-keys/{key_id}")
|
|
172
178
|
|
|
173
179
|
# ========== 订阅与支付 ==========
|
|
174
180
|
|