Skip to main content
POST
/
quantlib
/
portfolio
/
optimize
/
min-variance
Minimum Variance Portfolio
curl --request POST \
  --url https://finceptbackend.share.zrok.io/quantlib/portfolio/optimize/min-variance \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "expected_returns": [
    0.08,
    0.12,
    0.1,
    0.15
  ],
  "covariance_matrix": [
    [
      0.04,
      0.006,
      0.008,
      0.01
    ],
    [
      0.006,
      0.09,
      0.012,
      0.015
    ],
    [
      0.008,
      0.012,
      0.0625,
      0.018
    ],
    [
      0.01,
      0.015,
      0.018,
      0.16
    ]
  ],
  "rf_rate": 0.03,
  "min_weights": [
    0,
    0,
    0,
    0
  ],
  "max_weights": [
    0.4,
    0.4,
    0.4,
    0.4
  ]
}
'
{
  "success": true,
  "data": {
    "weights": [
      0.45,
      0.2,
      0.25,
      0.1
    ],
    "expected_return": 0.1025,
    "volatility": 0.1834,
    "sharpe_ratio": 0.3956
  }
}

Authorizations

X-API-Key
string
header
required

API key for authentication. Get your key at https://finceptbackend.share.zrok.io/auth/register

Body

application/json
expected_returns
number[]
required

Expected returns for each asset (annualized)

Example:
[0.08, 0.12, 0.1, 0.15]
covariance_matrix
number[][]
required

Asset covariance matrix (annualized). Must be symmetric and positive semi-definite.

Example:
[
[0.04, 0.006, 0.008, 0.01],
[0.006, 0.09, 0.012, 0.015],
[0.008, 0.012, 0.0625, 0.018],
[0.01, 0.015, 0.018, 0.16]
]
rf_rate
number
default:0

Risk-free rate (annualized). Used for Sharpe ratio calculation.

Example:

0.03

min_weights
number[] | null

Minimum weight constraints for each asset (e.g., 0.0 for long-only)

Example:
[0, 0, 0, 0]
max_weights
number[] | null

Maximum weight constraints for each asset (e.g., 0.3 for 30% position limit)

Example:
[0.4, 0.4, 0.4, 0.4]

Response

Minimum variance portfolio successfully optimized

success
boolean
Example:

true

data
object