Skip to main content

A fast CLI tool for real-time stock data

Project description

agent-stock

CI PyPI version Python

面向 AI Agent 的股市数据命令行工具,提供市场概览、个股行情、板块涨跌、技术指标与资金流向等信息。

安装

# uv tool
uv tool install agent-stock  # 安装
uv tool upgrade agent-stock  # 升级

# pip
python -m pip install agent-stock     # 安装
python -m pip install -U agent-stock  # 升级

快速开始

# 市场数据
stock search 腾讯
stock rank --count 20

# 个股数据
stock quote 000001
stock quote 000001,600519
stock kline 000001
stock fundflow 000001

# 帮助与版本
stock --help
stock quote --help
stock -v

命令

可以通过 stock --helpstock <子命令> --help 查看帮助。

市场数据

stock index --market <market>             # 大盘主要指数总览(A股含申万一级行业数据)
stock search <keyword>                    # 股票搜索,仅限股票名称、股票代码、股票简称搜索

# 仅限A股使用的命令
stock query <condition>                   # 条件选股
stock rank --sort <sort> --count <count>  # 市场股票排序,sort 默认值 turnover

# 参数说明:
# - market: 市场,可选 ab|us|hk,默认 ab
# - sort: 排序类型,可选 成交额 turnover|量比 volumeRatio|换手率 exchange|涨跌幅 priceRatio|主力净流入 netMainIn
# - count: 排序数量,默认 20,取值范围 1 - 100
# - keyword: 关键词,示例:腾讯、tengxun等
# - condition: 自然语言的条件语句,示例:"MACD金叉;KDJ金叉;非ST;非涨停;市盈率大于0;市盈率小于100;市值大于50亿;"

个股数据

stock detail <symbol>               # 个股详情,包含股票实时行情、相关板块、最新新闻、日K数据、技术指标、资金流向等
stock quote <symbols>               # 个股实时行情(支持批量查询)
stock plate <symbol>                # 个股相关板块涨跌幅(地域/行业/概念)
stock news <symbol>                 # 个股最新新闻
stock kline <symbol>                # 日K数据以及技术指标(EMA/BOLL/KDJ/RSI)
stock fundflow <symbol>             # 资金分布与每日主力/散户净流向

# 参数说明:
# - symbol: 股票代码,支持 A 股、港股、美股
#   - A股:6 位数字,如 600519、000001
#   - 港股:5 位数字,如 00700
#   - 美股:us.<ticker>,如 us.aapl、us.msft(大小写不敏感)
# - symbols: 单个或多个股票代码,用逗号分隔,如 000001,00700,us.aapl

开发

# 安装依赖
uv sync

# 运行测试
uv run pytest tests/ -v

# Lint
uv run ruff check .

# 调试
uv run python -m stock quote 000001

Trae

使用如下命令在 Trae 中启用 agent-stock 技能:

mkdir -p .trae/skills/

ln -s $(pwd)/skills ~/.trae/skills/agent-stock

测试 agent-stock 技能:

  • 选股:帮我选股
  • 个股决策:帮我决策 天孚通信

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

agent_stock-0.2.0.tar.gz (53.0 kB view details)

Uploaded Source

Built Distribution

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

agent_stock-0.2.0-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file agent_stock-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for agent_stock-0.2.0.tar.gz
Algorithm Hash digest
SHA256 765671e9ee3a1054ec00f047fa03c106f1edd560ba609804f2a0b47f842129fb
MD5 7a756551a51f446c7eb8f4b7695d315f
BLAKE2b-256 20240eba3c506f48644b718b8591c1c8ee1e7bbeca00c636c795e6f3ecf10194

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_stock-0.2.0.tar.gz:

Publisher: publish.yml on AnoyiX/agent-stock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_stock-0.2.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for agent_stock-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 896cf6b0bca8c51a16aeb2f15fb6a6218b7ba2221b10f1f0c7e55add7e315e5e
MD5 a3c4148d168517068ece2d5484a5a295
BLAKE2b-256 639b033ae0cf3b7845f8d61f6dd834c197b15f44116eb9d7bf6e644e95754eca

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_stock-0.2.0-py3-none-any.whl:

Publisher: publish.yml on AnoyiX/agent-stock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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