{"openapi":"3.1.0","info":{"title":"Risk of Ruin API","version":"1.0.0","description":"Live risk-of-ruin and drawdown-survival analytics that traders run to size risk so a losing streak cannot wipe them out, computed on demand from the edge you pass in — no key, no cache, nothing stored. The ruin endpoint returns the probability of ever losing your capital given a win rate, a reward-to-risk payoff and the risk taken per trade, solved analytically from the gambler's-ruin equation rather than simulated — it also reports the expectancy in R, the capital units at risk and the single-unit ruin root behind the answer. The drawdown endpoint returns the probability of ever hitting each of several drawdown levels and the gain needed to recover from them. The recovery endpoint returns the loss-and-gain asymmetry — the percent gain required to climb back from any drawdown, the reason a 50 percent loss needs a 100 percent gain — and, if you pass net profit and max drawdown, the recovery factor. This is an analytic risk engine, fundamentally different from Monte-Carlo simulators and price-series drawdown feeds: it turns a win rate, payoff and risk fraction into the closed-form math of survival, instantly. Win rate accepts a fraction or a percentage; payoff is reward-to-risk; negative expectancy makes ruin certain. Computed locally and deterministically, so it is instant and private. Ideal for position sizing, money-management rules, prop-firm risk limits and trading dashboards. Live, nothing stored. 3 compute endpoints. For a full Monte-Carlo outcome distribution use a strategy-simulator API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/riskofruin-api","description":"oanor gateway"}],"tags":[{"name":"Ruin"},{"name":"Meta"}],"components":{"securitySchemes":{"oanorKey":{"type":"apiKey","in":"header","name":"x-oanor-key","description":"Get your key at https://www.oanor.com/developer/keys"}}},"security":[{"oanorKey":[]}],"paths":{"/v1/drawdown":{"get":{"operationId":"get_v1_drawdown","tags":["Ruin"],"summary":"Probability of hitting drawdown levels + recovery","description":"","parameters":[{"name":"win_rate","in":"query","required":true,"description":"Win rate (fraction or percentage)","schema":{"type":"string"},"example":"55"},{"name":"payoff","in":"query","required":false,"description":"Reward-to-risk payoff (default 1)","schema":{"type":"string"},"example":"1.5"},{"name":"risk_per_trade","in":"query","required":false,"description":"Risk per trade (default 0.02)","schema":{"type":"string"},"example":"0.02"},{"name":"levels","in":"query","required":false,"description":"Drawdown levels (percent), comma-separated","schema":{"type":"string"},"example":"10,20,50"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Probability of ever reaching each drawdown level = single_unit_ruin ^ (level / risk_per_trade). recovery_gain = the gain needed to climb back from that drawdown.","payoff":1.5,"source":"RISK-OF-RUIN","drawdowns":[{"probability":0.08414065,"drawdown_pct":10,"probability_pct":8.414065,"recovery_gain_pct":11.1111},{"probability":0.00707965,"drawdown_pct":20,"probability_pct":0.707965,"recovery_gain_pct":25},{"probability":4.22e-6,"drawdown_pct":50,"probability_pct":0.000422,"recovery_gain_pct":100}],"expectancy_r":0.375,"win_rate_pct":55,"single_unit_ruin":0.60953854,"risk_per_trade_pct":2},"meta":{"timestamp":"2026-06-11T07:49:12.823Z","request_id":"d3d03719-3c94-47b7-82d8-71366044e5ee"},"status":"ok","message":"Drawdown risk computed","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/recovery":{"get":{"operationId":"get_v1_recovery","tags":["Ruin"],"summary":"Drawdown-to-recovery asymmetry + recovery factor","description":"","parameters":[{"name":"drawdowns","in":"query","required":false,"description":"Drawdowns (percent), comma-separated","schema":{"type":"string"},"example":"10,20,50"},{"name":"net_profit","in":"query","required":false,"description":"Net profit (for recovery factor)","schema":{"type":"string"},"example":"5000"},{"name":"max_drawdown","in":"query","required":false,"description":"Max drawdown (for recovery factor)","schema":{"type":"string"},"example":"1200"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"To recover from a drawdown d, you need a gain of d/(1-d). Losses and gains are asymmetric: -50% needs +100%.","source":"RISK-OF-RUIN","net_profit":5000,"recoveries":[{"drawdown_pct":10,"recovery_gain_pct":11.1111},{"drawdown_pct":20,"recovery_gain_pct":25},{"drawdown_pct":50,"recovery_gain_pct":100}],"max_drawdown":1200,"recovery_factor":4.166667,"recovery_factor_note":"Recovery factor = net profit / max drawdown; higher is better (>3 is strong)."},"meta":{"timestamp":"2026-06-11T07:49:12.930Z","request_id":"8559852f-6ff8-4d73-a640-6caaa656679d"},"status":"ok","message":"Recovery computed","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/ruin":{"get":{"operationId":"get_v1_ruin","tags":["Ruin"],"summary":"Risk of ruin from your edge","description":"","parameters":[{"name":"win_rate","in":"query","required":true,"description":"Win rate (fraction or percentage)","schema":{"type":"string"},"example":"55"},{"name":"payoff","in":"query","required":false,"description":"Reward-to-risk payoff (default 1)","schema":{"type":"string"},"example":"1.5"},{"name":"risk_per_trade","in":"query","required":false,"description":"Risk per trade (fraction or percent, default 0.02)","schema":{"type":"string"},"example":"0.02"},{"name":"ruin_level","in":"query","required":false,"description":"Fraction of capital to lose to be ruined (default 1)","schema":{"type":"string"},"example":"1"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"edge":"positive","note":"Risk of ruin solved from the gambler's-ruin equation p*r^(1+b) - r + q = 0; capital_units = ruin_level / risk_per_trade. Negative expectancy => ruin is certain.","payoff":1.5,"source":"RISK-OF-RUIN","expectancy_r":0.375,"risk_of_ruin":0,"win_rate_pct":55,"capital_units":50,"ruin_level_pct":100,"risk_of_ruin_pct":0,"single_unit_ruin":0.60953854,"risk_per_trade_pct":2},"meta":{"timestamp":"2026-06-11T07:49:13.009Z","request_id":"ad7aa4df-2927-45cb-8495-c19ddf5c880e"},"status":"ok","message":"Risk of ruin computed","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/meta":{"get":{"operationId":"get_v1_meta","tags":["Meta"],"summary":"Spec","description":"","parameters":[],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"win_rate accepts 0-1 or a percentage; payoff is reward-to-risk (default 1); risk_per_trade is a fraction or percent (default 0.02). Negative expectancy makes ruin certain.","source":"Computed in-process from caller-supplied edge parameters (no upstream)","service":"riskofruin-api","endpoints":{"GET /v1/meta":"This document.","GET /v1/ruin":"Risk of ruin from your edge (win_rate=55&payoff=1.5&risk_per_trade=0.02).","GET /v1/drawdown":"Probability of hitting drawdown levels + recovery gain (win_rate=55&payoff=1.5&risk_per_trade=0.02&levels=10,20,50).","GET /v1/recovery":"Drawdown-to-recovery asymmetry + recovery factor (drawdowns=10,20,50&net_profit=5000&max_drawdown=1200)."},"description":"Live risk-of-ruin and drawdown-survival analytics computed on demand from your edge. The ruin endpoint returns the probability of ever losing your capital given a win rate, reward-to-risk payoff and risk per trade, solved analytically from the gambler's-ruin equation; the drawdown endpoint returns the probability of ever hitting given drawdown levels and the gain needed to recover; the recovery endpoint returns the loss/gain asymmetry and the recovery factor. An analytic risk engine, distinct from Monte-Carlo simulators and price-series drawdown feeds. Computed locally, nothing stored.","upstream_status":"ok"},"meta":{"timestamp":"2026-06-11T07:49:13.095Z","request_id":"60bd53d8-4eb5-4792-9be1-85f0c26f184b"},"status":"ok","message":"Meta","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}}},"x-oanor-pricing":[{"slug":"free","name":"Free","price_cents_month":0,"monthly_call_quota":4500,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":750,"monthly_call_quota":90500,"rps_limit":6,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":2140,"monthly_call_quota":465000,"rps_limit":18,"hard_limit":true},{"slug":"business","name":"Business","price_cents_month":4850,"monthly_call_quota":2870000,"rps_limit":45,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/riskofruin-api"}