Skip to main content

ys_trade_sdk

YS 交易网关 SDK。账号线程、迅投/聚源客户端、行情与静态信息、盈亏缓存、Auth 账号对账都在这个包里。 契约、Auth 客户端和服务骨架仍在 ys_base。网关改动只升本包,不带动 Auth、MS、模板。

uv add ys_trade_sdk

需要服务骨架的交易系统同时安装底座:

uv add "ys_base[server]"
uv add ys_trade_sdk

本目录开发:

uv python install 3.13
uv sync --frozen
uv run pytest

发布到 PyPI

先改 ys_trade_sdk/__init__.py 的 __version__。PyPI 不允许覆盖同版本。Token 用钥匙串项目 pypi:__token__,不要把明文放进仓库。

cd ys_trade_sdk
./publish-pypi.sh

清华镜像能看到该版本后再给消费仓升锁。生产锁文件走清华镜像,禁止 --default-index https://pypi.org/simple。

from ys_trade_sdk import Account, TradeManager, TradeRuntimeConfig

manager = TradeManager(
    accounts=[
        Account(
            account="A001",
            password="...",
            trade_source="xt",
            trade_uri="ws://trade.example.com",
            profit_enabled=True,
        )
    ],
    runtime_config=TradeRuntimeConfig(
        quote_data_base_url="http://quote.example.com",
        symbol_data_base_url="http://symbol.example.com",
        symbol_data_token="symbol-token",
        trade_data_base_url="http://trade-data.example.com",
        trade_data_username="trade-user",
        trade_data_password="trade-password",
    ),
)

证券连接只认账户快照 stock_td_server。有地址和端口时交易源为迅投,地址为 ws://地址:端口。 profit_enabled=True 时才要求行情、静态信息和交易数据三类地址齐全。

Metadata

Release files for ys_trade_sdk 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ys_trade_sdk 0.1.1
File Size Uploaded Provenance Actions
ys_trade_sdk-0.1.1.tar.gz 145.4 kB Without provenance Details for ys_trade_sdk-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ys_trade_sdk 0.1.1
File Interpreter ABI Platform Actions
ys_trade_sdk-0.1.1-py3-none-any.whl Python 3 none any Details for ys_trade_sdk-0.1.1-py3-none-any.whl

Total release size: 179.1 kB

Release files / ys_trade_sdk-0.1.1.tar.gz

Download URL ys_trade_sdk-0.1.1.tar.gz
Size 145.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c551d2d84f2503b706e58d29dbc4131a8aad2e621f943a65c3b5d0e038f5e374
BLAKE2b-256 checksum
How to use checksums
7aa5081f3e362a1f0e89a94da91037f1fc9dfdc8a8d59f4e07c0b47b24ae1384
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ys_trade_sdk-0.1.1-py3-none-any.whl

Download URL ys_trade_sdk-0.1.1-py3-none-any.whl
Size 33.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85cf40c1108dbef45a3121b41164d3887eb828143a212232ee46ccce5d2586c4
BLAKE2b-256 checksum
How to use checksums
05e26e8a6072b5b2e2c5389d8e6121ce3f21b2e919daf84467f6b7e20c751d18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for ys_trade_sdk 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page