{"uid":"cap_ibeyPptWylABXRpg395cH","slug":"mangrove-strategy-ensure-48ea6575","name":"Mangrove Strategy Ensure","description":"Developer references for Mangrove Agent, API contracts, MCP and AI integrations.","url":"https://api.mangrovedeveloper.ai/api/v1/strategies/ensure?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"exit":{"type":"array","items":{"type":"object"}},"name":{"type":"string"},"asset":{"type":"string"},"entry":{"type":"array","items":{"type":"object"}},"rules":{"type":"array","items":{"type":"object"}},"org_id":{"type":"string"},"status":{"type":"string"},"timeframe":{"type":"string"},"exit_short":{"type":"array","items":{"type":"object"}},"session_id":{"type":"string"},"description":{"type":"string"},"entry_short":{"type":"array","items":{"type":"object"}},"quote_token":{"type":"string"},"reward_factor":{"type":"number"},"strategy_type":{"type":"string"},"execution_state":{"type":"object"},"execution_config":{"type":"object","properties":{"atr_period":{},"stop_model":{},"cooldown_bars":{},"max_hold_bars":{},"reward_factor":{},"cooldown_model":{},"rebalance_band":{},"taker_fee_rate":{},"atr_long_weight":{},"circuit_breaker":{},"cooldown_config":{},"initial_balance":{},"volatility_mode":{},"atr_short_weight":{},"max_trade_amount":{},"min_balance_days":{},"min_cash_balance":{},"min_trade_amount":{},"min_asset_balance":{},"target_volatility":{},"volatility_window":{},"atr_cap_multiplier":{},"max_drawdown_limit":{},"max_open_positions":{},"max_risk_per_trade":{},"max_trades_per_day":{},"position_size_calc":{},"stop_gap_allowance":{},"max_hold_time_hours":{},"max_units_per_trade":{},"target_asset_weight":{},"daily_momentum_limit":{},"profit_threshold_pct":{},"volatility_tolerance":{},"atr_volatility_factor":{},"min_balance_threshold":{},"min_stop_distance_pct":{},"weekly_momentum_limit":{},"exit_on_loss_after_bars":{},"max_drawdown_halt_limit":{},"exit_on_profit_after_bars":{},"enable_volatility_adjustment":{}}},"market_data_venue":{"type":"string"},"parent_strategy_id":{"type":"string"},"position_size_calc":{"enum":["v1","v2","v3"],"type":"string"}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_R15UtIpPP325izT-SflJ3","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Creates or updates a named trading strategy definition with entry/exit rules, execution config, and risk parameters on the Mangrove platform.","exampleAgentPrompt":"Ensure a Mangrove trading strategy called 'BTC-Momentum-v1' for asset BTC with USDC as the quote token, strategy type 'momentum', using v2 position sizing, an ATR period of 14, max drawdown limit of 0.15, and max trades per day of 5 — with the entry rules set to buy on 20-day breakout and exit on trailing stop.","exampleUseCases":[{"title":"Configure BTC trend-following strategy","prompt":"Set up a Mangrove strategy named 'BTC-Trend' for BTC/USDC using strategy type 'trend_following', v2 position sizing, ATR period of 14, max drawdown halt limit of 0.20, and max 3 open positions — entry on 50-day moving average crossover and exit when price drops 2% below the ATR stop."},{"title":"Rebalance portfolio strategy with volatility targeting","prompt":"Ensure a Mangrove rebalancing strategy called 'ETH-Rebalance-Q2' for ETH with USDC quote token, strategy type 'rebalance', target asset weight of 0.6, rebalance band of 0.05, volatility mode enabled, target volatility of 0.25, and a volatility window of 20 — make sure it's active."},{"title":"High-frequency cooldown-limited strategy setup","prompt":"Create or update a Mangrove strategy named 'SOL-Scalper' for SOL/USDC, type 'scalping', using v3 position sizing, cooldown bars of 3, max hold bars of 10, taker fee rate of 0.001, min trade amount of 50, max trade amount of 500, and a circuit breaker enabled — set status to active."}],"resultDescription":"Returns the persisted strategy object including its assigned strategy ID, current status, execution state, and all configured fields such as entry/exit rules, execution config parameters, position sizing method, and metadata like org_id and session_id.","failureModes":["Invalid asset or quote token symbol returns a validation error","Missing required fields like name or strategy_type may return 400 Bad Request","Conflicting parent_strategy_id or org_id returns a not-found or authorization error","Malformed entry/exit rule objects return schema validation errors","Payment not included or insufficient USDC balance returns 402 Payment Required"],"whenToPreferThis":"Use this endpoint when you need to idempotently create or update a fully-specified algorithmic trading strategy on Mangrove, including its entry/exit logic, risk parameters, and execution configuration. Prefer this over a plain create when you want upsert semantics — the strategy will be created if it doesn't exist or updated if it does. This is the right endpoint when configuring automated crypto trading agents that need reproducible, version-controlled strategy definitions.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-04T06:36:12.319Z","isFirstParty":false,"canonicalSlug":"mangrove-strategy-ensure-48ea6575"}