Back

#position-sizing

2 APIs with this tag

Risk of Ruin API

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.

api.oanor.com/riskofruin-api

Trading Risk API

Trading risk-management maths as an API, computed locally and deterministically — the position-sizing and money-management numbers every disciplined trader runs before a trade. The position-size endpoint is instrument-agnostic: from an account balance, the percentage of it you are willing to risk, an entry and a stop-loss it returns the position size in units (shares, contracts, lots or coins), the cash at risk and, with a target, the potential reward and the risk-reward ratio — risk 1 % of a $10,000 account on a 50-pip stop and you trade 0.2 lots, losing exactly $100 if the stop hits. The pip-value endpoint gives the forex pip value for a lot or unit size in the quote currency, with a quote-to-account rate for non-account pairs — a standard lot at a 0.0001 pip is 10 units of the quote currency. The kelly endpoint computes the Kelly criterion optimal bet fraction f* = W − (1−W)/R from a win rate and the win/loss payoff ratio (or average win and loss), plus the half-Kelly many traders prefer and the per-unit expectancy, flagging whether the edge is positive at all. Everything is computed locally and deterministically, so it is instant and private. Ideal for trading-journal, broker, prop-firm, backtesting and fintech app developers, position-sizing and risk-management tools, and trading education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 compute endpoints. This is risk and position-sizing maths; for FX rate conversion use a currency API and for option pricing a Black-Scholes API.

api.oanor.com/trading-api