npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

linker-trading-mcp-v2

v0.6.0

Published

MCP server for Linker Trading System v2 - hand-crafted tools with clean LLM-optimized responses

Readme

linker-trading-mcp-v2

Linker 交易系统 MCP 服务(v2),为 LLM/Agent 提供盈亏、持仓、行情、策略值查询能力。

Changelog

v0.5.1

  • search_economic_indicators:新增 lv3 筛选参数;翻页提示改为"可用page翻页或lv2/lv3精筛"
  • get_economic_data:正确捕获后端业务错误(code≠0);空数据提示优化

v0.5.0

  • 新增 search_economic_indicators:搜索经济数据库指标目录(化工、能源、汇率、原油、kpler等),返回 TSV 格式四级分类表,支持 keyword/lv1/lv2/lv3/page 筛选
  • 新增 get_economic_data:查询指标历史时间序列,支持日/周/月频率,返回 TSV 格式

v0.4.7

  • get_pnl_summary:修复 VAR 字段全为 null 的问题(改用 owner_name 作为 join key)

v0.4.5

  • 重构工具设计:从 9 个工具精简为 8 个,消除功能重叠
  • get_owner_pnl(新):合并原 get_owner_positions + get_owner_active_strategies,新增浮动盈亏 + VAR 风险值(来自 /pnl/report
  • get_pnl_summary(增强):新增公司 VAR 概览(来自 /risk/dashboard/overview),支持 status 参数过滤活跃/全部策略
  • get_market_prices(改名):原 get_market_price 改为批量版,支持多合约同时查询
  • get_strategy_detail(新):查询策略公式、合约组合、目标价位、评分
  • 移除:get_positions_summaryget_owner_active_strategiesget_owner_positions(功能已合并)

v0.4.0

  • get_owner_positions / get_positions_summary / get_owner_active_strategies:改用 /pnl/summary 接口
  • get_foreign_prices:不传参数时自动查询所有已知外盘合约

环境变量

| 变量 | 说明 | 示例 | |------|------|------| | TRADING_API_BASE | 交易服务地址(含 /trading-api 前缀) | http://hub.linker.net/trading-api | | TRADING_API_KEY | API Key(X-API-Key 鉴权) | trading-prod-20260323 |

工具列表

get_owner_pnl — 持仓人完整盈亏

查询某持仓人的完整盈亏报告:已实现盈亏、浮动盈亏、VAR + 每个活跃策略明细。

参数

  • owner(必填):持仓人姓名

返回

{
  "owner": "任志华",
  "realized_pnl": 97863168.24,
  "floating_pnl": -7253163,
  "total_pnl": 90610005.24,
  "owner_var": 25914030.71,
  "var_limit": 25000000,
  "var_usage_rate": 1.04,
  "var_alert_level": "overlimit",
  "active_strategies": 22,
  "strategies": [{
    "strategy": "AU_单边策略_趋势跟踪_AU2606",
    "total_pnl": -316800,
    "floating_pnl": 120000,
    "var": 618684,
    "legs": [{"contract": "AU2606", "direction": "BUY", "qty": 20, "avg_price": 1031.14, "market_price": 1037.14, "unrealized_pnl": 120000}]
  }]
}

get_pnl_summary — 全员盈亏汇总 + VAR概览

查询各持仓人的策略盈亏汇总,附带公司 VAR 风险概览。

参数

  • owners(可选):持仓人姓名列表
  • status(可选):"active"(默认,只看有持仓的)或 "all"

返回

[{
  "owner": "任志华",
  "var_value": 25914030.71,
  "var_limit": 25000000,
  "var_alert": "overlimit",
  "strategies": [{"strategy_id": 2257, "strategy": "PP_加工利润", "net_qty": 200, "realized_pnl": 50000, "open_count": 2}]
}]

get_market_prices — Wind合约行情(批量)

批量查询期货合约最新市场价格(Wind 数据源,需内网)。

参数

  • contract_codes(必填):合约代码列表,如 ["PG2606.DCE", "M2509.DCE"]

get_strategy_values — 策略当前计算值

查询策略实时计算值(基于行情和公式)。

参数

  • keyword(可选):策略名关键词
  • limit(可选):返回条数,默认 50

get_strategy_detail — 策略详情

查询策略公式、合约组合、目标价位、评分。

参数

  • strategy_id(必填):策略 ID

返回

{
  "strategy_id": 2257,
  "name": "PP_加工利润_生产利润_PP2607/FEI,JUL-2026",
  "formula": "PP2607 - FEI,JUL-2026 * UCH26 * 1.1099",
  "category": "加工利润",
  "target_open": null,
  "target_close": null,
  "legs": [{"contract": "PP2607", "side": "LONG", "multiplier": 1.0}]
}

search_economic_indicators — 经济数据库指标搜索

搜索经济数据库指标目录(化工、能源、汇率、原油、气温、取暖指数、kpler等品类)。

参数

  • keyword(可选):关键词模糊搜索
  • lv1(可选):一级分类,如 化工kpler
  • lv2(可选):二级分类,如 丁二烯中国
  • lv3(可选):三级分类,如 价格库存
  • page(可选):页码,默认1,每页50条

返回(TSV)

# 搜索"丁二烯" | 共9条 | 第1/1页
lv1	lv2	lv3	lv4	category_path
化工	丁二烯	价格	市场价:杭州	化工/丁二烯/价格/市场价:杭州

get_economic_data — 经济数据库时间序列

查询指标历史时间序列数据,需先用 search_economic_indicators 获取 category_path

参数

  • category_path(必填):如 化工/丁二烯/价格/市场价:杭州
  • start_date(必填):YYYY-MM-DD
  • end_date(必填):YYYY-MM-DD
  • period(可选):D=日(默认)、W=周、M=月

返回(TSV)

# 化工/丁二烯/价格/市场价:杭州 | period=D | 2026-05-01~2026-05-12 | 5条
date	value
2026-05-06	13425
2026-05-07	12900

list_owners — 持仓人列表

列出所有持仓人姓名和 ID。


get_foreign_prices — 外盘实时行情

查询外盘期货合约实时报价(Marex 数据源)。

参数

  • contract_codes(必填):合约代码列表,格式 FIELD,MON-YYYY,如 ["FEI,MAY-2026", "CP,JUN-2026"]

get_wind_history — Wind历史收盘价

查询期货合约 Wind 历史收盘价序列。

参数

  • contract_codes(必填):合约代码列表
  • start_date(必填):开始日期 YYYY-MM-DD
  • end_date(必填):结束日期 YYYY-MM-DD

Agent 使用场景

| 场景 | 工具 | |------|------| | 某人持仓+浮盈+风险 | get_owner_pnl | | 各人盈亏排名+VAR | get_pnl_summary | | 某合约现价 | get_market_prices | | 外盘 LPG 报价 | get_foreign_prices | | 套利价差/加工利润 | get_strategy_values | | 策略公式和目标价 | get_strategy_detail | | 历史价格走势 | get_wind_history | | 有哪些丁二烯/原油数据 | search_economic_indicators | | 某经济指标历史走势 | search_economic_indicatorsget_economic_data |

配置方式

Claude Desktop

{
  "mcpServers": {
    "linker-trading": {
      "command": "npx",
      "args": ["-y", "linker-trading-mcp-v2@latest"],
      "env": {
        "TRADING_API_BASE": "http://hub.linker.net/trading-api",
        "TRADING_API_KEY": "your-api-key"
      }
    }
  }
}

Claude Code

claude mcp add linker-trading \
  --env TRADING_API_BASE=http://hub.linker.net/trading-api \
  --env TRADING_API_KEY=your-api-key \
  -- npx -y linker-trading-mcp-v2@latest