Quant
Portfolio optimization API
Optimal portfolio weights from a returns matrix (or expected returns + covariance): minimum-variance, maximum-Sharpe (tangency), risk parity, or the efficient frontier — long-only or unconstrained, with optional covariance shrinkage. Answers 'optimal portfolio weights', 'max sharpe portfolio', 'minimum variance', 'risk parity weights', 'efficient frontier'.
Price$0.03per request
MethodPOST
Route/v1/quant/portfolio-optimize
StatusLive
MIME typeapplication/json
Rate limit60/minute
CacheNo cache
quantportfoliooptimizationmarkowitzsharperisk-parityefficient-frontierallocation
API URL
Integration docshttps://x402.hexl.dev/v1/quant/portfolio-optimizeExample request
{
"objective": "max_sharpe",
"assets": [
"A",
"B"
],
"expectedReturns": [
0.1,
0.15
],
"covariance": [
[
0.04,
0.006
],
[
0.006,
0.09
]
],
"riskFreeRate": 0.02
}Example response
{
"objective": "max_sharpe",
"longOnly": true,
"weights": {
"A": 0.62,
"B": 0.38
},
"expectedReturn": 0.119,
"volatility": 0.18,
"sharpe": 0.55
}Input schema
{
"type": "object",
"required": [
"objective"
],
"properties": {
"objective": {
"type": "string",
"enum": [
"min_variance",
"max_sharpe",
"risk_parity",
"efficient_frontier"
]
},
"returns": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "number"
}
},
"description": "periods x assets"
},
"assets": {
"type": "array",
"items": {
"type": "string"
}
},
"expectedReturns": {
"type": "array",
"items": {
"type": "number"
}
},
"covariance": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "number"
}
}
},
"riskFreeRate": {
"type": "number",
"default": 0
},
"longOnly": {
"type": "boolean",
"default": true
},
"shrinkage": {
"type": "number",
"default": 0
},
"frontierPoints": {
"type": "number",
"default": 12
},
"periodsPerYear": {
"type": "number"
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}