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_username="symbol-user",
        symbol_data_password="symbol-password",
        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.0

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.0
File Size Uploaded
ys_trade_sdk-0.1.0.tar.gz 145.1 kB Details

Built distribution (wheel)

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

Total release size: 178.5 kB

Release files / ys_trade_sdk-0.1.0.tar.gz

Download URL ys_trade_sdk-0.1.0.tar.gz
Size 145.1 kB
Tags Source
SHA-256 checksum
How to use checksums
30190d5027f60242c868098fe4cb29a72ee5969c52fa0f8ce3e8afe528974e82
BLAKE2b-256 checksum
How to use checksums
cdf92256269d4453d337980e970f93d3c840d66ba73fd2035d5aa158a26210dd
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.0-py3-none-any.whl

Download URL ys_trade_sdk-0.1.0-py3-none-any.whl
Size 33.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e09110d8146137f9cf4865cc1a2b882a04573ab688d0371087b3b9de361688d1
BLAKE2b-256 checksum
How to use checksums
9005608eb0d12a4b087722f6e3f2665d48d4cbe581cc5ef863075a6fde3c89c7
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 history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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