Portfolio Optimizer integration
Portfolio Optimizer is a quantitative finance API. Compute asset returns, volatilities, higher moments, covariance and correlation matrices (empirical, rank-based, nearest valid), volatility estimates and forecasts and trading indicators; optimize portfolios (equal weight, inverse volatility, risk parity, minimum variance, maximum Sharpe ratio, mean-variance efficient and more, with weight, group and exposure constraints); analyze portfolios (returns, Sharpe and information ratios, alpha, beta, drawdowns, value at risk, contributions, factor exposures); simulate returns and portfolios; and read market data (capital market assumptions, Fama-French factors, U.S. macro and sentiment indicators). Inputs and outputs are numbers: returns and weights are decimals (0.05 = 5%). Only 98 of the vendor's 249 routes are exposed: the fitting, alternative estimators, resampling-based and subset-resampling variants, the suspended NAAIM Exposure Index and one route whose example contradicts its schema are left out. Authentication is an API key (obtained by contributing to the running costs) sent in the X-API-Key header; without a key, requests are limited to a subset of endpoints, 1 request per second shared by all anonymous users and 20 assets, and market data routes require a key.
Say what should happen.
The workflow builds itself.
What you can do with Portfolio Optimizer
Each of these is one operation on one endpoint, available both as a workflow step and as a tool an AI agent can call on its own. Nothing bundles several operations into one action, so what a run did stays readable afterwards.
Most endpoints run on the free plan. A few, mainly the ones that publish on your behalf, need a paid plan.
Empirical, 5 operations
estimate_empirical_conditional_value_at_riskEstimate empirical conditional value at riskPOSTComputes the empirical conditional value at risk (expected shortfall) of one or several portfolios at a confidence level.estimate_empirical_correlation_matrixEstimate empirical correlation matrixPOSTEstimates the empirical correlation matrix of assets from their returns or their close-to-close prices.estimate_empirical_covariance_matrixEstimate empirical covariance matrixPOSTEstimates the empirical covariance matrix of assets from their returns, or from their close-to-close prices (logarithmic returns are computed).estimate_empirical_value_at_riskEstimate empirical value at riskPOSTComputes the empirical (historical) value at risk of one or several portfolios at a confidence level.estimate_expected_returnsEstimate expected returnsPOSTEstimates the empirical expected returns of assets from their returns.
Us, 5 operations
get_us_aiaeGet us aiaeGETReturns the U.S. AIAE (Aggregate Investor Allocation to Equities) indicator and its forecast of the 10-year annualized U.S. stock market (geometric) return. Requires an API key.get_us_bsrmbGet us bsrmbGETReturns the U.S. BSRM/B (Bogle Sources of Return Model for Bonds) indicator and its forecast of the 10-year annualized 10-year Treasury bond (geometric) return. Requires an API key.get_us_currency_debasement_indicatorGet us currency debasement indicatorGETReturns the U.S. Currency Debasement Indicator (Charles Gave): whether long-dated U.S. Treasuries have been a proper store of value. Requires an API key.get_us_energy_efficiency_indicatorGet us energy efficiency indicatorGETReturns the U.S. Energy Efficiency Indicator (Charles Gave): whether energy is being transformed productively. Requires an API key.get_us_fama_french_factorsGet us fama french factorsGETReturns end-of-month monthly USD returns of the Fama-French U.S. factors: MKT-RF, SMB, SMB5, HML, RMW, CMA, RF and MOM. Requires an API key.
Return, 4 operations
compute_asset_returnsCompute asset returnsPOSTComputes the arithmetic returns of one or several assets from their prices.compute_portfolio_returnCompute portfolio returnPOSTComputes the simple return of one or several portfolios over the period.compute_portfolio_returnsCompute portfolio returnsPOSTComputes the arithmetic returns of one or several portfolios.compute_return_contributionsCompute return contributionsPOSTPerforms a return contribution analysis of one or several portfolios: how much each asset contributed to the portfolio return.
Gaussian, 2 operations
estimate_gaussian_conditional_value_at_riskEstimate gaussian conditional value at riskPOSTComputes the Gaussian conditional value at risk (expected shortfall) of one or several portfolios at a confidence level.estimate_gaussian_value_at_riskEstimate gaussian value at riskPOSTComputes the parametric Gaussian value at risk of one or several portfolios at a confidence level.
Matrix, 2 operations
compute_correlation_matrixCompute correlation matrixPOSTComputes the correlation matrix of assets from their covariance matrix.compute_covariance_matrixCompute covariance matrixPOSTComputes the covariance matrix of assets from their correlation matrix and either their standard deviations or their variances.
Mean, 2 operations
compute_asset_mean_returnsCompute asset mean returnsPOSTComputes the arithmetic average of the returns of one or several assets.compute_portfolio_mean_returnCompute portfolio mean returnPOSTComputes the mean return of one or several portfolios from the asset arithmetic returns or from portfolio values.
Standard deviation, 2 operations
compute_asset_volatilitiesCompute asset volatilitiesPOSTComputes the standard deviation (volatility) of the returns of one or several assets, from their returns or from their variance.compute_portfolio_volatilityCompute portfolio volatilityPOSTComputes the standard deviation (volatility) of one or several portfolios from the asset covariance matrix and weights, the portfolio returns or the portfolio values.
Validation, 2 operations
validate_correlation_matrixValidate correlation matrixPOSTChecks whether a matrix is a valid asset correlation matrix.validate_covariance_matrixValidate covariance matrixPOSTChecks whether a matrix is a valid covariance matrix.
Variance, 2 operations
compute_asset_variancesCompute asset variancesPOSTComputes the variance of the returns of one or several assets, from their returns or from their volatility.compute_portfolio_varianceCompute portfolio variancePOSTComputes the variance of one or several portfolios from the asset covariance matrix and weights, or from portfolio values or returns.
Aaii asset allocation survey, 1 operation
get_aaii_asset_allocation_surveyGet aaii asset allocation surveyGETReturns the AAII Asset Allocation Survey: individual U.S. investors' allocations to stocks, bonds and cash, as reported by the American Association of Individual Investors. Requires an API key.
Absorption ratio, 1 operation
compute_absorption_ratioCompute absorption ratioPOSTComputes the absorption ratio of a universe of assets.
Adjusted, 1 operation
compute_adjusted_pricesCompute adjusted pricesPOSTComputes backward-adjusted prices of assets from unadjusted close prices, capital distributions (dividends) and splits; the last date with an unadjusted price is the adjustment base.
Alpha, 1 operation
compute_jensens_alphaCompute jensens alphaPOSTComputes Jensen's alpha of one or several portfolios in the Capital Asset Pricing Model (CAPM).
Average correlation, 1 operation
compute_average_correlationCompute average correlationPOSTComputes the average correlation of an asset correlation matrix.
Beta, 1 operation
compute_betaCompute betaPOSTComputes the beta of one or several portfolios in the Capital Asset Pricing Model (CAPM).
Chf, 1 operation
get_chf_capital_market_assumptionsGet chf capital market assumptionsGETReturns averaged 10-year capital market assumptions in CHF (arithmetic and geometric returns, standard deviations, correlations) from leading financial institutions, per asset class. Requires an API key.
Close to close, 1 operation
estimate_close_to_close_volatilityEstimate close to close volatilityPOSTComputes the close-to-close volatility of one or several assets over a period, from close prices.
Cornish fisher, 1 operation
estimate_cornish_fisher_value_at_riskEstimate cornish fisher value at riskPOSTComputes the parametric Cornish-Fisher value at risk of one or several portfolios at a confidence level.
Correlation based, 1 operation
cluster_assets_hierarchicallyCluster assets hierarchicallyPOSTPartitions a universe of assets into clusters with a hierarchical clustering method based on their correlations.
Developed market, 1 operation
get_developed_markets_fama_french_factorsGet developed markets fama french factorsGETReturns end-of-month monthly USD returns of the Fama-French developed markets factors: MKT-RF, SMB, SMB5, HML, RMW, CMA, RF and WML. Requires an API key.
Diversification ratio, 1 operation
compute_diversification_ratioCompute diversification ratioPOSTComputes the diversification ratio of one or several portfolios from the asset covariance matrix and their weights.
Drawdown, 1 operation
compute_drawdownsCompute drawdownsPOSTComputes the drawdown function of one or several portfolios.
Effective number of bet, 1 operation
compute_effective_number_of_betsCompute effective number of betsPOSTComputes the effective number of bets of one or several portfolios.
Effective rank, 1 operation
compute_effective_rankCompute effective rankPOSTComputes the effective rank of a universe of assets.
Efficient frontier, 1 operation
compute_efficient_frontierCompute efficient frontierPOSTComputes the discretized mean-variance efficient frontier of a list of assets, optionally under weight, group weight and exposure constraints.
Emerging market, 1 operation
get_emerging_markets_fama_french_factorsGet emerging markets fama french factorsGETReturns end-of-month monthly USD returns of the Fama-French emerging markets factors: MKT-RF, SMB5, HML, RMW, CMA, RF and WML. Requires an API key.
Empirical tracking error, 1 operation
compute_tracking_errorCompute tracking errorPOSTComputes the empirical tracking error between one or several portfolios and a benchmark.
Equal risk contribution, 1 operation
optimize_equal_risk_contributionsOptimize equal risk contributionsPOSTComputes the asset weights of the equal risk contributions portfolio, optionally under minimum and maximum weight constraints.
Equal volatility weighted, 1 operation
optimize_equal_volatility_weightedOptimize equal volatility weightedPOSTComputes the asset weights of the equal volatility-weighted portfolio.
Equal weighted, 1 operation
optimize_equal_weightedOptimize equal weightedPOSTComputes the asset weights of the equal-weighted portfolio.
Eur, 1 operation
get_eur_capital_market_assumptionsGet eur capital market assumptionsGETReturns averaged 10-year capital market assumptions in EUR (arithmetic and geometric returns, standard deviations, correlations) from leading financial institutions, per asset class. Requires an API key.
Evolution, 1 operation
simulate_portfolio_evolutionSimulate portfolio evolutionPOSTSimulates the evolution of the value of a portfolio over time.
Ewma, 1 operation
forecast_ewma_volatilityForecast ewma volatilityPOSTForecasts the volatility of one or several assets with an exponentially weighted moving average (EWMA) model.
Exponentially weighted, 1 operation
estimate_exponentially_weighted_covariance_matrixEstimate exponentially weighted covariance matrixPOSTEstimates the exponentially weighted empirical covariance matrix of assets from their returns, or from their close-to-close prices (logarithmic returns are computed).
Exposure, 1 operation
compute_factor_exposuresCompute factor exposuresPOSTComputes the exposures of one or several portfolios to a set of factors, with a returns-based linear regression.
Garch, 1 operation
forecast_garch_volatilityForecast garch volatilityPOSTForecasts the volatility of one or several assets with a GARCH(1,1) model.
Hierarchical risk parity, 1 operation
optimize_hierarchical_risk_parityOptimize hierarchical risk parityPOSTComputes the asset weights of the hierarchical risk parity portfolio, optionally under weight and exposure constraints.
Implied, 1 operation
estimate_implied_expected_returnsEstimate implied expected returnsPOSTEstimates the asset expected returns implied by a portfolio's asset weights and the asset covariance matrix.
Index tracking, 1 operation
compute_index_tracking_portfolioCompute index tracking portfolioPOSTConstructs a portfolio whose returns track a benchmark as closely as possible, optionally under weight, group weight and exposure constraints.
Information ratio, 1 operation
compute_information_ratioCompute information ratioPOSTComputes the information ratio of one or several portfolios against a benchmark.
Inverse variance weighted, 1 operation
optimize_inverse_variance_weightedOptimize inverse variance weightedPOSTComputes the asset weights of the inverse variance-weighted portfolio.
Inverse volatility weighted, 1 operation
optimize_inverse_volatility_weightedOptimize inverse volatility weightedPOSTComputes the asset weights of the inverse volatility-weighted portfolio.
Investable, 1 operation
construct_investable_portfolioConstruct investable portfolioPOSTComputes an investable portfolio (number of shares) as close as possible to desired asset weights, given asset prices, portfolio value, round or odd lots, fractional shares and minimums.
Kendall, 1 operation
estimate_kendall_correlation_matrixEstimate kendall correlation matrixPOSTComputes the Kendall rank correlation matrix of assets from their returns, or from their close-to-close prices (logarithmic returns are computed).
Kurtosis, 1 operation
compute_asset_kurtosisCompute asset kurtosisPOSTComputes the kurtosis of the returns of one or several assets.
Logarithmic, 1 operation
compute_asset_log_returnsCompute asset log returnsPOSTComputes the logarithmic (continuously compounded) returns of one or several assets from their prices.
Market capitalization weighted, 1 operation
optimize_market_capitalization_weightedOptimize market capitalization weightedPOSTComputes the asset weights of the market capitalization-weighted portfolio.
Market rank, 1 operation
compute_market_rankCompute market rankPOSTComputes the market rank indicator of a universe of assets.
Maximum, 1 operation
compute_maximum_drawdownCompute maximum drawdownPOSTComputes the maximum drawdown of one or several portfolios.
Maximum decorrelation, 1 operation
optimize_maximum_decorrelationOptimize maximum decorrelationPOSTComputes the asset weights of the maximum decorrelation portfolio, optionally under weight, group weight and exposure constraints.
Maximum return, 1 operation
optimize_maximum_returnOptimize maximum returnPOSTComputes the asset weights of the maximum return portfolio, optionally under weight, group weight and exposure constraints.
Maximum sharpe ratio, 1 operation
optimize_maximum_sharpe_ratioOptimize maximum sharpe ratioPOSTComputes the asset weights of the maximum Sharpe ratio portfolio, optionally under weight, group weight and exposure constraints.
Mean variance efficient, 1 operation
optimize_mean_variance_efficientOptimize mean variance efficientPOSTComputes the asset weights of a mean-variance efficient portfolio (on the efficient frontier), optionally under weight, group weight and exposure constraints.
Minimum correlation, 1 operation
optimize_minimum_correlationOptimize minimum correlationPOSTComputes the asset weights of the minimum correlation portfolio, built with the minimum correlation algorithm.
Minimum ulcer index, 1 operation
optimize_minimum_ulcer_indexOptimize minimum ulcer indexPOSTComputes the asset weights of the minimum Ulcer Index portfolio, optionally under weight, group weight and exposure constraints.
Minimum variance, 1 operation
optimize_minimum_varianceOptimize minimum variancePOSTComputes the asset weights of the minimum variance portfolio, optionally under weight, group weight and exposure constraints.
Momentum, 1 operation
compute_momentumCompute momentumPOSTComputes the (time series) momentum of one or several assets.
Money weighted, 1 operation
compute_money_weighted_returnCompute money weighted returnPOSTComputes the money-weighted return (MWR) of a portfolio from its values and its contributions and withdrawals.
Most diversified, 1 operation
optimize_most_diversifiedOptimize most diversifiedPOSTComputes the asset weights of the most diversified portfolio, optionally under weight, group weight and exposure constraints.
Moving average distance, 1 operation
compute_moving_average_distanceCompute moving average distancePOSTComputes the moving average distance of one or several assets.
Multivariate, 1 operation
simulate_returns_multivariate_gaussianSimulate returns multivariate gaussianPOSTSimulates asset returns from a multivariate Gaussian distribution with the given means and covariance matrix, optionally matching them exactly in sample.
Nearest, 1 operation
compute_nearest_correlation_matrixCompute nearest correlation matrixPOSTComputes the valid correlation matrix closest to an approximate one, optionally keeping some correlations fixed.
Parkinson, 1 operation
estimate_parkinson_volatilityEstimate parkinson volatilityPOSTComputes the Parkinson volatility of one or several assets over a period, from open, high, low and close prices.
Probabilistic, 1 operation
compute_probabilistic_sharpe_ratioCompute probabilistic sharpe ratioPOSTComputes the probabilistic Sharpe ratio of one or several portfolios.
Random, 1 operation
simulate_random_portfoliosSimulate random portfoliosPOSTSimulates random asset weights, optionally under number of assets, weight, group weight and exposure constraints. Each call returns different weights.
Risk, 1 operation
compute_risk_contributionsCompute risk contributionsPOSTPerforms a risk contribution analysis of one or several portfolios, the risk measure being the portfolio standard deviation.
Risk budgeting, 1 operation
optimize_risk_budgetingOptimize risk budgetingPOSTComputes the asset weights of the risk budgeting portfolio for the given risk budgets, optionally under minimum and maximum weight constraints.
Rounding, 1 operation
round_portfolio_weightsRound portfolio weightsPOSTRounds the asset weights of a portfolio, optionally under minimum and maximum weight, group weight and portfolio exposure constraints.
Semideviation, 1 operation
compute_semideviationCompute semideviationPOSTComputes the semideviation of one or several portfolios.
Sharpe ratio, 1 operation
compute_sharpe_ratioCompute sharpe ratioPOSTComputes the Sharpe ratio of one or several portfolios, with its 95% confidence interval when computed from portfolio values or returns.
Skewness, 1 operation
compute_asset_skewnessCompute asset skewnessPOSTComputes the skewness of the returns of one or several assets.
Slope, 1 operation
compute_trend_slopeCompute trend slopePOSTComputes the trend slope of one or several assets.
Spearman, 1 operation
estimate_spearman_correlation_matrixEstimate spearman correlation matrixPOSTComputes the Spearman rank correlation matrix of assets from their returns, or from their close-to-close prices (logarithmic returns are computed).
Stationary, 1 operation
simulate_returns_stationary_bootstrapSimulate returns stationary bootstrapPOSTSimulates asset returns by stationary block bootstrap of their historical returns.
Time weighted, 1 operation
compute_time_weighted_returnCompute time weighted returnPOSTComputes the time-weighted return (TWR) of a portfolio from its values and its contributions and withdrawals.
Turbulence index, 1 operation
compute_turbulence_indexCompute turbulence indexPOSTComputes the turbulence index of a universe of assets and its per-asset contributions.
Ulcer index, 1 operation
compute_ulcer_indexCompute ulcer indexPOSTComputes the Ulcer Index of one or several portfolios.
Usd, 1 operation
get_usd_capital_market_assumptionsGet usd capital market assumptionsGETReturns averaged 10-year capital market assumptions in USD (arithmetic and geometric returns, standard deviations, correlations) from leading financial institutions, per asset class. Requires an API key.
Volatility adjusted, 1 operation
compute_volatility_adjusted_momentumCompute volatility adjusted momentumPOSTComputes the volatility-adjusted momentum of one or several assets.
Worst, 1 operation
compute_worst_drawdownsCompute worst drawdownsPOSTComputes the worst drawdowns of one or several portfolios with their start, bottom and end times.
Yang zhang, 1 operation
estimate_yang_zhang_volatilityEstimate yang zhang volatilityPOSTComputes the Yang-Zhang volatility of one or several assets over a period, from open, high, low and close prices.
Use Portfolio Optimizer from Claude Code, Cursor or Codex
Connect Portfolio Optimizer in LiveContext, create an API key in Settings, then add the LiveContext MCP server to your client. Its Portfolio Optimizer operations become tools the client can call, next to every other integration you connected.
claude mcp add --transport http livecontext https://livecontext.ai/mcp --header "X-API-Key: YOUR_API_KEY"[mcp_servers.livecontext]
url = "https://livecontext.ai/mcp"
[mcp_servers.livecontext.http_headers]
"X-API-Key" = "YOUR_API_KEY"{
"mcpServers": {
"livecontext": {
"type": "http",
"url": "https://livecontext.ai/mcp",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}How to connect Portfolio Optimizer
- Create your workspace
Sign up free. Nothing to install.
- Connect Portfolio Optimizer once
Add your Portfolio Optimizer connection in Settings. Every tool from this integration reuses it, and secrets are encrypted at rest and visible only to you.
- Describe the job in chat
The workflow builds itself in front of you and picks the endpoints it needs. Drag the steps yourself on the canvas whenever you would rather be explicit.
Portfolio Optimizer integration FAQ
What can you do with the Portfolio Optimizer integration?
LiveContext exposes 98 operations on Portfolio Optimizer, covering empirical, us, return and gaussian.
