ek-api 0.1.3

Headless API service for the ek ecosystem: NDJSON JSON-RPC over TCP, token auth, plugin management and event push.
docs.rs failed to build ek-api-0.1.3
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

ek-api

ek 生态的 headless API 服务:在一条 TCP 连接上用 NDJSON 承载 JSON-RPC 2.0, 提供令牌认证、插件管理、配置/秘面、只读行情与交易、策略生命周期、事件订阅推送, 并自带 ek-server 可执行文件与 Windows 部署脚本。

前端(NiceGUI / Python 脚本 / 任何 TCP 客户端)只依赖这份线协议,不需要 egui。

目录

src/            服务实现(server/proto/dispatch/hub/auth/audit/log/profile/event_json…)
src/bin/        ek-server(bin 入口:读 profile → 装配插件 → 起 TCP 监听)
tests/          Rust 集成测试(m0…m8)与 e2e Python 冒烟
docs/api/       线协议手册(方法、错误码、事件、示例、部署)
docs/           设计档、开发计划、技术选型评审(NiceGUI 评测)
pack.ps1        release 构建 → dist/
start-ek-server.bat

依赖与安装

依赖全部来自 crates.io(无 path、无 [patch]):ek-core/ek-event/ek-data/ek-cfg/ ek-station/ek-oms/ek-dm/ek-strategy/ek-ctp/ek-tq 都是版本化包。cargo 的解析保证 全链只有一份 ek-core/ek-ctp/ek-oms……,总线载荷的 TypeId 因此天然同一。

cargo install ek-api --locked        # 安装已发布包 ek-server(不引用源码目录)
cargo build --release --bin ek-server
cargo test                          # 41 个测试(lib + m0…m8)
cargo clippy --all-targets
powershell -ExecutionPolicy Bypass -File pack.ps1   # → dist/(exe + README + 启动 bat)
ek-server                            # 默认 127.0.0.1:8737,前台运行
ek-server --lan --port 9000

首次启动生成 %APPDATA%\ek\api\token(64 hex);端口/就绪文件/日志都在同一目录树下。 客户端 hello → auth.login → 按 docs/api/README.md 调方法或订阅 ev 推帧。

文档

安全要点

  • 默认只听 127.0.0.1;--lan 暴露交易写面,必须配防火墙白名单。
  • token 文件等同密码;秘面只出 secret:// 引用,secret.put 只进不出。
  • 真实发单/撤单必须显式 confirm:true;写操作全落 audit-YYYYMMDD.log。

License

MIT(见 Cargo.toml)。