Mangrove SIEVE API
Mangrove SIEVE (Strategy Indicator Embeddings with Value Estimation) is a learned classifier trained on millions of historical backtests. It produces two probability heads for any candidate strategy:- Binary head —
P(no_trades)vsP(trades). Use this to filter out strategies that will never fire entries given their signal mix and parameter ranges. - 4-class head — softmax over
losing,no_trades,wash,winning. Use this to rank strategies by predicted outcome before spending compute on a full backtest.
Endpoint
| Method | Endpoint | Description |
|---|---|---|
POST | /api/v1/oracle/sieve/score | Score 1–99 strategies through both heads |
Score Strategies
POST /api/v1/oracle/sieve/score
The request accepts exactly one of two input shapes:
| Field | Description | When to use |
|---|---|---|
strategies | MangroveAI-shaped Strategy objects (entry/exit arrays of signals + execution config) | When you’re constructing strategies in code and want a friendly shape |
runs | Raw run dicts (entry_json / exit_json strings, asset, exec_config) | When you’re scoring rows already in the Mangrove sweep corpus |
Example: Score a Strategy object
Example: Score raw runs
Use this shape when you’ve already extracted entry_json / exit_json strings from the sweep corpus.
Response
| Field | Type | Description |
|---|---|---|
predictions[].binary.p_no_trades | float | Probability the strategy will not fire any entries on real data |
predictions[].binary.p_trades | float | 1 − p_no_trades |
predictions[].four_class.losing | float | Probability the strategy ends with a net loss |
predictions[].four_class.no_trades | float | Probability the strategy fires no trades |
predictions[].four_class.wash | float | Probability the strategy ends roughly break-even |
predictions[].four_class.winning | float | Probability the strategy ends with a net profit |
count | int | Number of items scored in this request |
model_version | string | Content hash of the bundled model artifacts. Format: mangrove-sieve:<12-char-hash>. Changes when the model is retrained. |
code_version | string | Full Oracle + MangroveAI + KB + Roots provenance string. Format: oracle:<ref> ai:<ref> kb:<ref> roots:<ref> |
1.0 within float32 tolerance.
Schema details
SignalSpec (inside strategies[].entry / strategies[].exit)
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | yes | Mangrove Knowledge Base signal name (e.g. macd_bullish_cross, rsi_oversold) |
signal_type | string | yes | TRIGGER or FILTER |
timeframe | string | no | e.g. "1h", "4h", "1d". Omit for default |
params | object | no | Signal parameters; shape varies per signal — see Signals reference |
StrategyInput
| Field | Type | Required |
|---|---|---|
asset | string | yes — BTC, ETH, SOL, … |
entry | SignalSpec[] | yes — at least one TRIGGER expected |
exit | SignalSpec[] | yes (may be empty) |
execution_config.reward_factor | float | no — defaults to 2.0 |
execution_config.max_risk_per_trade | float | no — defaults to 0.01 |
RunInput
| Field | Type | Required | Notes |
|---|---|---|---|
entry_json | string | yes | JSON-encoded array of signal dicts |
exit_json | string | yes | JSON-encoded array of signal dicts (use "[]" if none) |
asset | string | yes | |
exec_config.reward_factor | float | no | defaults to 2.0 |
exec_config.max_risk_per_trade | float | no | defaults to 0.01 |
Error responses
| Status | When | Detail |
|---|---|---|
400 | Both strategies and runs provided, or neither, or empty list | "Provide exactly one of \strategies` or `runs` (and not an empty list)“` |
400 | Malformed payload (missing required keys, wrong types) | "Invalid strategies payload: ..." / "Invalid runs payload: ..." |
413 | More than 99 items in a single request | "Max 99 items per request, got <n>" |
503 | Model artifacts missing or load failed on the server | "Mangrove SIEVE predictor unavailable" |
Provenance + reproducibility
Every response carriesmodel_version (a content hash of the bundled model artifacts: binary head, 4-class head, vocabulary) and code_version (the full Oracle dependency stack). Together they let you reproduce a prediction later — log them next to any decision you make based on a SIEVE score.
When the model is retrained, model_version changes; the old probabilities remain a faithful record of what the prior model said. If you cache SIEVE scores in your own system, key the cache on (input_hash, model_version).
Rate limits + tiers
SIEVE calls are gated by your subscription tier. See your tier’ssieve_predictions_monthly allowance in the subscription docs. Per-request cap (99 items) is independent of tier.