mangrove-kb — Open-source signals and indicators

mangrove-kb is the MIT-licensed Python package that backs everything in the Mangrove ecosystem. It contains the canonical implementations of all 233 trading signals and 99 technical indicators, plus the knowledge-base content as embedded markdown. If you do not need the hosted platform, you can use this library standalone. Compute indicators, evaluate signals on your own DataFrames, ship it in your own pipeline. No API key, no network call.

Install

pip install mangrove-kb
Requires Python 3.10+. Tested on 3.10, 3.11, 3.12.

What’s inside

  • 233 trading signals decorated with @RuleRegistry.register("name"). 112 TRIGGER, 121 FILTER. Categories: Momentum (42), Trend (88), Volume (33), Volatility (20), Patterns (40), On-Chain (10).
  • 99 technical indicator classes including 27 candlestick pattern indicators.
  • 11 trading-education documents covering market foundations through quantitative analysis.
Browse the full signal list in the Signal Catalog and indicator concepts in the Knowledge Base.

Hello world — evaluate a signal

from mangrove_kb import RuleRegistry, sample_ohlcv

# Self-contained sample data — no file or download needed.
# Bring your own with: df = pd.read_csv("your_ohlcv.csv")  # columns: Open, High, Low, Close, Volume
df = sample_ohlcv()

fired = RuleRegistry.evaluate(
    {"name": "rsi_oversold", "params": {"window": 14, "threshold": 30}},
    df,
)
# fired -> True if signal triggered on the latest bar

Hello world — compute an indicator

from mangrove_kb.indicators import RSI

rsi_series = RSI.compute(
    {"close": df["Close"]},
    {"window": 14},
)["rsi"]

Discover signals at runtime

from mangrove_kb import RuleRegistry

# All registered signals
for name in RuleRegistry.list_signals():
    meta = RuleRegistry.get_metadata(name)
    print(name, meta["signal_type"], meta["category"])
Each signal carries its TRIGGER/FILTER classification, required OHLCV columns, and parameter schema (with Range and Default per parameter), parsed from the function’s docstring at import time. The docstring is the single source of truth.

Working with indicator classes

Every indicator follows a consistent shape:
from mangrove_kb.indicators import MACD

result = MACD.compute(
    inputs={"close": df["Close"]},
    params={"window_fast": 12, "window_slow": 26, "window_sign": 9},
)
# result is a dict of pd.Series. For MACD: {"macd": ..., "signal": ..., "histogram": ...}
Inputs follow the convention {"close": series} or {"high": ..., "low": ..., "close": ...} depending on what the indicator needs. Parameter names follow the standardized window convention (no lookback/period/length).

When to use this vs. the platform

  • Use mangrove-kb when you want pure compute, full control, and zero network. Great for research notebooks, custom backtest frameworks, embedding in trading bots.
  • Use mangroveai when you want managed strategies, hosted backtests, the AI copilot, multi-user features.
  • Use the KB server when an agent needs signal/indicator metadata and computation through MCP.

Source

Contributions welcome. Add a signal by writing a function with the docstring contract documented in the repo’s signal architecture guide.