If a trader needs to unwind a **large position**, he or she is exposed to:

- the potential loss from price movements, and
- trading liquidity risk

The trader may wish to **minimize** the Value-at-Risk (VaR) after considering the trading costs (or cost of liquidation). What is the **optimal trading strategy** then to achieve the trader’s objective?

**Part 1 (Concept and Motivation)**

The video explains the concept and define the problem set. At the end, I will use a simple case which will be the input to Part 2.

**Part 2 (Building the model)**

Using the parameters from the Case in Part 1, in this video, I walk through the model building in Excel. I will model the VaR of the position outstanding at the end of each day and the cost of liquidating the position every day. The objective is to minimize the VaR + cost of liquidation over the trading period.

**stressed market scenario**, the cost of liquidation can be modeled as (mean bid-offer spread + Z * standard deviation of bid-offer spread), where Z is the inverse of a cumulative distribution function (e.g. normal distribution).

Value-at-risk (VaR) is a popular risk measure used in financial institutions to measure the risk in their portfolios. It measures the minimum loss within an interval period at a given probability (e.g. 1% or 5% being the commonly used figure). For example, if a portfolio has a one-week, 5% value-at-risk of USD 4 million, then there is a 5% probability that the portfolio would lose more than USD 4 million with a 1-week period (i.e. 1 week out of 20).

There are three approaches to estimate VaR:

- Historical VaR
- Parametric VaR
- Monte Carlo VaR (
*not discussed in this article*)

Then, the concept of Conditional Value-at-Risk (CVaR) was developed to measure the average loss if the VaR is exceeded. CVaR is also called expected shortfall or expected tail loss.

Using Netflix’s historical price data, I will illustrate the estimation of historical, parametric (Gaussian), and Cornish-Fisher VaR and CVaR in Excel.

__Historical VaR and CVaR__

The historical VaR method uses a large quantity of historical data to estimate VaR. It makes minimal assumptions about the return distribution.

__Parametric VaR and CVaR (Gaussian)__

For this method, we have to assume a statistical distribution for the returns of the stock. Typically, we will assume a Gaussian or Normal distribution (which I will use in the video).

__Modified VaR and CVaR (Cornish-Fisher expansion)__

The Cornish-Fisher expansion is useful when the return distribution is **non-normal**. The formula builds in the sample skewness and excess kurtosis to estimate extreme quantiles.

The tree-based method is an easy-to-implement model for option pricing, and it can be used to value about any type of options (American options, barrier options, digital options, Asian options, etc).

In this tutorial video, I will implement the popular Cox, Ross, and Rubinstein binomial tree option pricing model via Excel and then VBA. To make things simple, I will be covering European call and put options.

The model can easily be extended to price American options by assessing whether early exercise is profitable at every node in the tree.

How do bond managers target their bond portfolios to meet a liability payment sometime in the future? Given that bond value fluctuates due to changes in interest rates and spreads, how do we maximize the chances that the bond portfolio will be sufficient to cover for the liability?

That is a problem that can be solved using **interest rate immunization**. It’s not a panacea. It will require constant rebalancing to maintain the immunization (it’s a cost-benefit trade off). If the portfolio is **not immunized**, there is a risk that there will be insufficient liquidity to meet the liability, should the interest rate shift upwards/downwards during the horizon. Another alternative is to use **cash flow matching**, but at a more costly method as it uses government/low-risk bonds to ensure minimal defaults).

For a **single liability**, we start by allocating to the bonds such that the **portfolio Macaulay duration** is equals to the due date of the liability. The **market value of the bonds** should be equals to or greater than the present value of the liability. The **portfolio convexity/dispersion** should be minimized, which will then minimize **structural risk** (which results from non-parallel shifts in the yield curve or changes in the yield curve slope/curvature).

If executed correctly, the price risk will offset the reinvestment risk of the portfolio and result in zero to minimal impact on the portfolio value (if it is held up to the Macaulay duration).

Given an **instantaneous **parallel shift in the cash flow yield:

- If the investment horizon is
**less than**the Macaulay duration, then price risk will dominate (relative to reinvestment risk). - If the investment horizon is
**greater than**the Macaulay duration, then reinvestment risk will dominate (relative to price risk).

Watch this video to see how we can build a simple model in Excel to calculate:

- Portfolio cash flow yield
- Macaulay duration
- Dispersion
- Convexity
- Impact of a parallel shift in the cash flow yield on the portfolio value (holding the portfolio to the Macaulay duration)

Further improvements to implement:

- Use
**Solver**to target specific Macaulay Duration (tied to the single liability’s due date) and re-calculate the allocation of the bonds in the portfolio. - You can code this in VBA to automate the calculation of portfolio Macaulay duration, dispersion, convexity and calculate the optimal allocation to immunize the interest rate risk.

