原型 · 预览版:收录官方注册中心里的全部服务器,每 30 分钟同步一次。使用 Google 登录即可撰写评价。原型 · 每 30 分钟更新
PopNx MCP为使用 AI 的人准备的 MCP 服务器 · 用大白话讲清楚 登录

Marina rules

作者:David-Marina版本 2026.11.16i★ 1i在你的电脑上运行代码仓库 ↗
注册名称io.github.David-Marina/marina-rules

安装方法

能做什么

Point-in-time exchange trading rules with sources: A-share price limits, stamp duty, ticks, futures

作者提供的原文

  • 连接方式 在你的电脑上运行
  • 账号或密钥 无需密钥
  • 分类 会计、财务与税务

为什么排在这里

列表按使用分(满分 100)排序,由以下部分组成

热度4/80GitHub 星标或每周下载量:较大的计 60,较小的计 20
新鲜度12/1230 天内有发布或代码更新得满分
仍在响应0/8上次检查时云端端点有响应
使用分16/100

质量: 基础检查通过 3/3 项(仅展示,不用于排序) · 上升势头: 暂无数据 (只用于“上升中”标签)

安装

选择你使用的 AI 应用,然后复制设置。

用一句话让 AI 帮你安装

请帮我安装 Marina rules。按照 https://mcp.popnx.com/i/david-marina-marina-rules.md 操作,先把命令给我看,等我同意后再运行。

粘贴到能在你电脑上工作的 AI(如 Claude Code、Cursor)。它会读取我们的步骤,先给你看命令,等你同意。无需密钥,无需注册。 · 查看 AI 会读取的全文

通过 3/3 项检查 · 在你的电脑上运行 · ✓ 命令已检查 2026年11月16日

第一步:你用哪个 AI?

选择你用的应用,步骤会显示在下方。

可连接 Claude,但需要先准备

需要先在电脑上安装 Python (uv)(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用

让 AI 帮你安装

把这段话复制到 Claude 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。

请在这台电脑上为 Claude 安装 MCP server Marina rules,按顺序:1) 用 uv --version 检查是否有 uv。没有的话,请让我从 https://docs.astral.sh/uv/getting-started/installation/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "mcpServers": { "marina-rules": { "command": "uvx", "args": [ "marina-rules", "mcp" ] } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) 不需要密钥。5) 按约定执行,然后确认 Marina rules 的工具真的出现了。

这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 uv(如果还没有)

    已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter

    uv --version
    • 显示版本号(例如 uv …)= 已安装,可跳过这一步
    • 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
    怎么打开终端

    Mac:按 ⌘ + Space,输入 Terminal 后按 Enter

    Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”

    还没安装: uv 没有点选式安装程序。从 uv 官方页面复制适合你系统(macOS 或 Windows)的一行命令,粘贴到终端 · 不需要单独安装 Python,uv 会在需要时自动下载

    打开 uv 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: uv --version

    安装一次,所有需要 uv 的工具都能用

  2. 打开电脑版 Claude 应用的设置文件

    SettingsDeveloperEdit Config

  3. 粘贴这些设置并保存文件

    {
      "mcpServers": {
        "marina-rules": {
          "command": "uvx",
          "args": [
            "marina-rules",
            "mcp"
          ]
        }
      }
    }
  4. 退出 Claude 再重新打开

  5. 试一试

    用 Marina rules 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Claude 说正在使用 Marina rules,或回答中出现 Marina rules 的工具名称,就表示连接成功

菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同

ChatGPT 暂时无法连接 Marina rules

Marina rules 需要安装在你的电脑上,而 ChatGPT 只能连接在网上运行的服务器

你可以改用这些方式

