
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
koishi-plugin-stock-market
Advanced tools
一个功能完整的 Koishi 股票投资模拟插件,提供真实的股票市场交易体验。
# 在 Koishi 项目的目录下安装
npm install koishi-plugin-stock-market
在 Koishi 配置文件中添加插件:
plugins:
stock-market:
initialCash: 100000 # 初始资金(元)
tradeFee: 0.003 # 交易手续费率(0.3%)
minFee: 5 # 最低手续费(元)
minTradeAmount: 1000 # 最小交易金额(元)
updateInterval: 5 # 市场更新间隔(分钟)
maxChangePercent: 0.10 # 单日最大涨跌幅(10%)
enableMarket: true # 是否启用市场
marketOpenHour: 9 # 开市时间(小时)
marketOpenMinute: 30 # 开市时间(分钟)
marketCloseHour: 15 # 收市时间(小时)
marketCloseMinute: 0 # 收市时间(分钟)
enableAutoReset: true # 是否启用每日自动重置市场
| 指令 | 说明 |
|---|---|
股票开户 | 开通股票账户,获得初始资金 |
我的账户 | 查看账户余额、持仓和盈亏 |
交易记录 | 查看最近的交易记录 |
| 指令 | 说明 |
|---|---|
股票市场 | 查看市场整体状态 |
股票列表 | 查看所有股票信息 |
股票列表 <关键词> | 按股票代码、名称或行业搜索 |
股票查询 <代码> | 查看单只股票的详细信息 |
| 指令 | 说明 |
|---|---|
股票买入 <代码> <数量> | 买入指定数量的股票 |
股票卖出 <代码> <数量> | 卖出指定数量的股票 |
| 指令 | 说明 |
|---|---|
股票排行 | 查看资产排行榜 TOP 10 |
股票帮助 | 显示所有指令帮助 |
max(交易金额 × 手续费率, 最低手续费) 的手续费| 代码 | 名称 | 行业 |
|---|---|---|
| 000001 | 平安银行 | 银行 |
| 000002 | 万科A | 房地产 |
| 000858 | 五粮液 | 白酒 |
| 000876 | 新希望 | 农业 |
| 300750 | 宁德时代 | 新能源 |
| 300059 | 东方财富 | 证券 |
| 601318 | 中国平安 | 保险 |
| 600519 | 贵州茅台 | 白酒 |
| 600036 | 招商银行 | 银行 |
| 601888 | 中国中免 | 旅游零售 |
| 000725 | 京东方A | 电子 |
| 002415 | 海康威视 | 安防 |
| 601012 | 隆基绿能 | 光伏 |
| 600690 | 海尔智家 | 家电 |
| 000333 | 美的集团 | 家电 |
| 002594 | 比亚迪 | 汽车 |
| 601919 | 中远海控 | 航运 |
| 600276 | 恒瑞医药 | 医药 |
| 300760 | 迈瑞医疗 | 医疗器械 |
股票价格采用随机波动模型,基于以下因素:
[open * (1 - maxChangePercent), open * (1 + maxChangePercent)] 范围内用户: 股票开户
Bot: 🎉 股票账户开通成功!
💰 初始资金: 100000.00 元
📊 使用 "股票帮助" 查看更多指令
用户: 股票列表 白酒
Bot: 📊 股票列表
━━━━━━━━━━━━━━━━
⚪ 000858 五粮液
价格: 180.50 | 涨跌: +0.00 (+0.00%)
...
用户: 股票买入 000858 100
Bot: ✅ 买入成功!五粮液 100 股,价格: 180.50 元,手续费: 54.15 元
用户: 我的账户
Bot: 👤 我的股票账户
━━━━━━━━━━━━━━━━
💰 现金余额: 99845.85 元
📊 持仓市值: 18050.00 元
...
# 克隆项目
git clone <repository-url>
cd koishi-plugin-stock-market
# 安装依赖
npm install
# 开发模式
npm run dev
# 构建
npm run build
{
code: string // 股票代码
name: string // 股票名称
industry: string // 所属行业
basePrice: number // 基准价格
price: number // 当前价格
open: number // 开盘价
high: number // 最高价
low: number // 最低价
change: number // 涨跌额
changePercent: number // 涨跌幅
volume: number // 成交量(手)
turnover: number // 成交额(万)
volatility: number // 波动率
trend: 'bull' | 'bear' | 'neutral' // 趋势
lastVolume: number // 上次成交量
}
{
userId: string // 用户ID
cash: number // 现金余额
totalDeposit: number // 累计入金总额
totalAssets: number // 总资产
profit: number // 总盈亏(基于累计入金)
profitPercent: number // 盈亏比例
createTime: number // 开户时间
lastTradeTime: number // 最后交易时间
}
{
id: string // 记录ID(时间戳+随机数)
userId: string // 用户ID
stockCode: string // 股票代码
stockName: string // 股票名称
type: 'buy' | 'sell' // 交易类型
price: number // 交易价格
shares: number // 交易数量
amount: number // 交易金额
fee: number // 手续费
netAmount: number // 净金额
profit: number // 净盈亏(仅卖出时)
time: number // 交易时间
}
插件使用 Koishi 数据库存储以下数据:
| 表名 | 说明 |
|---|---|
stock_account | 用户账户信息 |
stock_position | 用户持仓信息 |
stock_trade | 交易记录 |
MIT
FAQs
Koishi模拟股票投资插件,提供完整的股票市场模拟功能
We found that koishi-plugin-stock-market demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.