ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 ruvnet

ruflo-market-data

市场数据摄取——行情源规范化、OHLCV 向量化,以及基于 HNSW 索引的模式匹配。

ruvnet@ruvnet

ruvnet/ruflo/tree/main/plugins/ruflo-market-data

已翻译

关于这个 mod

ruflo-market-data

市场数据摄取——行情源规范化、OHLCV 向量化,以及基于 HNSW 索引的模式匹配。

概览

从 REST API 和 WebSocket feed 摄取市场数据,将其规范化为缩放一致的 OHLCV 向量,并将蜡烛图形态向量化,用于 HNSW 相似度搜索。通过可靠性评分检测单根蜡烛图(doji、hammer)和多根蜡烛图(engulfing、morning star、head & shoulders)形态。

安装

claude --plugin-dir plugins/ruflo-market-data

Agents

| Agent | Model | 作用 | |-------|-------|------| | data-engineer | sonnet | 摄取行情源、规范化 OHLCV、将蜡烛图形态向量化,并进行基于 HNSW 索引的模式匹配 |

Skills

| Skill | 用法 | 描述 | |-------|------|------| | market-ingest | /market-ingest <symbol> [--source api] | 摄取并规范化市场数据,生成带 HNSW 索引的 OHLCV 向量 | | market-pattern | /market-pattern <symbol> [--period 1D] | 从摄取的数据中检测并分类蜡烛图形态 |

Commands (5 subcommands)

market ingest <symbol> [--period 1D]    # Ingest and normalize OHLCV data
market patterns <symbol>                 # Detect candlestick patterns
market search <pattern-name>             # Search historical pattern occurrences
market history <symbol>                  # Show ingestion history and data coverage
market compare <sym1> <sym2>             # Compare pattern profiles between symbols

OHLCV 规范化

| 字段 | 规范化方式 | |------|------------| | Open | 相对于前一收盘价:(open - prev_close) / prev_close | | High | 相对于开盘价:(high - open) / open | | Low | 相对于开盘价:(low - open) / open | | Close | 相对于开盘价:(close - open) / open | | Volume | Z-score:(vol - mean_vol) / std_vol |

形态库

| 形态 | 类型 | 蜡烛图数量 | 可靠性 | |------|------|------------|--------| | Doji | 反转 | 1 | 中等 | | Hammer | 反转 | 1 | 中高 | | Engulfing | 反转 | 2 | 高 | | Morning/Evening Star | 反转 | 3 | 高 | | Three White Soldiers | 延续 | 3 | 高 | | Head & Shoulders | 反转 | 5-7 | 极高 | | Double Top/Bottom | 反转 | 可变 | 高 |

每种形态都会编码为 64 维填充向量,用于 HNSW 索引。

兼容性

  • **CLI:**固定使用 @claude-flow/cli 的 v3.6 主版本和次版本。
  • **验证:**bash plugins/ruflo-market-data/scripts/smoke.sh 是契约。

命名空间协调

此插件拥有两个 AgentDB 命名空间(使用 kebab-case,并遵循 ruflo-agentdb ADR-0001 的「Namespace convention」约定):

  • market-data — 每个 symbol+date 对应的规范化 OHLCV 向量
  • market-patterns — 带可靠性评分的已检测蜡烛图形态

两者都通过命名空间路由的 memory_* 访问。保留命名空间(pattern、claude-memories、default)绝不能被覆盖。

*路由说明:这些技能的早期版本使用带命名空间参数的 agentdb_hierarchical- 和 agentdb_pattern-;这些工具族按层级/ReasoningBank 路由,并忽略命名空间字符串。ADR-0001 已修正这些技能,改用 memory_ 进行带命名空间的读写。

验证

bash plugins/ruflo-market-data/scripts/smoke.sh
# Expected: "11 passed, 0 failed"

架构决策

相关插件

  • ruflo-agentdb — 命名空间约定的所有者;定义 ADR-0001 修复违规所依据的路由规则
  • ruflo-neural-trader -- 将市场形态作为策略信号使用
  • ruflo-ruvector -- HNSW 形态相似度搜索的索引引擎
  • ruflo-observability -- 数据 feed 健康度和摄取延迟仪表板

许可证

MIT

作为 mod

此插件提供一个函数钩子 mod(ADR-445,hooks/register.ts)。它不发起网络调用、不生成进程,也不调用模型。

  • Guard(仅收紧,默认开启):拒绝向 market* 命名空间(memory_store、agentdb_pattern-store、agentdb_hierarchical-store、ruvllm_hnsw_add)写入包含密钥或 token 的内容,也拒绝带有查询字符串凭据或 user:pass@host 凭据的 feed URL。其他命名空间不受影响。拒绝时绝不会回显机密。
  • /market-mod:status、recent、tools(此插件连接了哪些工具)和 scan <text>(Guard 是否会拒绝该内容)。这些回答在本地完成。
  • 状态文件:.claude-flow/market-mod/status.json({version: 1, updatedMs, guard, calls, total, blocked, recent},仅包含计数器,从不记录工具输入),在 session 开始时以及每次调用此插件工具后写入。

