Skip to main content
logo

✨ nonebot-plugin-stock ✨

LICENSE pypi python uv
ruff pre-commit

📖 介绍

基于 Longbridge OpenAPI 的 NoneBot 股票行情插件,支持实时行情、快捷标的和市场榜单查询。 插件使用 /stock/longbridge 作为命令别名,行情标的使用 CODE.MARKET 格式。

💿 安装

使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-stock --upgrade

使用 pypi 源安装

nb plugin install nonebot-plugin-stock --upgrade -i "https://pypi.org/simple"

使用清华源安装

nb plugin install nonebot-plugin-stock --upgrade -i "https://pypi.tuna.tsinghua.edu.cn/simple"
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
uv
uv add nonebot-plugin-stock

安装仓库 master 分支

uv add git+https://github.com/ByteColtX/nonebot-plugin-stock@master
pdm
pdm add nonebot-plugin-stock

安装仓库 master 分支

pdm add git+https://github.com/ByteColtX/nonebot-plugin-stock@master
poetry
poetry add nonebot-plugin-stock

安装仓库 master 分支

poetry add git+https://github.com/ByteColtX/nonebot-plugin-stock@master

打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入

plugins = ["nonebot_plugin_stock"]
使用 nbr 安装(使用 uv 管理依赖可用)

nbr 是一个基于 uv 的 nb-cli,可以方便地管理 nonebot2

nbr plugin install nonebot-plugin-stock

使用 pypi 源安装

nbr plugin install nonebot-plugin-stock -i "https://pypi.org/simple"

使用清华源安装

nbr plugin install nonebot-plugin-stock -i "https://pypi.tuna.tsinghua.edu.cn/simple"

⚙️ 配置

在 nonebot2 项目的.env文件中添加下表中的必填配置。凭证由 Longbridge 控制台提供。

⚠️ 安全提示: 本插件仅建议使用 Longbridge 模拟账户进行开发和测试。 不要使用真实股票账户的 API Key、App Secret 或 Access Token,也不要将任何凭证提交到代码仓库。

配置项 必填 默认值 说明
LONGBRIDGE_APP_KEY Longbridge App Key
LONGBRIDGE_APP_SECRET Longbridge App Secret
LONGBRIDGE_ACCESS_TOKEN Longbridge Access Token

示例:

LONGBRIDGE_APP_KEY=你的AppKey
LONGBRIDGE_APP_SECRET=你的AppSecret
LONGBRIDGE_ACCESS_TOKEN=你的AccessToken

🎉 使用

指令表

指令 权限 需要@ 范围 说明
/stock quote <SYMBOL>... 群员 群聊、私聊 查询一个或多个标的的实时行情
/stock quick <COMMAND> 群员 群聊、私聊 管理快捷标的
/stock rank [TYPE MARKET COUNT] 群员 群聊、私聊 查询 Longbridge 市场榜单
直接发送快捷代码 群员 群聊、私聊 查询内置或自定义快捷标的

/longbridge/stock 等价。输入 /stock --help 可以查看完整帮助信息。

实时行情

/stock quote AAPL.US
/stock quote TSLA.US NVDA.US
/longbridge quote 700.HK

快捷标的

内置快捷代码包括:qqqspyaapltslamsftnvdaamzngooglmetaamdbaba。代码不区分大小写。

/stock quick add COIN.US
/stock quick del COIN.US
/stock quick remove COIN.US
/stock quick list
/stock quick quote

添加 COIN.US 后,直接发送 coinCOIN.US 都可以查询。快捷标的由 nonebot-plugin-localstore 持久化。

市场榜单

/stock rank
/stock rank hot US
/stock rank rising HK 20
/stock rank trade US 10
/stock rank discuss CN
/stock rank watch SG 10
/stock rank turnover US 10

普通榜单支持 hotrisingtradediscusswatch 类型,市场支持 USHKCNSG,数量范围为 1-50,默认 10。成交额榜支持 USHKCN 三个市场。 榜单由 Longbridge 服务端综合排序,插件不提供按单一字段重新排序的选项。

🎨 效果图

暂无示例图。

Download files

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

Source Distribution

nonebot_plugin_stock-0.1.1.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

nonebot_plugin_stock-0.1.1-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_stock-0.1.1.tar.gz.

File metadata

  • Download URL: nonebot_plugin_stock-0.1.1.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for nonebot_plugin_stock-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b06df63a8b22f9fa407b749b289310a1509c72ce3d15fdac086aee625e19854d
MD5 e7e732cb01d310db5f6487fcb1f10f20
BLAKE2b-256 2a6a03d840513e6e06d1584d7fad70bd925b5b8cc49c706654154642c63fd17e

See more details on using hashes here.

File details

Details for the file nonebot_plugin_stock-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: nonebot_plugin_stock-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for nonebot_plugin_stock-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a0fc38cb502b997cd9730384d5d6fb4a07cd356d764ce61c36c98be875476d28
MD5 03f1174f4c4ea2f2e002bb354c95ee4c
BLAKE2b-256 deccbafef1b2a79338d646a2d73b803e3c276c9cfa6370e97d1913c1d5e88ca3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page