Skip to main content

Official command-line client for the NumCat financial data API

Project description

NumCat CLI

NumCat 官方命令行客户端。它通过统一入口调用 NumCat 金融数据 API,既支持全部 apiname 的通用查询,也提供常用行情的快捷命令。

安装

uv tool install numcat-cli

也可以使用 pipx install numcat-cli。升级命令:

uv tool upgrade numcat-cli

配置

从 NumCat 网页控制台复制 API Key,然后隐藏输入:

numcat auth set-key
numcat auth status

自动化环境使用 NUMCAT_API_KEY。该环境变量的优先级高于操作系统凭据库。 普通配置文件只保存服务地址,不保存 API Key。

查询

numcat calendar latest
numcat stock daily --date 20260710 --symbols 000001,600000
numcat query daily --param tradedate=20260710 --fields symbol,name,close
numcat query screening --params @request.json --format csv --output result.csv

--format 支持 autotablejsonjsonlcsv。交互终端默认显示表格, 管道及重定向默认输出完整 JSON。

可用命令包括:

numcat auth set-key|status|clear
numcat config show|set-base-url
numcat api list|show
numcat query <apiname>
numcat calendar latest|range|recent|by-date
numcat stock basic|daily|minute|tick|screening|limit-pool
numcat market emotion
numcat news latest
numcat doctor
numcat version

通用查询的 --param key=value 始终按字符串发送,适合日期、股票代码等值;数组、 对象和布尔值请通过 --params JSON 传入。两者同时使用时,重复的 --param 覆盖 JSON 顶层同名字段。

稳定退出码:0 成功、2 参数或输出格式错误、3 鉴权/权限/额度错误、4 API 业务或服务端错误、5 网络或超时。

安全

  • API Key 使用操作系统凭据库保存,不写入普通配置文件。
  • HTTP 地址默认拒绝携带 API Key;确有需要时必须显式传入 --allow-insecure
  • CLI 不采集使用遥测,也不会在输出和错误信息中打印完整密钥。

可用环境变量:

  • NUMCAT_API_KEY:覆盖系统凭据库中的密钥,适合 CI 和服务器。
  • NUMCAT_BASE_URL:覆盖配置文件中的服务地址。
  • NUMCAT_DISABLE_VERSION_CHECK=1:关闭每天一次的 PyPI 版本检查。

开发

cd Product/cli
python -m pip install -e ".[test]"
pytest
python -m build

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numcat_cli-0.1.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numcat_cli-0.1.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file numcat_cli-0.1.0.tar.gz.

File metadata

  • Download URL: numcat_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for numcat_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c8675d9769820fd51def41a3979a443ba70916f2b2e77cdfdff8c7f68718baff
MD5 22b8967368fa6411133ad2929b14418f
BLAKE2b-256 672144bdb0cc5161aef6d2e34fb01ed1d931ab49aea84c0a3f9b276bb5809c49

See more details on using hashes here.

File details

Details for the file numcat_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: numcat_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for numcat_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7fceca5aea65dd7b4457edb0d6d818e5d8c10966809b8f8fe97b3d120665c963
MD5 a21a33d95f60e989b3fa774eb6caa8d8
BLAKE2b-256 747456e628d927a776c2dcb408dfe21b9594873251d290f79de255fa4f38876d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page