- Mean-variance and CVaR-based object-oriented portfolio optimization
- Cash flow analysis, risk analysis, financial time-series modeling, date math, and calendar math
- Basic SIA-compliant fixed-income security analysis
- Basic Black-Scholes, Black, and binomial option pricing
- Regression and estimation with missing data
- Basic GARCH estimation, simulation, and forecasting
- Technical indicators and financial charts
Example of a financial modeling application for options and asset portfolios.
Asset Allocation and Portfolio Optimization
Financial Toolbox provides a comprehensive suite of portfolio optimization and analysis tools for performing capital allocation, asset allocation, and risk assessment. With these tools, you can:
- Estimate asset return and total return moments from price or return data
- Compute portfolio-level statistics, such as mean, variance, value at risk (VaR), and conditional value at risk (CVaR)
- Perform constrained mean-variance portfolio optimization and analysis
- Examine the time evolution of efficient portfolio allocations
- Perform capital allocation
- Account for turnover and transaction costs in portfolio optimization problems
Portfolio optimization application built using MATLAB, Financial Toolbox, and object-oriented design. The application enables the interactive selection of a portfolio, comparison to a benchmark, visualization, and reporting of key performance metrics.
Object-Oriented Portfolio Construction and Analysis
The portfolio optimization object provides a simplified interface for defining and solving portfolio optimization problems that include descriptive metadata. You can specify a portfolio name, the number of assets in an asset universe, and asset identifiers. Additionally, you can define an initial portfolio allocation.
The toolbox supports two approaches to portfolio optimization:
- Mean-variance portfolio optimization uses variance as a risk proxy. You define asset return moments either as arrays or as estimations from the return time series in a matrix or financial time series objects.
- CVaR portfolio optimization uses conditional value at risk (CVaR) as a risk proxy. You work with simulations of asset returns data.
Supported constraints include: linear inequality, linear equality, bound, budget, group, group ratio, average turnover, and one-way turnover.
Additionally, you can work with transaction costs in the portfolio optimization problem definition. You apply transaction costs on either gross or net portfolio return optimization. Transaction costs can be proportional or fixed, and they are incorporated as units of total return.
Efficient frontiers plot for a sample portfolio optimization problem with and without proportional transaction costs (TX) and turnover (TO) constraints.
Plot comparing efficient frontiers computed from mean-variance portfolio optimization with CVaR portfolio optimization.
Error Checking and Portfolio Validation
The portfolio optimization object provides error checking during the portfolio construction phase. For complex problems defined with multiple constraints, validating your inputs to or outputs from the portfolio optimization can reduce error-checking time prior to solving the optimization problem. Methods to estimate bounds and check problem feasibility are available.
Efficient Portfolio and Efficient Frontiers
Depending on your goals, you can identify efficient portfolios or efficient frontiers. The portfolio optimization object provides methods for both. You can solve for efficient portfolios by providing one or more target risks or returns.
To obtain optimal portfolios on the efficient frontier, you can
- Specify the number of portfolios to find
- Solve for the optimal portfolios at the efficient frontier endpoints
- Extract the Sharpe ratio-maximizing portfolio
Additionally, you can model long-short portfolios with or without turnover constraints.
Plot of efficient frontiers with and without a turnover constraint of 130-30. The Sharpe-ratio maximized portfolio is marked with an X on the 130-30 efficient frontier.
Postprocessing and Trade Reporting
After you identify a portfolio’s risk and return, you can use the portfolio optimization object methods to:
- Troubleshoot questionable results
- Adjust the problem definition to move toward an efficient portfolio
- Set up an asset trading record
The portfolio object supports the generation of a trade record as a dataset array. You can use the dataset array to keep track of purchases and sales of assets and to capture trades to execute.
Risk Analysis and Investment Performance
Financial Toolbox provides a comprehensive suite of tools for analyzing and assessing risk and investment performance.
Performance metrics include:
- Sharpe ratio
- Information ratio
- Tracking error
- Risk-adjusted return
- Sample and expected lower partial moments
- Maximum drawdown and expected maximum drawdown
Surface plot showing Sharpe ratio results for backtesting of a leading-lagging, exponentially weighted, moving average trading strategy on daily returns data.
The toolbox provides a collection of tools for credit risk analysis that enable you to:
- Preprocess and estimate transition probabilities from credit ratings data
- Aggregate credit ratings data into categories
- Convert from transition probabilities to credit quality thresholds and vice versa
Corporate default rate forecasting example. Plot shows the backtested out-of-sample results of actual versus predicted defaults within a 95% confidence interval.
Fixed-Income Analysis and Option Pricing
Cash Flow Analysis
Financial Toolbox offers time-value-of-money functionality to:
- Calculate present and future values
- Determine nominal, effective, and modified internal rates of return
- Calculate amortization and depreciation
- Determine the periodic interest rate paid on a loan or annuity
Basic SIA-Compliant Fixed-Income Security Analysis
The toolbox provides Securities Industry Association or SIA-compatible analytics are provided for pricing, yield curve modeling, and sensitivity analysis for government, corporate, and municipal fixed-income securities. Specific analytics include:
- Complete cash flow date, cash flow amounts, and time-to-cash-flow mapping for a bond
- Price and yield maturity
- Duration and convexity
You can price stepped and zero coupon bonds with Financial Instruments Toolbox™.
Basic Black-Scholes, Black, and Binomial Option-Pricing
With Financial Toolbox, you can:
- Use a standard market model of equity pricing with Black and Black-Scholes formulas
- Compute the sensitivities of option greeks, such as lambda, theta, and delta
With Financial Instruments Toolbox, you can price equity and fixed-income derivatives using a range of models and methods, including Heath-Jarrow-Morton and Cox-Ross-Rubinstein binomial models.
Plot showing the option greeks gamma (z-axis height) and delta (color) for a portfolio of call options.
Financial Time Series Analysis
Financial Toolbox provides a collection of tools for analyzing time series data in the financial markets. The toolbox includes a financial time series object that supports:
- Date math, including business days and holidays
- Data transformation and analysis
- Technical analysis
- Charting and graphics
The Financial Time Series app provides a convenient interface for creating, managing, and manipulating financial time series objects, including transforming to or from MATLAB® numeric arrays. You can also load data in the tool directly from a file, database (with Database Toolbox™), or financial datafeed provider (with Datafeed Toolbox™).
Importing and visualizing stock data using the Financial Time Series app. You can import data, display selected time series objects (left), plot the selected times series object (top right), and access data from a datafeed provider (bottom right).
Basic GARCH Estimation, Simulation, and Forecasting
Financial Toolbox includes tools for working with univariate GARCH models. These tools help you:
- Estimate parameters of a univariate GARCH(p, q) model with Gaussian innovations
- Simulate univariate GARCH(p, q) processes
- Forecast conditional variances
Econometrics Toolbox™ includes tools for working with additional GARCH models and performing time series regression.
Regression and Estimation with Missing Data
Financial Toolbox provides tools for performing multivariate normal regression with or without missing data. You can:
- Perform common regressions based on the underlying model, such as seemingly unrelated regression (SUR)
- Estimate log-likelihood function and standard errors for hypothesis testing
- Complete calculations in the presence of missing data
Results of estimating CAPM model parameters with missing data. You can estimate with missing data (parenthetic values are the t-statistic), suggesting the GOOG Beta coefficient is not statistically different from zero (top left), and use seemingly unrelated regression to identify a statistically significant Beta coefficient for GOOG (bottom right).
Missing data estimation functionality helps you determine the effect of data quality on your models and simulations. For example, you can account for the effects of missing data on estimating coefficients of CAPM models or on calculating the efficient frontier of a portfolio of assets. Missing data effects can result in significantly different results.
Plot showing the effect of missing data on the estimation of the mean-variance efficient frontier. The frontier in red was calculated by removing all time periods containing missing data in the sample data. The frontier in blue was calculated using ecmnmle to estimate values for the missing data.
Technical Indicators and Financial Charts
Financial Toolbox provides numerous well-known technical indicators, performance metrics, and specialized plots, including:
- Moving averages
- Oscillators, stochastics, indexes, and indicators
- Maximum drawdown and expected maximum drawdown
- Charts, including Bollinger bands, candlestick plots, and moving averages
Graphical tool for exploring different types of financial charts and technical indicators.
Monte Carlo Simulation of SDE Models
Financial Toolbox offers a variety of well-known Stochastic Differential Equation (SDE) models. SDE models are used in many different ways, such as pricing financial derivatives, interest-rate modeling, risk analysis, and back-testing. Supported SDE models include:
- Brownian Motion (BM)
- Geometric Brownian Motion (GBM)
- Constant Elasticity of Variance (CEV)
- Cox-Ingersoll-Ross (CIR)
- Hull-White/Vasicek (HWV)