optimize_portfolio
Determine optimal asset allocation through mean-variance optimization. Choose from max Sharpe, min variance, or target return objectives with optional weight and sector constraints.
Instructions
Find the optimal portfolio allocation using mean-variance optimization. Supports max Sharpe, min variance, and target return objectives. Paid tier only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tickers | Yes | Universe of tickers to optimize across. Must be 2-50 tickers. The optimizer will determine the best weights within this set. | |
| objective | No | Optimization objective. "max_sharpe" = maximize risk-adjusted return, "min_variance" = minimize portfolio volatility, "target_return" = hit a specific return with minimum risk. Default: "max_sharpe". | max_sharpe |
| target_return | No | Required when objective is "target_return". Annualized return as a decimal, e.g. 0.12 = 12% annual return target. | |
| constraints | No | Optional weight constraints. See ConstraintsInput for details. | |
| risk_free_rate | No | Annualized risk-free rate as a decimal, e.g. 0.05 = 5%. Used in Sharpe ratio calculation. Default: 0.05. | |
| lookback_days | No | Historical window for estimating return and covariance. 252 = 1 year, 756 = 3 years, 1260 = 5 years. Range: 252-1260. Default: 756. |