选项(userConfig):guard(on)。

测试方式:claude plugin validate plugins/ruflo-market-data、claude plugin test plugins/ruflo-market-data、bash plugins/ruflo-market-data/scripts/smoke.sh。

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add ruvnet/ruflo
claude plugin install ruflo-market-data
原文 / README

ruflo-market-data

Market data ingestion -- feed normalization, OHLCV vectorization, and HNSW-indexed pattern matching.

Overview

Ingests market data from REST APIs and WebSocket feeds, normalizes to OHLCV vectors with consistent scaling, and vectorizes candlestick patterns for HNSW similarity search. Detects single-candle (doji, hammer) and multi-candle (engulfing, morning star, head & shoulders) formations with reliability scoring.

Installation

claude --plugin-dir plugins/ruflo-market-data

Agents

| Agent | Model | Role | |-------|-------|------| | data-engineer | sonnet | Ingest market feeds, normalize OHLCV, vectorize candlestick patterns, HNSW-indexed pattern matching |

Skills

| Skill | Usage | Description | |-------|-------|-------------| | market-ingest | /market-ingest <symbol> [--source api] | Ingest and normalize market data into OHLCV vectors with HNSW indexing | | market-pattern | /market-pattern <symbol> [--period 1D] | Detect and classify candlestick patterns from ingested data |

Commands (5 subcommands)

market ingest <symbol> [--period 1D]    # Ingest and normalize OHLCV data
market patterns <symbol>                 # Detect candlestick patterns
market search <pattern-name>             # Search historical pattern occurrences
market history <symbol>                  # Show ingestion history and data coverage
market compare <sym1> <sym2>             # Compare pattern profiles between symbols

OHLCV Normalization

| Field | Normalization | |-------|--------------| | Open | Relative to previous close: (open - prev_close) / prev_close | | High | Relative to open: (high - open) / open | | Low | Relative to open: (low - open) / open | | Close | Relative to open: (close - open) / open | | Volume | Z-score: (vol - mean_vol) / std_vol |

Pattern Library

| Pattern | Type | Candles | Reliability | |---------|------|---------|-------------| | Doji | Reversal | 1 | Medium | | Hammer | Reversal | 1 | Medium-High | | Engulfing | Reversal | 2 | High | | Morning/Evening Star | Reversal | 3 | High | | Three White Soldiers | Continuation | 3 | High | | Head & Shoulders | Reversal | 5-7 | Very High | | Double Top/Bottom | Reversal | Variable | High |

Each pattern is encoded as a 64-dimension padded vector for HNSW indexing.

Compatibility

  • CLI: pinned to @claude-flow/cli v3.6 major+minor.
  • Verification: bash plugins/ruflo-market-data/scripts/smoke.sh is the contract.

Namespace coordination

This plugin owns two AgentDB namespaces (kebab-case, follows the convention from ruflo-agentdb ADR-0001 §"Namespace convention"):

  • market-data — normalized OHLCV vectors per symbol+date
  • market-patterns — detected candlestick patterns with reliability scores

Both accessed via memory_* (namespace-routed). Reserved namespaces (pattern, claude-memories, default) MUST NOT be shadowed.

Routing note: Earlier versions of these skills used agentdb_hierarchical-* and agentdb_pattern-* with namespace arguments — those tool families route by tier/ReasoningBank and ignore namespace strings. ADR-0001 fixed the skills to use memory_* for namespaced reads/writes.

Verification

bash plugins/ruflo-market-data/scripts/smoke.sh
# Expected: "11 passed, 0 failed"

Architecture Decisions

Related Plugins

  • ruflo-agentdb — namespace convention owner; defines the routing rules ADR-0001 fixes violations of
  • ruflo-neural-trader -- Consumes market patterns as strategy signals
  • ruflo-ruvector -- HNSW indexing engine for pattern similarity search
  • ruflo-observability -- Data feed health and ingestion latency dashboards

License

MIT

As a mod

This plugin ships a function-hook mod (ADR-445, hooks/register.ts). It makes no network call, spawns no process and makes no model call.

  • Guard (tighten-only, on by default): Refuses writes to a market* namespace (memory_store, agentdb_pattern-store, agentdb_hierarchical-store, ruvllm_hnsw_add) that hold a key or token, or a feed URL with a credential in its query string or as user:pass@host. Other namespaces are untouched. A refusal never echoes the secret.
  • /market-mod: status, recent, tools (which of this plugin's tools are connected) and scan <text> (would the guard refuse it). Answered locally.
  • Status file: .claude-flow/market-mod/status.json ({version: 1, updatedMs, guard, calls, total, blocked, recent}, counters only, never tool input), written at session start and after every call to this plugin's tools.

Options (userConfig): guard (on).

Test it: claude plugin validate plugins/ruflo-market-data, claude plugin test plugins/ruflo-market-data, bash plugins/ruflo-market-data/scripts/smoke.sh.

更多类似作品