New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

opencode-plugin-stock

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opencode-plugin-stock

Stock — A股多维度分析评分插件,5个专业Agent并发分析+HTML报告生成

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

Stock — Multi-Agent Stock Analysis Plugin

An OpenCode plugin that performs multi-dimensional A-share stock analysis using parallel AI agents. Each agent specializes in one analysis dimension, scores 0-100, and a coordinator aggregates weighted results into a comprehensive HTML report.

Architecture

User: @coordinator 分析 000001
                ↓
         Coordinator (验证股票 + 并发调度)
                ↓ task() × 5 (parallel)
  ┌─────────┬──────────┬──────────┬──────────┐
  ↓         ↓          ↓          ↓          ↓
 finance   chart    sector    sentiment    flow
 30%       25%        15%        15%        15%
  ↓         ↓          ↓          ↓          ↓
  └─────────┴──────────┴──────────┴──────────┘
                ↓
         Reporter (生成 HTML 报告)
                ↓
     .stock/reports/<code>.html + 可选 PDF

Agents

AgentRoleWeightKey Output
coordinatorOrchestrator (primary)验证 + 调度 + 聚合
financeFundamentals + valuation30%PE/PB 估值判断, 合理价格区间, 股息率
chartTechnical analysis25%趋势方向, 支撑/阻力位, 买卖信号
sectorIndustry & business15%行业地位, 竞争格局, 前景
sentimentSentiment & news15%研报评级, 概念热点, 媒体情绪
flowCapital flow & chips15%股东集中度, 机构持仓, 资金流向
reporterHTML report generatorSVG 雷达图, 人性化解读, 投资建议

Data Source

All market data is fetched via tongstock-cli (TDX protocol). Skills are auto-downloaded from the repo on first run (~/.tongstock/), with bundled fallbacks.

Quick Start

1. Prerequisites

# Install tongstock-cli
git clone https://github.com/sjzsdu/tongstock.git
cd tongstock
go build -o tongstock-cli ./cmd/cli
sudo mv tongstock-cli /usr/local/bin/

2. Register Plugin

In .opencode/opencode.json:

{
  "plugin": [
    "./plugins/stock/index.ts"
  ]
}

3. Use

@coordinator 分析 000001
@coordinator 分析 600519 贵州茅台

Report Output

The plugin generates professional HTML reports at .stock/reports/<code>.html containing:

  • Score gauge — CSS conic-gradient circular score display
  • Radar chart — SVG 5-dimension visualization
  • Dimension cards — Each with progress bar + narrative interpretation
  • Bullish/Bearish — Side-by-side color-coded sections
  • Investment advice — Tailored for conservative/balanced/aggressive investors
  • PDF exportagent-browser open file://path && agent-browser pdf output.pdf

Configuration

Create .opencode/stock.json (optional — all settings have defaults):

{
  "weights": "balanced",
  "agents": {
    "coordinator": { "model": "anthropic/claude-sonnet-4-20250514" },
    "finance": { "model": "anthropic/claude-sonnet-4-20250514" },
    "chart": { "model": "anthropic/claude-sonnet-4-20250514" }
  }
}

Weight Presets

PresetFinanceChartSectorSentimentFlow
conservative35%15%15%15%20%
balanced (default)30%25%15%15%15%
aggressive25%35%15%15%10%

Custom weights:

{
  "weights": {
    "finance": 0.40,
    "chart": 0.20,
    "sector": 0.15,
    "sentiment": 0.10,
    "flow": 0.15
  }
}

Skill Auto-Download

On first load, the plugin clones sjzsdu/tongstock to ~/.tongstock/ and reads skills from ~/.tongstock/skills/. On subsequent loads, it runs git pull --ff-only to sync.

Skill loading priority:
1. ~/.tongstock/skills/<name>/SKILL.md  (remote, auto-updated)
2. plugins/stock/skills/<name>.md       (bundled fallback)

Scoring System

Each sub-agent returns a structured JSON score with extended fields:

finance agent output

{
  "agent": "finance",
  "score": 78,
  "confidence": 0.85,
  "reasoning": "从财务数据来看,该公司净资产收益率持续维持在12%以上...",
  "valuation": {
    "pe_assessment": "合理",
    "fair_price_range": "25-30 元",
    "dividend_yield": "3.2%",
    "risk_alerts": ["负债率偏高"]
  }
}

chart agent output

{
  "agent": "chart",
  "score": 65,
  "confidence": 0.80,
  "reasoning": "从日线图来看,该股近期呈现出明确的上升趋势...",
  "technicals": {
    "trend": "上升趋势",
    "support": "12.5",
    "resistance": "14.8",
    "signal": "买入",
    "multi_timeframe": "日线周线同向多头"
  }
}

Score ranges:

RangeMeaning
90-100Excellent — strong buy signal
75-89Good — worth attention
60-74Average — hold/neutral
40-59Weak — caution advised
0-39Poor — avoid

Directory Structure

.opencode/plugins/stock/
├── index.ts              # Plugin entry (skill download + agent registration)
├── config.ts             # Weight presets + config loader
├── types.ts              # TypeScript types
├── agents/
│   ├── index.ts          # AGENTS export map
│   ├── coordinator.ts    # 📊 Orchestrator (primary)
│   ├── fundamentalist.ts # 💰 Finance + valuation (30%)
│   ├── technician.ts     # 📈 Chart + signals (25%)
│   ├── industry.ts       # 🏭 Sector + business (15%)
│   ├── sentiment.ts      # 📰 Sentiment + news (15%)
│   ├── chip.ts           # 🎯 Capital flow (15%)
│   └── report-generator.ts # 📄 HTML report with visualization
├── skills/               # Bundled fallback skills
│   ├── tongstock-cli.md
│   └── tongstock-workflow.md
└── README.md

Tech Stack

  • Runtime: Bun
  • Language: TypeScript (strict mode)
  • Plugin SDK: sjz-opencode-sdk
  • Data: tongstock-cli (TDX protocol, A-share only)
  • PDF export: agent-browser (Playwright-based)

License

MIT

Keywords

opencode

FAQs

Package last updated on 21 Mar 2026

Did you know?

Socket

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.

Install

Related posts