EMQ CLI
快速开始
- 安装并确认命令可用:
pip install emq-cli
emq --help
- 登录(支持环境变量):
export EMQ_USER='your_user'
export EMQ_PASS='your_pass'
emq auth login
- 查看状态:
emq auth status
任务流程
- 先确认认证状态(
auth status)。 - 数据查询优先使用
market snapshot/market series。 - 组合操作优先使用
portfolio create/portfolio list/portfolio qorder。 - 额度检查使用
quota usage。 - 需要直接透传 SDK 参数时使用
raw css/csd/pquery/porder。
常用命令模板
emq market snapshot 000001.SZ CLOSE --output table
emq market series 000001.SZ CLOSE --start 2025-01-01 --end 2025-01-31 --output csv
emq portfolio create --code DEMO_PF --name "Demo Portfolio" --initial-fund 1000000
emq portfolio list --output table
emq portfolio qorder --code DEMO_PF --stock 300059.SZ --volume 1000 --price 10.5 --date 2025-01-15
emq quota usage --start 2025-01-01 --end 2025-01-31
emq raw css 000001.SZ CLOSE --options "TradeDate=2025-01-15"
输出与参数规则
- 默认输出为
json;可用--output json|table|csv。 - 叶子命令末尾的
--output会覆盖全局--output。 - 日期参数统一使用
YYYY-MM-DD。
排障约定
- 参数报错先执行
emq <domain> <command> --help确认 flags。 - 登录失败先检查
EMQ_USER/EMQ_PASS,再尝试显式auth login --user ... --password ...。 - 业务命令失败时先执行
auth status --check验证远端状态。
参考
更完整的场景化命令见 references/command-recipes.md。