Back to Ruflo

ruflo-market-data

plugins/ruflo-market-data/README.md

3.6.303.9 KB
Original Source

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

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

Agents

AgentModelRole
data-engineersonnetIngest market feeds, normalize OHLCV, vectorize candlestick patterns, HNSW-indexed pattern matching

Skills

SkillUsageDescription
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)

bash
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

FieldNormalization
OpenRelative to previous close: (open - prev_close) / prev_close
HighRelative to open: (high - open) / open
LowRelative to open: (low - open) / open
CloseRelative to open: (close - open) / open
VolumeZ-score: (vol - mean_vol) / std_vol

Pattern Library

PatternTypeCandlesReliability
DojiReversal1Medium
HammerReversal1Medium-High
EngulfingReversal2High
Morning/Evening StarReversal3High
Three White SoldiersContinuation3High
Head & ShouldersReversal5-7Very High
Double Top/BottomReversalVariableHigh

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
bash plugins/ruflo-market-data/scripts/smoke.sh
# Expected: "11 passed, 0 failed"

Architecture Decisions

  • 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