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                               # 大盘主要指数总览(A股含申万一级行业数据)
stock search <keyword>                    # 股票搜索,仅限股票名称、股票代码、股票简称搜索
stock query <condition>                   # 条件选股
stock rank --sort <sort> --count <count>  # 市场股票排序,sort 默认值 turnover

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

个股数据

stock detail <symbol>               # 个股详情,包含股票实时行情、日K数据、技术指标、分时数据、资金流向、相关板块和概念、新闻等

# 参数说明:
# - symbol: 股票代码,支持 A 股,如 600519、000001

🤖 技能

【个股决策】

输入示例: 帮我决策 天孚通信

【AI 选股】

输入示例: 帮我选股

【持仓分析】

输入示例(建议单次分析不要超过 6 只股票持仓的记录):

帮我分析持仓:

资金余额: 400000, 总资产: 1000000, 总市值: 600000, 持仓占比: 60%
\`\`\`csv
代码,名称,现价,成本,股数,持仓收益率,持仓占比
000001,xxxxxx,20.45,20.33,400,+4.96%,1.51%
000002,xxxxxx,20.82,21.84,1600,-2.92%,6.00%
000003,xxxxxx,3.46,3.89,39900,-1.05%,24.41%
000004,xxxxxx,26.89,25.34,1500,+2.88%,6.92%
\`\`\`

[!TIP] Stocks AI 投资账本 可以一键复制持仓分析信息

🐛 开发

# 安装依赖
uv sync

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

# Lint
uv run ruff check .

# 调试
uv run python -m stock quote 000001

在 IDE 中启用该技能,以 Trae 为例:

mkdir -p .trae/skills/

ln -s $(pwd)/skills ~/.trae/skills/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.5.tar.gz (87.2 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.5-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agent_stock-0.2.5.tar.gz
  • Upload date:
  • Size: 87.2 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.5.tar.gz
Algorithm Hash digest
SHA256 704dfdcfda24256b73df44ab9f91e57a20a11c97d954e24c3a4959e84199e849
MD5 256a7ce3aa8df0e903b4f6338a45658c
BLAKE2b-256 ef646e3c96d6eb78c52335ddab32a24e3b5b2e0a92013623fd2414668c58a411

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_stock-0.2.5.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.5-py3-none-any.whl.

File metadata

  • Download URL: agent_stock-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 29.5 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1a0c64c5ec5a0664f1f1be8d7a154d4114b211283d34a5a189e39a7b5bc32721
MD5 663bf5f95f327cee73ee88d8fddfa7ae
BLAKE2b-256 b86f176f09974156517418744725056753e7f1878a4b7d596e517d943dd3b290

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_stock-0.2.5-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