A · 使用能连接 Marina rules 的应用

  • 需要先在电脑上安装 Python (uv)(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
  • 需要先在电脑上安装 Python (uv)(只需一次)
  • 需要先在电脑上安装 Python (uv)(只需一次)
  • 需要先在电脑上安装 Python (uv)(只需一次)

B · 会计、财务与税务 类中能连接 ChatGPT 的其他服务器

从同类中使用较多的里挑选,仅限用地址即可连接、无需密钥的

可连接 Claude Code,但需要先准备

需要先在电脑上安装 Python (uv)(只需一次)

让 AI 帮你安装

把这段话复制到 Claude Code 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。

请在这台电脑上为 Claude Code 安装 MCP server Marina rules,按顺序:1) 用 uv --version 检查是否有 uv。没有的话,请让我从 https://docs.astral.sh/uv/getting-started/installation/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):claude mcp add --scope user marina-rules -- uvx marina-rules mcp 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) 不需要密钥。5) 按约定执行,然后确认 Marina rules 的工具真的出现了。

这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 uv(如果还没有)

    已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter

    uv --version
    • 显示版本号(例如 uv …)= 已安装,可跳过这一步
    • 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
    怎么打开终端

    Mac:按 ⌘ + Space,输入 Terminal 后按 Enter

    Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”

    还没安装: uv 没有点选式安装程序。从 uv 官方页面复制适合你系统(macOS 或 Windows)的一行命令,粘贴到终端 · 不需要单独安装 Python,uv 会在需要时自动下载

    打开 uv 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: uv --version

    安装一次,所有需要 uv 的工具都能用

  2. 打开终端

    Mac:按 Command+空格,输入 Terminal · Windows:打开 PowerShell

  3. 粘贴这条命令并按 Enter

    claude mcp add --scope user marina-rules -- uvx marina-rules mcp
  4. 在 Claude Code 中输入 /mcp

    应能看到 Marina rules 在列表中并显示已连接

  5. 试一试

    用 Marina rules 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Claude Code 说正在使用 Marina rules,或回答中出现 Marina rules 的工具名称,就表示连接成功

菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同

可连接 Cursor,但需要先准备

需要先在电脑上安装 Python (uv)(只需一次)

让 AI 帮你安装

把这段话复制到 Cursor 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。

请在这台电脑上为 Cursor 安装 MCP server Marina rules,按顺序:1) 用 uv --version 检查是否有 uv。没有的话,请让我从 https://docs.astral.sh/uv/getting-started/installation/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "mcpServers": { "marina-rules": { "command": "uvx", "args": [ "marina-rules", "mcp" ] } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) 不需要密钥。5) 按约定执行,然后确认 Marina rules 的工具真的出现了。

这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 uv(如果还没有)

    已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter

    uv --version
    • 显示版本号(例如 uv …)= 已安装,可跳过这一步
    • 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
    怎么打开终端

    Mac:按 ⌘ + Space,输入 Terminal 后按 Enter

    Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”

    还没安装: uv 没有点选式安装程序。从 uv 官方页面复制适合你系统(macOS 或 Windows)的一行命令,粘贴到终端 · 不需要单独安装 Python,uv 会在需要时自动下载

    打开 uv 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: uv --version

    安装一次,所有需要 uv 的工具都能用

  2. 点击这个按钮打开 Cursor

    在 Cursor 中打开

    Cursor 会请你确认安装,点击 Install

  3. 在 Cursor 中以 Agent 模式打开 AI 聊天

  4. 试一试

    用 Marina rules 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Cursor 说正在使用 Marina rules,或回答中出现 Marina rules 的工具名称,就表示连接成功

菜单名称已于 2026年11月11日 对照 Cursor 帮助页面核实 · 你的界面可能因版本略有不同

可连接 VS Code,但需要先准备

需要先在电脑上安装 Python (uv)(只需一次)

让 AI 帮你安装

把这段话复制到 VS Code 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。

请在这台电脑上为 VS Code 安装 MCP server Marina rules,按顺序:1) 用 uv --version 检查是否有 uv。没有的话,请让我从 https://docs.astral.sh/uv/getting-started/installation/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "servers": { "marina-rules": { "type": "stdio", "command": "uvx", "args": [ "marina-rules", "mcp" ] } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) 不需要密钥。5) 按约定执行,然后确认 Marina rules 的工具真的出现了。

