NexusQuant strategy provider Python SDK
Project description
nexusquant-sdk
NexusQuant 量化策略提供者 Python SDK,用于在 NexusQuant 平台上注册、管理量化策略并发送交易信号。
安装
pip install nexusquant-sdk
依赖 Python 3.10 及以上版本。
快速开始
import nexusquant_sdk as nq
# 登录(首次使用,会打开浏览器完成授权)
nq.auth_login()
# 查看已注册的策略列表
strategies = nq.strategy_list()
# 发送单笔交易信号
nq.strategy_send_signal_single(
"my_alpha",
ticker="AAPL",
direction="buy", # "buy" 或 "sell"
price=150.0,
quantity=100, # 股数
order_type="LIMIT", # "MARKET" 或 "LIMIT"
)
认证
SDK 使用 OAuth 2.0 PKCE 流程完成登录,令牌存储在本地,无需每次重新登录。
nq.auth_login() # 打开浏览器完成登录,保存令牌到本地
nq.auth_logged_in() # 检查是否已登录,返回 True/False
nq.auth_refresh() # 使用 refresh token 刷新 ID token
nq.auth_logout() # 删除本地令牌,退出登录
nq.auth_credentials_path() # 查看令牌文件的本地路径
策略管理
# 注册或更新策略
nq.strategy_register("my_alpha", "我的 Alpha 策略", output_unit="SHARE_COUNT")
# 查询策略列表
nq.strategy_list()
# 查询信号历史
nq.strategy_signal_history("my_alpha", limit=20)
# 发送单笔信号
nq.strategy_send_signal_single(
"my_alpha",
ticker="AAPL",
direction="buy",
price=150.0,
quantity=100,
order_type="LIMIT",
)
# 批量发送信号(多路由映射)
nq.strategy_send_signals("my_alpha", {"default": { ... }})
# 从本地 JSON 文件发送信号
nq.strategy_send_signals_from_path("my_alpha", "signals.json")
# 查询订阅者配置快照
nq.strategy_subscriber_config("my_alpha")
环境变量配置
可通过以下环境变量覆盖默认配置:
| 变量名 | 说明 |
|---|---|
NEXUSQUANT_API_ENDPOINT |
API 服务地址(默认:https://api.nexusquant.co) |
NEXUSQUANT_COGNITO_DOMAIN |
认证服务域名 |
NEXUSQUANT_COGNITO_CLIENT_ID |
OAuth 客户端 ID |
NEXUSQUANT_REDIRECT_URI |
OAuth 回调地址(默认:http://127.0.0.1:8251/callback) |
依赖
- Python 3.10+
httpx >= 0.27platformdirs >= 4.2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nexusquant_sdk-0.1.0.tar.gz
(7.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nexusquant_sdk-0.1.0.tar.gz.
File metadata
- Download URL: nexusquant_sdk-0.1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b4dd8f42399c7403c6dd7c8bbecf72562695dac63c51cee2fc2dcbc08fcb3ee
|
|
| MD5 |
441e7e9d20aa4089db89da513421287e
|
|
| BLAKE2b-256 |
31710715b650860d5e8c0860a3db6e22ab20fe7f6248b84b7a24654258695840
|
File details
Details for the file nexusquant_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nexusquant_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95f4b34e9220c5abec393d538510efc0cb01c3fc2f5d7e7106fb36729d405278
|
|
| MD5 |
67ff3a44925188b3b95a4959007e96af
|
|
| BLAKE2b-256 |
411b38212b1e05f9a2f6ef10198193a063768a3827f5a5b38c3bae610594ba21
|