{"openapi":"3.1.0","info":{"title":"Portfolio Optimizer API","version":"1.0.0","description":"Live mean-variance (Markowitz) portfolio optimisation that quants and allocators run across a basket of assets, computed on demand from the price series you pass in — no key, no cache, nothing stored. The optimize endpoint returns the two cornerstone portfolios: the minimum-variance portfolio and the maximum-Sharpe (tangency) portfolio, each with its optimal weights, expected return, volatility and Sharpe ratio. The frontier endpoint traces the efficient frontier — a set of optimal risk/return points and the weights that achieve them — so you can plot the whole risk/return curve. The stats endpoint returns the per-asset annualised return and volatility plus the full correlation and covariance matrices, the raw material behind the optimisation. It exploits diversification: by combining assets with low or negative correlation the optimiser finds a portfolio whose volatility is lower than any single holding. Works for any basket — stocks, funds, ETFs, crypto, FX or commodities. This is a multi-asset allocation engine, fundamentally different from single-asset risk and CAPM tools: it answers how to weight several assets together, not how one behaves. Weights can be negative, representing a short leg, as in classic unconstrained Markowitz. Computed locally and deterministically, so it is instant and private. Ideal for robo-advisors, portfolio dashboards, asset-allocation research and back-tests. Rates are fractions (0.02 = 2%). Live, nothing stored. 3 compute endpoints. For single-asset Sharpe/drawdown use a risk-metrics API; for beta use a CAPM API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/portfoliooptimizer-api","description":"oanor gateway"}],"tags":[{"name":"Portfolio"},{"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/frontier":{"get":{"operationId":"get_v1_frontier","tags":["Portfolio"],"summary":"Efficient-frontier points and weights","description":"","parameters":[{"name":"assets","in":"query","required":true,"description":"Asset blocks name:series separated by ;","schema":{"type":"string"},"example":"stocks:100,103,101,106,104,109;bonds:50,49.5,50.5,49.8,50.6,49.9"},{"name":"points","in":"query","required":false,"description":"Number of frontier points (default 12)","schema":{"type":"string"},"example":"12"},{"name":"risk_free","in":"query","required":false,"description":"Annual risk-free rate (fraction)","schema":{"type":"string"},"example":"0.02"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"assets":["stocks","bonds"],"points":12,"source":"PORTFOLIO","frontier":[{"weights":{"bonds":0.672182,"stocks":0.327818},"volatility":0.024805,"sharpe_ratio":56.720021,"expected_return":1.426945},{"weights":{"bonds":0.672863,"stocks":0.327137},"volatility":0.024808,"sharpe_ratio":56.588707,"expected_return":1.423829},{"weights":{"bonds":0.6715,"stocks":0.3285},"volatility":0.024813,"sharpe_ratio":56.828468,"expected_return":1.430061},{"weights":{"bonds":0.673545,"stocks":0.326455},"volatility":0.02482,"sharpe_ratio":56.434696,"expected_return":1.420713},{"weights":{"bonds":0.670819,"stocks":0.329181},"volatility":0.02483,"sharpe_ratio":56.913958,"expected_return":1.433176},{"weights":{"bonds":0.674226,"stocks":0.325774},"volatility":0.024843,"sharpe_ratio":56.258245,"expected_return":1.417597},{"weights":{"bonds":0.670138,"stocks":0.329862},"volatility":0.024857,"sharpe_ratio":56.976483,"expected_return":1.436292},{"weights":{"bonds":0.669456,"stocks":0.330544},"volatility":0.024895,"sharpe_ratio":57.016122,"expected_return":1.439408},{"weights":{"bonds":0.668775,"stocks":0.331225},"volatility":0.024942,"sharpe_ratio":57.03303,"expected_return":1.442524},{"weights":{"bonds":0.668093,"stocks":0.331907},"volatility":0.024999,"sharpe_ratio":57.027446,"expected_return":1.44564},{"weights":{"bonds":0.667412,"stocks":0.332588},"volatility":0.025066,"sharpe_ratio":56.999681,"expected_return":1.448756},{"weights":{"bonds":0.66673,"stocks":0.33327},"volatility":0.025143,"sharpe_ratio":56.950121,"expected_return":1.451872}],"risk_free":0.02,"observations":5,"periods_per_year":252},"meta":{"timestamp":"2026-06-11T07:49:23.633Z","request_id":"8a81c750-1415-4c77-b91e-02a722d5e655"},"status":"ok","message":"Efficient frontier 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/optimize":{"get":{"operationId":"get_v1_optimize","tags":["Portfolio"],"summary":"Minimum-variance + maximum-Sharpe portfolios","description":"","parameters":[{"name":"assets","in":"query","required":true,"description":"Asset blocks name:series separated by ;","schema":{"type":"string"},"example":"stocks:100,103,101,106,104,109;bonds:50,49.5,50.5,49.8,50.6,49.9"},{"name":"risk_free","in":"query","required":false,"description":"Annual risk-free rate (fraction)","schema":{"type":"string"},"example":"0.02"},{"name":"as","in":"query","required":false,"description":"prices (default) or returns","schema":{"type":"string"},"example":"prices"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Weights are unconstrained Markowitz (may be negative = short). Returns/volatility annualised.","assets":["stocks","bonds"],"source":"PORTFOLIO","risk_free":0.02,"observations":5,"maximum_sharpe":{"weights":{"bonds":0.668604,"stocks":0.331396},"volatility":0.024955,"sharpe_ratio":57.033732,"expected_return":1.443303},"minimum_variance":{"weights":{"bonds":0.672352,"stocks":0.327648},"volatility":0.024805,"sharpe_ratio":56.689331,"expected_return":1.426166},"periods_per_year":252},"meta":{"timestamp":"2026-06-11T07:49:23.731Z","request_id":"364c8544-2be7-415d-a331-72f08152c097"},"status":"ok","message":"Portfolio optimised","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/stats":{"get":{"operationId":"get_v1_stats","tags":["Portfolio"],"summary":"Per-asset return/vol + correlation & covariance","description":"","parameters":[{"name":"assets","in":"query","required":true,"description":"Asset blocks name:series separated by ;","schema":{"type":"string"},"example":"stocks:100,103,101,106,104,109;bonds:50,49.5,50.5,49.8,50.6,49.9"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Returns and (co)variances annualised by periods_per_year. Matrices are ordered as the assets array.","assets":["stocks","bonds"],"source":"PORTFOLIO","per_asset":[{"asset":"stocks","return_annualised":4.500542,"volatility_annualised":0.491874},{"asset":"bonds","return_annualised":-0.072027,"volatility_annualised":0.240675}],"observations":5,"periods_per_year":252,"covariance_matrix":[[0.24193994,-0.11698605],[-0.11698605,0.05792426]],"correlation_matrix":[[1,-0.988212],[-0.988212,1]]},"meta":{"timestamp":"2026-06-11T07:49:23.826Z","request_id":"c7eadb58-30a1-4778-82a1-07a86cfdaac1"},"status":"ok","message":"Portfolio stats 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":"assets = name:series blocks separated by ';' (assets=stocks:100,102,...;bonds:50,50.5,...). Prices by default; as=returns for returns. risk_free & periods_per_year optional; rates are fractions (0.02 = 2%).","source":"Computed in-process from caller-supplied asset price series (no upstream)","service":"portfoliooptimizer-api","endpoints":{"GET /v1/meta":"This document.","GET /v1/stats":"Per-asset return/vol + correlation & covariance matrices (assets=...).","GET /v1/frontier":"Efficient-frontier points and weights (assets=...&points=12).","GET /v1/optimize":"Minimum-variance + maximum-Sharpe portfolios (assets=stocks:100,102,101,104;bonds:50,50.5,50.2,51)."},"description":"Live mean-variance (Markowitz) portfolio optimisation computed on demand from a basket of asset price series. The optimize endpoint returns the minimum-variance and maximum-Sharpe (tangency) portfolios — optimal weights, expected return, volatility and Sharpe; the frontier endpoint traces the efficient frontier of optimal risk/return points and weights; the stats endpoint returns per-asset annualised return and volatility plus the correlation and covariance matrices. A multi-asset allocation engine, distinct from single-asset risk and CAPM tools. Unconstrained Markowitz (weights may be negative = short). Computed locally, nothing stored.","upstream_status":"ok"},"meta":{"timestamp":"2026-06-11T07:49:23.905Z","request_id":"13ee7d43-cc10-4710-b0d2-7796875c1dca"},"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":4200,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":940,"monthly_call_quota":85000,"rps_limit":6,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":2680,"monthly_call_quota":450000,"rps_limit":18,"hard_limit":true},{"slug":"business","name":"Business","price_cents_month":6200,"monthly_call_quota":2800000,"rps_limit":45,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/portfoliooptimizer-api"}