这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 uv(如果还没有)

    已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter

    uv --version
    • 显示版本号(例如 uv …)= 已安装,可跳过这一步
    • 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
    怎么打开终端

    Mac:按 ⌘ + Space,输入 Terminal 后按 Enter

    Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”

    还没安装: uv 没有点选式安装程序。从 uv 官方页面复制适合你系统(macOS 或 Windows)的一行命令,粘贴到终端 · 不需要单独安装 Python,uv 会在需要时自动下载

    打开 uv 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: uv --version

    安装一次,所有需要 uv 的工具都能用

  2. 点击这个按钮打开 VS Code

    在 VS Code 中打开

    VS Code 会请你确认安装,点击 Install

  3. 在 VS Code 中以 Agent 模式打开 AI 聊天

  4. 试一试

    用 Marina rules 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 VS Code 说正在使用 Marina rules,或回答中出现 Marina rules 的工具名称,就表示连接成功

菜单名称已于 2026年11月11日 对照 VS Code 帮助页面核实 · 你的界面可能因版本略有不同

其他支持 MCP 的应用(如 Windsurf、Zed、Gemini CLI)添加方式各不相同,请在应用列表中查看

查看所有支持 MCP 的应用 →

JSON 设置在下方“开发者专用”中

卡住了?问问正在用 Marina rules 的人💬 讨论 →
开发者专用:终端命令和 JSON 设置

安装在电脑上

Claude Code

claude mcp add --scope user marina-rules -- uvx marina-rules mcp

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "marina-rules": {
      "command": "uvx",
      "args": [
        "marina-rules",
        "mcp"
      ]
    }
  }
}

Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "marina-rules": {
      "command": "uvx",
      "args": [
        "marina-rules",
        "mcp"
      ]
    }
  }
}

VS Code (mcp.json)

{
  "servers": {
    "marina-rules": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "marina-rules",
        "mcp"
      ]
    }
  }
}

这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。

一览

每周下载量i
147/周
连接方式
在你的电脑上运行
最新版本i
2026.11.16
发布到注册中心i
2026年11月16日
代码最后更新i
2026年11月16日
作者
David-Marina
软件包
pypi: marina-rules
注册状态
活跃

哪些应用可以使用它

依据这个服务器的连接方式和各应用自己的文档,检查于 2026年11月10日。

在你的电脑上运行,适用于

ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast

全部应用及其优缺点 →

它能做什么

它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。

基础检查i

我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月20日

  • ✓ 通过

    作者与仓库一致

    注册名称已通过 GitHub 账户 David-Marina 验证,该账户拥有此仓库

  • ✓ 通过

    仍在维护

    代码最后更新于4天前

  • ✓ 通过

    有许可证

    使用 MIT

  • – 不适用

    端点有响应

    它在你的电脑上运行,没有互联网端点

  • – 不适用

    使用 OAuth 登录

    在你的电脑上运行,改用本地设置

  • … 尚未检查

    工具描述中没有隐藏指令

    它在你的电脑上运行;我们只能读取互联网端点的工具列表

已公开的漏洞(OSV.dev)

OSV.dev 中没有 marina-rules@2026.11.16 的记录

只检查这个版本的包本身,不包括所有依赖 · 检查于 2026年11月16日

我们检查什么 → · JSON

作者:申请重新检查或报告信息错误
给作者:在 README 中加徽章

如果你是作者,可把这段代码贴到 README。徽章会链接回本页。

