ys_base
YS 统一 SDK:契约模型(contracts)、auth 客户端与差量同步(auth)、WebSocket RPC 基类(ws)、 本地存储(store,默认 SQLite)、子系统服务骨架(server,extra)、交易网关(trade,extra,P4 收编)。
pip install ys_base # 契约 + auth 客户端 + SQLite 存储
pip install ys_base[server] # + FastAPI 子系统骨架
pip install ys_base[trade] # + 交易网关(纯策略系统只装这个)
使用 uv 添加依赖:
uv add ys_base # 契约 + auth 客户端 + SQLite 存储
uv add "ys_base[server]" # + FastAPI 子系统骨架
uv add "ys_base[trade]" # + 交易网关(纯策略系统只装这个)
trade extra 提供统一批量行情查询:
from ys_base.trade import get_quote_by_symbol_id, get_quote_by_symbol_ids
quotes = await get_quote_by_symbol_ids({"600000.SH", "300750.SZ"})
names = await get_quote_by_symbol_ids(["600000.SH"], fields="f57,f58")
默认 fields="f43,f58,f60",返回原始 f* 字段,并固定映射
f43 -> close、f60 -> pre_close、f58 -> name。不提供 last_price 或 pre_price 兼容字段;
可通过字符串或字段集合指定其他 fields。
刚发布的新版本若已在 PyPI 页面可见,但 uv 仍提示该版本不存在,通常是本地缓存的 PyPI Simple Index 元数据尚未更新。先清理单包缓存并从官方源重试: uv cache clean ys-base:优先清理单包缓存。 uv cache clean:单包清理无效时清理完整缓存。 使用 --default-index https://pypi.org/simple 从官方 PyPI 重新安装。 使用 --refresh 强制刷新解析。
uv cache clean ys-base
uv add "ys_base[trade]" --default-index https://pypi.org/simple --refresh
如果仍无法解析,再清理完整缓存:
uv cache clean
uv add "ys_base[trade]" --default-index https://pypi.org/simple --refresh
设计文档:ys_auth/docs/架构方案.md(v6 终版)、契约初稿.md。
Metadata
Release files for ys_base 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ys_base-0.1.5.tar.gz | 50.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ys_base-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 111.1 kB
Release files / ys_base-0.1.5.tar.gz
| Download URL | ys_base-0.1.5.tar.gz |
|---|---|
| Size | 50.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc84307538578519dcb577a43be530c77c4e0ab843b1ac0f6d7f6a3c97c70132
|
|
BLAKE2b-256 checksum How to use checksums |
274ee2f9803b144ca52d396e57792cd8d4e0aa6896d4683a68966df08aa8c9d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Release files / ys_base-0.1.5-py3-none-any.whl
| Download URL | ys_base-0.1.5-py3-none-any.whl |
|---|---|
| Size | 61.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
72b58ab0b7b5d7dd788f9c2a12ed28ba91df8a21c5e1307637da628eb2eade07
|
|
BLAKE2b-256 checksum How to use checksums |
6ad6ec2b9ac34ace9ed84baecebe1fe2db59fa33151f730d26c068a636c4817d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|