When we model a problem, we will usually have a set of inputs, feed it into the model and we get the output. There are also times, when we have a target output and we want to know what the input value (out of all the other inputs) would be in order to achieve that output value.

Take the example where we compute the value of a European-style call option using the Black-Scholes formula. Often times, traders will want to know the implied volatility given the option price.

Well, you could estimate the implied volatility if you implement the Newton-Raphson method or other numerical methods, but a quick and easy way to do this in Excel will be to use **GoalSeek**.

Excel file can be found at: https://drive.google.com/file/d/1fY6Og1zIhJq1PvTZftAbC7zQ0teXQlYi/view?usp=sharing

For illustration, I will assume:

- Underlying price = 50
- Strike/Exercise price = 52
- Volatility = 20% (Initially)
- Time to Maturity = 6 months (0.5 years)
- Risk-free rate = 3% p.a.

Using the Black-Scholes formula, we would get the call option price as 2.28.

But, if the call option price is 5.20, then what would the implied volatility be?

Let’s say you have a client who wants to construct a stock portfolio, and she chose the following stocks:

- Apple (AAPL)
- Boeing Airlines (BA)
- Netflix (NFLX)
- Tesla (TSLA)

Your client has stated that the objective of maximizing the Sharpe ratio of her portfolio. Her maximum risk tolerance is based on a standard deviation of 30% per annum.

You collected the monthly data of the stocks mentioned above and computed the **monthly returns **(from 1 Jan 2015 to 1 Dec 2019) on a **continuously compounded** basis. The data file can be found: here. For the purpose of this exercise, you assume the risk-free rate is 4% per annum.

Use Excel to compute the optimal weights for each stock in order to achieve the client’s objective.

—————————–

** Steps**:

- Compute the covariance of each stock.
- Compute the average monthly return of each stock.
- Based on an initial weight, we will compute the portfolio’s monthly return and standard deviation.
- Then, we will annualize the portfolio return and standard deviation.
- We then use Solver to find the optimal weights based on the client’s objective.

I was inspired to write this piece after teaching a reading in the CFA Level 3 syllabus for the June 2020 exam. In Reading 28 on Overview of Private Wealth Management, it touched on a term called “**Capital Sufficiency Analysis**” (or Capital Needs Analysis), which is a process of determining if a client has, or is likely to accumulate sufficient financial resources to meet his/her objectives.

The two methods for evaluating capital sufficiency analysis are:

- Deterministic forecasting
- Monte Carlo simulation

With the textbook showing only the results of the Monte Carlo simulation, I thought to myself, “Why not do a tutorial to show how Monte Carlo simulation can be implemented in Excel?”

** Case**:

Imagine you have a 70-year old client with a portfolio valued at $2,000,000. As her wealth manager, you propose a mix of asset classes:

- Government bonds (risk-free): with an expected return of 4% per annum.
- Equities: with an expected return of 12% and a standard deviation of return of 30%.

Based on capital market expectations and the client’s risk profile, a proposed allocation is 40% invested in equities and the remaining 60% goes to government bonds. (For my demonstration, I will assume that equity returns follow a normal distribution)

Your client indicated that she would like to withdraw $180,000 out of her account every year (let’s assume the withdrawal happens at the end of the year). She would like to donate $100,000 to charity at the age of 80 (i.e. her investment horizon is 10 years).

**What are her chances of achieving her objective?**

———————————–

So, given such a case, how can we implement Monte Carlo simulation to this analysis?

Let’s start!

First, we will input the parameters and build the model.

**Data Table** to implement the Monte Carlo simulation. Though VBA would be a more efficient way to implement, I prefer using Data Table as it is easier for most to understand.

—————–

*This tutorial is for education purposes only. For professional advice, please seek a qualified financial planner/wealth manager.*

Sometime back, my student asked me for help in building a calculator in Excel for pricing options using the **Black-Scholes** (or what they call as **Black-Scholes-Merton**) model. So, I thought of doing this tutorial to show how anyone with Excel can build their own BSM calculator.

In the first part, I will calculate the prices of a European-style call and put option.

In the second part, I will calculate the option greeks for the call and put option

**Case:**

- Underlying price = 307.35
- Exercise price = 335.00
- Volatility = 25% p.a.
- Continuously compounded risk-free rate = 2% p.a.
- Continuously compounded dividend yield = 0% p.a.
- Time to expiration (in years) = 102/365 = 0.2795 year

Let’s start with the first part!

Once you are done with that, you can change the inputs to see the impact on the option prices.

Next, we are going to calculate the **option Greeks** (i.e. delta, gamma, vega, theta, rho).