[![Featured on PopNx MCP](https://mcp.popnx.com/badge/david-marina-marina-rules.svg)](https://mcp.popnx.com/en/servers/david-marina-marina-rules)

讨论

提问、分享技巧或报告无法使用。按“有帮助”数量排序。

还没有帖子,欢迎第一个提问或分享。

此处内容由用户撰写,不代表 PopNx 团队。

登录后发帖

用户评价

还没有评价

登录后写评价

与“会计、财务与税务”中的其他服务器比较i

  • 星标数多于此分类中其他 3496 个服务器的 87%
  • 发布到注册中心的时间比此分类中其他 3496 个服务器的 86% 更新
  • 基础检查结果等于或优于此分类中其他 3496 个服务器的 99%

与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。

常见问题

Marina rules 安全吗?

它在 3 项适用的基础检查中通过了 3 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。

它需要哪些密钥或代码?

注册中心没有列出必需的密钥,不过有些服务器会在首次使用时要求你登录。

它在我的电脑上运行还是在云端?

它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。

它还在维护吗?

GitHub 仓库最后更新于4天前,最新版本(2026.11.16)于4天前进入注册中心。

哪些应用可以使用它?

支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Python (uv)。

有什么可以替代它?

同一分类中有:SolidInvoice, Signal8, Journalit, Beancount.io, Tapetide - Indian Stock Market MCP

功能相近的其他选择

同一分类、其他作者、命令已通过检查。官方的排在前面,再按星标排序。

如何看卡片:↓ 每周下载量i★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i

SolidInvoice

Create and send invoices and quotes, manage clients, and track payments in SolidInvoice.

作者:SolidInvoice正在增长★ 99011天前更新

在云端运行✓ 服务方 · solidinvoice.co

Signal8

SEC filings, dilution, insider & institutional ownership, and political-trade data for AI agents.

作者:signal8ai正在增长↓ 431/周★ 42511天前更新

电脑或云端✓ 服务方 · signal8.ai

Journalit

Trading journal in Obsidian. Ask Claude or ChatGPT about your trades; edits are previewed first.

作者:Cursivez正在增长★ 26112天前更新

在云端运行✓ 服务方 · journalit.co

Beancount.io

Query, edit, and reconcile a hosted Beancount ledger: BQL, reports, files, and bank imports.

作者:bex-co正在增长★ 707 整个仓库的星标上个月更新

在云端运行✓ 服务方 · beancount.io
与相似项目对比
本项
Marina rules
SolidInvoiceSignal8JournalitBeancount.ioTapetide - Indian Stock Market MCP
运行位置需要安装在电脑上在云端运行,无需安装云端或安装在电脑上都可以在云端运行,无需安装在云端运行,无需安装云端或安装在电脑上都可以
需要密钥否否是否否是
可在 Claude 中按 + 添加否否否否否否
基础检查3/34/65/54/44/45/5
许可证MITMITMITNOASSERTIONMITMIT
价格登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用

作者的 README

打开 README

按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。

Marina — point-in-time trading rules (marina-rules)

Auditable backtests: the exchange trading rules in force on each day, as data with sources.

Price limits, fees, trading sessions, ticks, settlement — every record says *when* a rule took effect and *where* it was published. A backtest asks for the rule of each trade date instead of hard-coding today's; marina-check then verifies every fill against the rules of its day and, on a strict pass, emits a stamp that anyone holding the same fill log and the same rules version can recompute; citation() names the exact, byte-pinned rules a result ran under.

What a stamp certifies is deliberately narrow: the fills respected these rules. It says nothing about look-ahead in prices, survivorship or overfitting. as_of closes one more gap: it answers only from rules that had been published by a given date, so a backtest cannot use a rule change before it was announced (a rule whose publication date was not located is refused, not assumed).

Use it to check that a backtest applied the rules in force on each day — China A-share daily price limits (limit-up / limit-down), stamp duty and transfer fees, tick sizes and sessions; futures margins, limits and fees; Hong Kong and US equity rules — and to validate a fill log against them (marina-check). It holds rules only: no prices, index constituents, ST or suspension lists, adjustment factors or trading calendars.

中文 · 市场交易规则的「tzdata」:涨跌幅、费用、交易时段、tick 等制度从哪天起、依据什么,每条记录都带官方原文出处、引文和内容哈希。它给回测引擎和 AI Agent 用——查不到就报错,不猜;coverage() 预检整段窗口,resolve() 返回统一判定,diff_rules 告诉你升级后哪些回测要重跑。目前覆盖 A 股、中金所股指期货与国债期货、上期所 / 上期能源 / 郑商所 / 广期所商品期货(自 2024 年起)、港股和美股;大商所尚未覆盖,各市场的具体范围见 Coverage。CC0 数据 + MIT 代码。中文入门:README.zh-CN.md。

rules: marina-rules@2026.11.16 sha256:80188ec249ce22ae

Marina is to trading rules what the tz database is to time zones and what exchange_calendars is to trading days: small, boring, free, and meant to be the one copy everyone imports instead of the thousand copies everyone gets slightly wrong.

Status: 2026.11.16. 2873 records — 1421 verified, 1451 single-source, 1 unverified — each traced to primary sources with quotes and content hashes. Maturity differs by market: China A-share, CFFEX, SHFE and INE records are mostly verified; CZCE, GFEX, Hong Kong and US records are mostly single-source — a first pass, to be read as such (counts per market, what the levels mean). China A-shares: price limits, fees, sessions, ticks and holding periods, measured from 2006-07-01; CFFEX stock-index futures from 2010; CFFEX treasury bond futures from 2013; SHFE (20 products, incl. night sessions), INE (5 products), CZCE (27 products, mostly single-source) and GFEX (5 products, no sessions yet): margin, price limits, fees and same-day round trips from 2024-01-01; Hong Kong shares and ETFs from 2010; US stocks and ETFs from 2010. DCE, crypto and other markets are not covered. Details per market: Coverage. Treat the exchange's own notice as authoritative, always.

What changed in each release, and which backtests a release asks you to re-run: CHANGELOG.md.

Why

Every backtest engine, every trading agent, and every research notebook re-implements the same handful of rules — "ChiNext limit is 20%" — and a large share of them get the *date* wrong (it was 10% before 2020-08-24), the *scope* wrong (ST stocks differ), or the *rounding* wrong (exchanges round half-up; round() doesn't). These errors used to live in one firm's code. Now that AI agents write backtests by the thousand, the same error gets copied by the thousand.

A shared, cited, versioned table fixes this the way tzdata fixed time zones: not by being authoritative, but by being the same for everyone and traceable to the source.

examples/hardcoded_vs_marina.py prints six such fills side by side — the number a backtest gets from today's rule, and the number that applied on the trade date:

fillhard-coded with today's rulerule of that day
ChiNext, 2020-08-21, previous close 10.00: limit-up / limit-down12.00 / 8.0011.00 / 9.00
ST main-board stock, 2024-06-14, previous close 10.0011.00 / 9.0010.50 / 9.50
Main-board IPO in its first five days, 2024-01-3011.00 / 9.00no limit
Sell 100,000 on 2008-04-23: stamp duty + transfer fee51.00302.55
Sell 100,000 on 2023-08-2551.00101.00

Use

pip install marina-rules      # self-contained: the dataset ships inside the wheel, byte-pinned

or take the JSON / SQLite dump attached to each GitHub Release — same bytes, same digest

import marina_rules as mr

mr.rule_at("stamp_duty_sell", "2023-08-28") # 0.0005 mr.rule_at("price_limit_pct", "2020-08-23", "chinext", "XSHE") # 0.10 mr.limit_price(10.00, "chinext", "2021-03-01", "XSHE") # (12.0, 8.0) — exchange rounding mr.limit_price(10.00, "ipo_first5_main", "2024-01-30", "XSHG+XSHE") # None — unlimited band mr.rule_at("stamp_duty_sell", "2005-01-01") # KeyError — no defaults, ever mr.citation() # 'rules: marina-rules@ sha256:<16 hex>'

Pre-flight a whole backtest window before running it:

mr.coverage("XSHE", "chinext", ["price_limit_pct"], "2019-01-01", "2026-10-19")

{'status': 'complete', 'gaps': [], 'conflicts': [], 'verification': 'verified',

'required_context': ['board', 'st_status', 'listing_day_index'], 'excludes': [...], ...}

Dates are ISO YYYY-MM-DD strings or date / datetime objects (a timestamp such as 2020-08-23 09:30:00 counts as its day). Any other spelling — 20200823, 2020/8/23, an integer — raises ValueError and names the ISO form. It is refused rather than parsed because record intervals are compared as ISO text: read as given, 20200102 would select the rule of a later period.

python -m marina_rules.diff <old> <new>     # in a clone: what changed, and what must be re-run; git tags or data directories
Find out what can be asked

A rule is answered only under the name it is recorded with, for a scope that exists. Look the names up instead of guessing them — from Python or from the command line (marina-rules and python -m marina_rules are the same program):

mr.scopes()                          # scope → description, and the context it requires ("hk" / "us" for those registries)

mr.rules_for("cffex_if", "CCFX") # {'margin_ratio': [[from, to], …], 'price_limit_pct_of_prev_settlement': […], …} mr.statutory_fee_floor(86420.00, "sell", "2023-08-28", "XSHG") # 44.0742 — stamp duty + transfer fee of one fill mr.statutory_fee_components(86420.00, "sell", "2023-08-28", "XSHG") # the same, per rule, with record ids mr.skill_text() # the usage notes (SKILL.md) shipped inside the package

marina-rules                                   # lists the subcommands

marina-rules scopes # add hk or us for those registries marina-rules rules cffex_if CCFX # rule names of one scope, first / last date (--intervals for all) marina-rules query price_limit_pct 2024-06-14 st_main XSHE --context board=main_board,st_status=true marina-rules fees 86420 sell 2023-08-28 XSHG # components, record ids and their sum marina-rules skill # the usage notes

When a lookup finds nothing, the refusal says what does exist: a KeyError message names the rules the scope has (or the intervals the rule has), and a decision from resolve() carries the same as alternatives (scope_rules, similar_rules, rule_intervals, similar_scopes). Names only, never a value — a similar name is a different rule (price_limit_pct is a fraction of the previous close; futures scopes carry price_limit_pct_of_prev_settlement), so read its definition and ask again. tick_size falls back to the stock family for mainland securities scopes only: a futures, Hong Kong or US scope asked for tick_size is refused.

coverage() answers "can Marina serve every (rule, day) in this window for this scope?" — complete, partial (with the exact gaps), or unsupported. It also tells you what you must already know about each security to select the scope legitimately (required_context): Marina holds rules, never a security's ST or listing history, and it will not guess them for you. Gaps carry known_gap_ids when they match data/cn/known_gaps.yaml (Hong Kong: data/hk/known_gaps.yaml; US: data/us/known_gaps.yaml) — the list of things Marina knows it does not cover (pre-2006 sessions and convertibles, the 2013 T+0 switch for bond/money/gold ETFs…), each with a reason and a status, so "unsupported" can be cited rather than worked around. Agents: read SKILL.md.

The data is plain YAML under data/. You do not need the Python package; read the files from any language.

Ask from an AI assistant: the MCP server

The same questions can be put to the dataset by an AI assistant through the Model Context Protocol, without writing code. The server runs locally over stdio.

pip install "marina-rules[mcp]"   # adds the MCP Python SDK; the server needs Python 3.10+, the rest of the package 3.9+

marina-rules-mcp # the same server: marina-rules mcp, python -m marina_rules.mcp_server

Add it to the MCP client's configuration (most clients read this mcpServers shape; where the file lives differs per client). If the client does not start in the environment where the package is installed, give the full path to marina-rules-mcp.

{

"mcpServers": { "marina-rules": {"command": "marina-rules-mcp"} } }

toolanswers
resolveone rule on one trading day for one scope: the decision of resolve(), acted on only when status is DETERMINED
limit_pricelimit-up / limit-down price from the previous close; unlimited: true when no daily limit applied
statutory_feesstamp duty and transfer fee of one A-share stock fill, per component and summed (commission not included)
coveragewhether every (rule, day) of a backtest window can be answered for a scope, with the gaps
list_scopesthe scopes of cn, hk or us and the context each requires
list_rulesthe rule names a scope holds, with their first and last dates
check_fillsthe marina-check checks on up to 500 fills passed inline as JSON (not a file path)
citationthe citation line and version of the dataset

Every answer carries citation. Arguments the library refuses (a date not written YYYY-MM-DD, an unknown side) and questions with no record in force come back as tool errors whose text says what to change or what is missing; no value is filled in. The usage notes (SKILL.md) are offered as the resource marina-rules://skill.

What it does not do: it is read-only and deterministic, uses no network, and reads no file but the dataset shipped in the package. Like the package, it holds rules only — no prices, ST or suspension lists, constituents or trading calendar; a security's board, ST status and listing day are the caller's to supply.

<!-- mcp-name:

只显示了开头部分;其余内容请在仓库中阅读