Signals API

The Signals API provides endpoints for discovering, validating, and evaluating trading signals. MangroveAI includes 136 active signals (66 TRIGGER, 70 FILTER) organized by category.

Signal Classification

  • TRIGGER (66 signals): Event-based signals that fire when specific conditions occur (crossovers, breakouts, pattern completions)
  • FILTER (70 signals): State-based signals describing ongoing market conditions (price above SMA, RSI in range)
Entry conditions must include exactly one TRIGGER and exactly one FILTER.

Base URL

http://localhost:5001/api/v1/signals

Endpoints

List All Signals

GET /api/v1/signals Query Parameters:
  • limit (optional, int, default=50): Maximum number of signals (1-100)
  • offset (optional, int, default=0): Pagination offset
curl -X GET "http://localhost:5001/api/v1/signals?limit=10&offset=0"
Response:
{
  "signals": [
    {
      "name": "rsi_oversold",
      "category": "momentum",
      "metadata": {
        "rule_name": "rsi_oversold",
        "description": "RSI is below threshold (oversold condition)",
        "requires": ["Close"],
        "params": {
          "window": {"type": "int", "min": 2, "max": 100, "default": 14},
          "threshold": {"type": "float", "min": 0.0, "max": 50.0, "optional": true, "default": 30.0}
        }
      }
    }
  ],
  "total": 136,
  "limit": 10,
  "offset": 0
}

Get Signal Details

GET /api/v1/signals/{signal_name}
curl -X GET http://localhost:5001/api/v1/signals/rsi_oversold

Search Signals

POST /api/v1/signals/search Search for signals by name, parameters, or keywords.
curl -X POST http://localhost:5001/api/v1/signals/search \
  -H "Content-Type: application/json" \
  -d '{
    "query": "moving average",
    "search_type": "keywords",
    "limit": 20
  }'
Search types: "name", "params", "keywords"

Match Signals (Semantic)

POST /api/v1/signals/match Intent-aware semantic signal matching using natural language descriptions.
curl -X POST http://localhost:5001/api/v1/signals/match \
  -H "Content-Type: application/json" \
  -d '{
    "user_description": "I want to buy when RSI is low and showing oversold conditions",
    "num_results": 3,
    "match_type": "entry"
  }'
Response:
{
  "matches": [
    {
      "signal_name": "rsi_oversold",
      "score": 0.92,
      "match_method": "semantic",
      "category": "momentum",
      "signal_type": "FILTER",
      "description": "RSI is below threshold (oversold condition)",
      "reasoning": "Matches intent for oversold RSI conditions"
    }
  ]
}

Evaluate Signal

POST /api/v1/signals/{signal_name}/evaluate Evaluate a signal against provided market data. Returns a boolean result.
curl -X POST http://localhost:5001/api/v1/signals/is_above_sma/evaluate \
  -H "Content-Type: application/json" \
  -d '{
    "market_data": [
      {"Close": 100}, {"Close": 102}, {"Close": 101},
      {"Close": 103}, {"Close": 105}, {"Close": 104}
    ],
    "parameters": {"window": 2}
  }'

Evaluate Multiple Signals (Multi-Timeframe)

POST /api/v1/signals/evaluate-multiple-series Evaluate chart data for a date range with multiple signals across different timeframes.
curl -X POST http://localhost:5001/api/v1/signals/evaluate-multiple-series \
  -H "Content-Type: application/json" \
  -d '{
    "symbol": "BTC",
    "chart_timeframe": "1h",
    "start_date": "2025-01-01T00:00:00Z",
    "end_date": "2025-01-07T00:00:00Z",
    "signals": [
      {"name": "rsi_overbought", "timeframe": "1h", "params": {"window": 14, "threshold": 70}},
      {"name": "is_above_sma", "timeframe": "4h", "params": {"window": 50}}
    ]
  }'

Validate Signal Parameters

POST /api/v1/signals/{signal_name}/validate-params Validate parameters for a signal without evaluating it.
curl -X POST http://localhost:5001/api/v1/signals/is_above_sma/validate-params \
  -H "Content-Type: application/json" \
  -d '{"parameters": {"window": 20}}'

Signal Categories

Momentum (26 signals)

RSI, Stochastic, Williams %R, TSI, and related oscillators. Examples: rsi_oversold, rsi_overbought, stoch_oversold, williams_r_oversold

Trend (38 signals)

SMA, EMA, MACD, ADX, and moving average crossovers. Examples: sma_cross_up, sma_cross_down, ema_cross_up, macd_bullish_cross, adx_strong_trend

Volume (22 signals)

OBV, MFI, CMF, VWAP, and volume-based indicators. Examples: obv_bullish, mfi_oversold, cmf_bullish, vwap_above

Volatility (10 signals)

Bollinger Bands, ATR, Keltner Channel, and volatility measures. Examples: bb_upper_breakout, bb_lower_breakout, atr_high_volatility, kc_upper_breakout

Patterns (40 signals)

Candlestick patterns and multi-bar pattern recognition. Examples: bullish_engulfing, bearish_engulfing, hammer, doji, morning_star, evening_star

Signal Metadata Structure

Each signal includes:
FieldDescription
rule_nameSignal function name
descriptionHuman-readable description
requiresDataFrame columns needed (e.g., ["Close", "Volume"])
paramsParameter definitions with type, min, max, default
type"TRIGGER" or "FILTER"