0% found this document useful (0 votes)
41 views

Note (1)

The document is a comprehensive guide on Financial Engineering and Risk Management, specifically designed for the MSc in Corporate Finance at Addis Ababa University. It covers a wide range of topics including stochastic calculus, asset pricing, the Black-Scholes-Merton model, and various financial derivatives. The content is structured into chapters that include theoretical concepts, mathematical foundations, and practical implementations using Python.

Uploaded by

Bantamkak Fikadu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Note (1)

The document is a comprehensive guide on Financial Engineering and Risk Management, specifically designed for the MSc in Corporate Finance at Addis Ababa University. It covers a wide range of topics including stochastic calculus, asset pricing, the Black-Scholes-Merton model, and various financial derivatives. The content is structured into chapters that include theoretical concepts, mathematical foundations, and practical implementations using Python.

Uploaded by

Bantamkak Fikadu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 243

Financial Engineering and

Risk Management
Addis Ababa University, College of Business and Economics;
School of Commerce;
MSc in Corporate Finance

© Tamirat T. Dufera†
Dakito A. Kesto†

Addis Ababa University, Addis Ababa, Ethiopia
ii
Financial Engineering and Risk Management

Tamirat T. Dufera, PhD Dakito A. Kesto, PhD

October, 2023
ii
Contents

1 Introduction 1
1.1 Introduction to Financial Engineering and Risk Management . . . . . . . . 1
1.2 Programming language for financial engineering . . . . . . . . . . . . . . . . 2
1.3 Getting Started with Python . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2 Introduction to Stochastic Calculus and Martingales 31


2.1 Simple mathematical functions for financial engineering . . . . . . . . . . . 31
2.2 Review of Basic Probability . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.2.1 Binomial Random Varaibles . . . . . . . . . . . . . . . . . . . . . . . 40
2.2.2 The Poisson Distribution . . . . . . . . . . . . . . . . . . . . . . . . 41
2.2.3 The Normal Distribution . . . . . . . . . . . . . . . . . . . . . . . . 44
2.2.4 The Log-Normal Distribution . . . . . . . . . . . . . . . . . . . . . . 47
2.2.5 Random Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.3 Stochastic Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.3.1 Symmetric random walk . . . . . . . . . . . . . . . . . . . . . . . . . 55
2.3.2 Standard Brownian Motion . . . . . . . . . . . . . . . . . . . . . . . 57
2.3.3 Linear Brownian motion . . . . . . . . . . . . . . . . . . . . . . . . . 60
2.3.4 Geometric Brownian motion . . . . . . . . . . . . . . . . . . . . . . . 61
2.4 Python Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

3 The Fundamental Theorem of Asset Pricing 83


3.1 No Arbitrage Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
3.2 Binomial Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
3.2.1 A one-step binomial model and a no-arbitrage argument . . . . . . . 85
3.3 Risk-Neutral Valuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
3.4 Two-Step Binomial Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
3.5 A Put Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

iii
iv CONTENTS

3.6 American Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92


3.7 Delta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
3.8 Matching Volatility with u and d . . . . . . . . . . . . . . . . . . . . . . . . 93
3.8.1 Options on Other Assets . . . . . . . . . . . . . . . . . . . . . . . . . 95
3.9 Arbitrage Free Market(General Portfolio) . . . . . . . . . . . . . . . . . . . 96
3.10 Risk-Neutral Pricing and Martingale Measures . . . . . . . . . . . . . . . . 99

4 Wiener Processes and Itô’s Lemma(Applications) 105


4.1 The Markov Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
4.2 Continuous-Time Stochastic Processes . . . . . . . . . . . . . . . . . . . . . 106
4.2.1 Diffusion processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
4.2.2 Stochastic differential equations . . . . . . . . . . . . . . . . . . . . . 111
4.2.3 Itô’s lemma for diffusion process . . . . . . . . . . . . . . . . . . . . 111
4.3 The Process for a Stock Price . . . . . . . . . . . . . . . . . . . . . . . . . . 111
4.4 Correlated Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
4.5 Applying Itô’s lemma on the stock price process . . . . . . . . . . . . . . . . 118
4.6 Python Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
4.7 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

5 The Black-Scholes-Merton Model 129


5.1 Lognormal Property of Stock Prices . . . . . . . . . . . . . . . . . . . . . . 129
5.2 The Distribution of the Rate of Return . . . . . . . . . . . . . . . . . . . . . 132
5.3 The Expected Return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
5.4 Volatility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
5.5 The Idea Underlying The Black-Scholes-Merton Differential Equation . . . . 134
5.6 The Derivation of the Black-Scholes-Merton Differential Equations . . . . . 135
5.7 Risk-Neutral Valuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
5.8 Black-Scholes-Merton Pricing Formulas . . . . . . . . . . . . . . . . . . . . 138
5.9 Implied Volatilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
5.10 Options on Stock Indices and Currencies . . . . . . . . . . . . . . . . . . . . 140
5.11 Options on Assets Providing a Known Yield . . . . . . . . . . . . . . . . . . 141
5.12 Valuation of European Currency Options . . . . . . . . . . . . . . . . . . . 142
5.13 American Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
5.14 Python Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

6 The Greek Letters 153


6.1 Greek Letter Calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
6.2 Delta Hedging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
6.3 Theta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
CONTENTS v

6.4 Gamma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159


6.5 Relationship between delta, theta, and gamma . . . . . . . . . . . . . . . . 161
6.6 Vega . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
6.7 Rho . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
6.8 Dynamic Aspect of Delta Hedging . . . . . . . . . . . . . . . . . . . . . . . 163

7 Basic Numerical Procedures 169


7.1 Binomial Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
7.2 Monte Carlo Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
7.3 Finite Difference Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

8 Modeling Volatility 191


8.1 Local Volatility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
8.1.1 Implied Volatilities of Calls and Puts . . . . . . . . . . . . . . . . . . 192
8.1.2 The Constant Elasticity of Variance Model(CEV) . . . . . . . . . . . 194
8.2 Stochastic Volatility Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
8.2.1 The Heston Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
8.2.2 The SABR Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
8.2.3 The IVF Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196

9 Introduction to Fixed Income Derivatives 199


9.1 Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
9.2 Fixed income securities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
9.2.1 Annuities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
9.2.2 Bonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
9.2.3 Yield to maturity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
9.3 Term structure of interest rates . . . . . . . . . . . . . . . . . . . . . . . . . 211
9.3.1 The Yield Curve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
9.3.2 The Term Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
9.4 Forward contract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
9.5 Swaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
9.6 Basics of Futures Contracts . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
9.7 Futures Prices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222

10 Interest Rate Derivatives 223


10.1 Examples of Interest Rate Derivatives . . . . . . . . . . . . . . . . . . . . . 223
10.2 The Binomial Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
10.3 Pricing Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
10.4 Models of Interest Rate Dynamics . . . . . . . . . . . . . . . . . . . . . . . 232
vi CONTENTS
Chapter 1

Introduction

1.1 Introduction to Financial Engineering and Risk


Management
Financial engineering is the art of using mathematics, finance, and innovation to solve
complex financial challenges. It involves designing, refining, and implementing sophisticated
financial solutions using mathematical techniques. It’s like crafting a masterpiece where
financial theory, mathematical skill, and engineering expertise come together. This discipline
enables experts to create opportunities by managing a variety of financial instruments,
portfolios, and risk. Like architects shape skylines, financial engineering shapes modern
finance, representing a blend of intellect and innovation.

Financial engineering is a creative and analytical fusion that shapes finance. Derivatives, such
as futures, options, and swaps, help navigate volatility and speculate on markets. Structured
products, like collateralized debt obligations and mortgage-backed securities, transform
assets into innovative investments. Risk management, through hedging and diversification,
safeguards against uncertainty. These examples highlight financial engineers’ craftsmanship,
blending math precision and visionary thinking to redefine financial possibilities.

Financial engineering offers numerous benefits to the modern financial world. It combines
mathematical expertise and innovative thinking to provide flexibility and customization,
tailoring financial products to specific needs. It also serves as a robust guardian against
risk, offering tools for risk management and hedging strategies. Furthermore, it enhances
market liquidity, facilitating transactions and investments. In essence, financial engineering

1
2 Programming language for financial engineering

empowers precision and innovation, creating a more responsive, secure, and efficient financial
landscape.

Risk management is the vigilant guardian of financial and business landscapes, involving
precise risk identification, thorough assessment, and strategic control. It’s like a strategic
chess game, using financial tools to mitigate potential pitfalls. With analytical acumen and
tactical finesse, it ensures financial stability amid uncertainty.

In the complex realm of finance, a diverse array of risks lurk, demanding constant vigilance.
Market risk guards against market fluctuations, while credit risk warns of borrower defaults.
Operational risk highlights internal vulnerabilities, and liquidity risk watches over cash flow.
Prudent financial managers must navigate these risks to ensure stability and prosperity
amid uncertainty.

Risk management is the bedrock of modern finance, shielding against losses, fortifying
assets, and ensuring stability. It fosters investor confidence, fuels growth, and guides ethical
operations in a complex financial landscape.

Risk management and financial engineering are the cornerstones of modern financial markets.
They provide the foundation for crafting intricate financial instruments and portfolios,
aligning with risk dynamics. This synergy of innovation and prudence ensures the longevity
and success of businesses and markets. Mastering risk management is the key to sustaining
enterprises and fostering financial prosperity.

For further reading, Beder and Marshall (2011)

1.2 Programming language for financial engineering

Learning Outcomes
By the end of this section, you will be able to:
• Identify programming language for financial engineering
• Prepare Python platform for computation and simulation purpose
• Get the skills of using Python

The choice of programming language for financial engineering is a critical decision that
can significantly impact the efficiency, accuracy, and effectiveness of the work. Several
programming languages are commonly used in the field of financial engineering due to
their capabilities, libraries, and community support. Some of the prominent programming
languages for financial engineering include:
Programming language for financial engineering 3

(1) Python: Python has gained immense popularity in the financial industry due to its
versatility, extensive libraries (such as NumPy, pandas, and sci-kit-learn), and readability.
It is used for data analysis, quantitative modeling, and algorithm development. Python’s
ease of use and wide adoption makes it a preferred choice for prototyping and quick
development.
(2) R: R is another powerful language for statistical computing and data analysis. It has
a rich ecosystem of packages tailored for financial modeling, econometrics, and data
visualization. R is favored by researchers and analysts for its statistical capabilities and
visualization tools.
(3) MATLAB: MATLAB is known for its mathematical and numerical computing capabil-
ities. It is widely used in quantitative finance for developing complex financial models,
conducting simulations, and performing data analysis. MATLAB’s extensive toolbox
and built-in functions make it suitable for the rapid prototyping of financial algorithms.
(4) Java: Java’s cross-platform compatibility and strong libraries make it suitable for
building robust and scalable financial applications. It is often used in developing trading
platforms, risk management systems, and other enterprise-level applications.
(5) Julia: Julia is an emerging language that combines the performance of low-level
languages like C++ with the ease of use of high-level languages like Python. It is gaining
traction in quantitative finance due to its speed and expressiveness.

The choice of programming language depends on various factors, including the specific
tasks at hand, the existing technology stack of the organization, computational performance
requirements, and personal preferences. Often, a combination of languages may be used
in different stages of the financial engineering process, from data analysis and modeling
to implementing and deploying algorithms. Regardless of the chosen language, a solid
understanding of financial concepts and quantitative methods is crucial for effective financial
engineering.

Python
Installation

To embark on your journey into the world of Python for Financial Engineering, the first
step is securing a suitable Python distribution for your machine. You can easily obtain
the latest version from the official Python website at www.python.org, where the most
current release, as of today, is Python 3.11.4.

For those using Ubuntu, many Linux distributions come pre-installed with Python. To
verify the version, simply open your terminal and enter python3 -V. This will display the
installed Python version on your system.
4 Programming language for financial engineering

An alternative distribution that’s highly regarded is Anaconda. Not only does it provide
Python, but it also includes the R language and a host of other essential packages. To
explore this option, visit https://www.anaconda.com/products/individual.

With your Python distribution in place, you’re well-equipped to begin your journey into the
realms of financial engineering, armed with the tools that will pave the way for a rich and
rewarding learning experience.

Integrated Development Environments (IDEs)

As you embark on your exploration of Python for Financial Engineering, the choice of an
Integrated Development Environment (IDE) will play a pivotal role in enhancing your coding
experience. IDEs provide a comprehensive suite of tools that streamline coding, debugging,
and project management, ultimately boosting your efficiency and productivity. Here are a
few noteworthy IDEs that are well-suited for your journey:

(1) Spyder: Catering to the needs of scientists and engineers, Spyder combines an IDE
with the features of a scientific environment. It boasts a code editor, IPython console,
variable explorer, and plotting capabilities, making it an apt choice for data analysis
and manipulation.
(2) PyCharm: Designed specifically for Python development, PyCharm offers a com-
prehensive set of tools that cater to both beginners and experts. Its intelligent code
completion, debugging capabilities, and support for scientific libraries make it an excellent
choice for financial engineering tasks.
(3) Jupyter Notebook: For interactive and data-centric work, Jupyter Notebook is a
standout choice. It enables you to create documents that blend code, visualizations,
and explanations in a single interface. This makes it perfect for documenting financial
analyses, modeling, and research.

Google Colab: Empowering Python for Financial Engineering in the Cloud

In your quest to master Python for Financial Engineering, another remarkable tool at your
disposal is Google Colab. This cloud-based platform offers an innovative way to develop,
collaborate, and execute Python code seamlessly. Let’s explore how Google Colab can
revolutionize your financial engineering journey:

(1) Cloud-Powered Accessibility: Google Colab operates entirely in the cloud, eliminat-
ing the need for local installations or configurations. This means you can access and
work on your financial engineering projects from any device with an internet connection.
(2) Pre-installed Libraries: Colab comes with a plethora of pre-installed libraries,
including essential ones for financial analysis such as pandas, NumPy, and Matplotlib.
Programming language for financial engineering 5

This enables you to dive straight into coding without worrying about setting up your
environment.
(3) Jupyter Notebook Integration: Google Colab integrates Jupyter Notebook, a
favored environment for interactive coding and documentation. This allows you to blend
code, visualizations, and explanations within a single document, perfect for showcasing
your financial models and analyses.
(4) Hardware Acceleration: Colab offers access to Graphics Processing Units (GPUs)
and Tensor Processing Units (TPUs) for accelerated computations. This can significantly
speed up resource-intensive tasks like training machine learning models or performing
complex financial simulations.
(5) Seamless Collaboration: You can easily share your Colab notebooks with others for
collaboration. Team members or mentors can provide feedback, and suggestions, or
even co-code in real-time, enhancing the learning experience.
(6) Data Integration: Colab allows you to import data directly from Google Drive, Google
Sheets, and various other sources. This integration simplifies data management and
ensures that your financial analyses are up-to-date.
(7) Python 3 Compatibility: Colab supports Python 3, ensuring compatibility with the
latest Python libraries and features.

Getting Started with Google Colab

(1) Access: Visit https://colab.research.google.com/ and sign in with your


Google account.
(2) Create a New Notebook: Click on “New Notebook” to open a Jupyter Notebook
interface.
(3) Coding and Execution: Write your Python code in code cells and execute them using
the ”Play” button. You can also add text, comments, and visualizations in markdown
cells.
(4) Saving and Sharing: Save your work in Google Drive or directly on GitHub. You can
also share your Colab notebook with others by generating a shareable link.
(5) Installing Libraries: If required, you can install additional libraries using pip com-
mands in code cells.

Visit the https://colab.research.google.com/drive/1gty8610iX0geXi5˙n˙


3Vu56sTl˙5uHqa?usp=sharing
6 Getting Started with Python

1.3 Getting Started with Python

Learining to Use Python: The Basic Aspects


Understanding Numbers in Python
[1]: # Entering a Number
100

[1]: 100

[2]: # Addition in Python


100+100

[2]: 200

[3]: # Substaracting in python


100-100

[3]: 0

[4]: # Multiplying in Python


100*100

[4]: 10000

[5]: # Dividing in Python


100/100

[5]: 1.0

[6]: # Square root in Python


(-1)**(0.5)

[6]: (6.123233995736766e-17+1j)

[7]: int(100/100)

[7]: 1

1
Getting Started with Python 7

[8]: float(100-100)

[8]: 0.0

[9]: # To a power of three


(2)**(3)

[9]: 8

[10]: # The square root


4**0.5

[10]: 2.0

Understanding Numbers In Python


[11]: #!pip install yfinance;

[12]: import yfinance as yf

[13]: bitcoin = yf.download('BTC-USD', start = '2022-01-01', end= '2023-01-01')

[*********************100%***********************] 1 of 1 completed

[14]: bitcoin.tail()

[14]: Open High Low Close \


Date
2022-12-27 16919.291016 16959.845703 16642.072266 16717.173828
2022-12-28 16716.400391 16768.169922 16497.556641 16552.572266
2022-12-29 16552.322266 16651.755859 16508.683594 16642.341797
2022-12-30 16641.330078 16643.427734 16408.474609 16602.585938
2022-12-31 16603.673828 16628.986328 16517.519531 16547.496094

Adj Close Volume


Date
2022-12-27 16717.173828 15748580239
2022-12-28 16552.572266 17005713920
2022-12-29 16642.341797 14472237479
2022-12-30 16602.585938 15929162910
2022-12-31 16547.496094 11239186456

[15]: bitcoin.tail()

[15]: Open High Low Close \


Date
2022-12-27 16919.291016 16959.845703 16642.072266 16717.173828

2
8 Getting Started with Python

2022-12-28 16716.400391 16768.169922 16497.556641 16552.572266


2022-12-29 16552.322266 16651.755859 16508.683594 16642.341797
2022-12-30 16641.330078 16643.427734 16408.474609 16602.585938
2022-12-31 16603.673828 16628.986328 16517.519531 16547.496094

Adj Close Volume


Date
2022-12-27 16717.173828 15748580239
2022-12-28 16552.572266 17005713920
2022-12-29 16642.341797 14472237479
2022-12-30 16602.585938 15929162910
2022-12-31 16547.496094 11239186456

[16]: type(bitcoin)

[16]: pandas.core.frame.DataFrame

[17]: bitcoinclos = bitcoin["Close"]

[18]: bitcoinclos

[18]: Date
2022-01-01 47686.812500
2022-01-02 47345.218750
2022-01-03 46458.117188
2022-01-04 45897.574219
2022-01-05 43569.003906
...
2022-12-27 16717.173828
2022-12-28 16552.572266
2022-12-29 16642.341797
2022-12-30 16602.585938
2022-12-31 16547.496094
Name: Close, Length: 365, dtype: float64

[19]: bitcoinclos[:1]

[19]: Date
2022-01-01 47686.8125
Name: Close, dtype: float64

[20]: # If the price of the bitoin in USD is needed to the power of three the process␣
,→is as follows

bitcoinclos[:1]**3

[20]: Date
2022-01-01 1.084413e+14

3
Getting Started with Python 9

Name: Close, dtype: float64

[21]: # And for square root:


bitcoinclos[:1]**0.5

[21]: Date
2022-01-01 218.373104
Name: Close, dtype: float64

Using Data Structures in Python


List
[22]: list1 = [1, 2, 3]

[23]: list1

[23]: [1, 2, 3]

[24]: list2 = [0.5, 1.3, 6]

[25]: list2

[25]: [0.5, 1.3, 6]

[26]: list3 = [1, 2, 3, 4, 5, "apple", "book", "b"]


list3

[26]: [1, 2, 3, 4, 5, 'apple', 'book', 'b']

[27]: # two of the most important index


spy = yf.download('^GSPC', start = '2023-01-01', end= '2023-02-01')['Close']
dow = yf.download('^DJI', start = '2023-01-01', end= '2023-02-01')['Close']

[*********************100%***********************] 1 of 1 completed
[*********************100%***********************] 1 of 1 completed

[28]: list4 = [spy[19:], dow[19:]]

[29]: list4

[29]: [Date
2023-01-31 4076.600098
Name: Close, dtype: float64,
Date
2023-01-31 34086.039062
Name: Close, dtype: float64]

4
10 Getting Started with Python

[30]: # Measuring a list


len(list1)

[30]: 3

[31]: len(list4)

[31]: 2

[32]: # Indexing and cutting a list


list3

[32]: [1, 2, 3, 4, 5, 'apple', 'book', 'b']

[33]: list3[6]

[33]: 'book'

[34]: list3[-1] # there can also be negative indexing, indicating the last element

[34]: 'b'

[35]: # Indexing can also be used to recall from a specific number onward by using the␣
,→colon (:).

list3[1:]

[35]: [2, 3, 4, 5, 'apple', 'book', 'b']

[36]: list4

[36]: [Date
2023-01-31 4076.600098
Name: Close, dtype: float64,
Date
2023-01-31 34086.039062
Name: Close, dtype: float64]

[37]: list5 = [spy[18:20], dow[18:19]]


list5

[37]: [Date
2023-01-30 4017.770020
2023-01-31 4076.600098
Name: Close, dtype: float64,
Date
2023-01-30 33717.089844
Name: Close, dtype: float64]

5
Getting Started with Python 11

[38]: # recalling up to a certain element


list3[:6]

[38]: [1, 2, 3, 4, 5, 'apple']

[39]: list6 = [spy[:5], dow[:5]]


list6

[39]: [Date
2023-01-03 3824.139893
2023-01-04 3852.969971
2023-01-05 3808.100098
2023-01-06 3895.080078
2023-01-09 3892.090088
Name: Close, dtype: float64,
Date
2023-01-03 33136.371094
2023-01-04 33269.769531
2023-01-05 32930.078125
2023-01-06 33630.609375
2023-01-09 33517.648438
Name: Close, dtype: float64]

[40]: # a list can be added with other list, this is an important feature when trying␣
,→to unite two arrays

l1 = [1, 2, 3]
l2 = ['a','b', 'c']
l12 = l1+ l2
l12

[40]: [1, 2, 3, 'a', 'b', 'c']

[41]: # duplicating lists


l2*3

[41]: ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c']

Appending Lists

[42]: list1

[42]: [1, 2, 3]

[43]: list1.append('Python')

[44]: list1

6
12 Getting Started with Python

[44]: [1, 2, 3, 'Python']

From List to Matrices


[45]: a_1 = [1, 2, 3]
a_2 = [4, 5, 6]
a_3 = [7, 8, 9]
matrix = [a_1, a_2, a_3]

[46]: matrix

[46]: [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

[47]: matrix[0]

[47]: [1, 2, 3]

[48]: matrix[0][0]

[48]: 1

From List to Dictionaries


[49]: # Example
dict1 = {'a': 1, 'b':2, 'c':3}

[50]: dict1['a']

[50]: 1

[51]: #A dictionary can handle different types of data


# Example
dict2 = {'Name':'Jone', 'Age':36}

[52]: dict2['Age']

[52]: 36

[53]: # dictionaries can perform arithmetic operations with data contained in the keys.
# Example
dict2['Age'] - 3

[53]: 33

[54]: dict2['Age']*2

[54]: 72

7
Getting Started with Python 13

Modifying a Dictionary

[55]: dict2['Age'] = dict2['Age'] + 3


dict2['Age']

[55]: 39

[56]: dict2

[56]: {'Name': 'Jone', 'Age': 39}

[57]: d = {} # empty dictionary


d['price'] = '$2500'
d['car'] = 'Peugeot'

[58]: d

[58]: {'price': '$2500', 'car': 'Peugeot'}

The DataFrame
[59]: stocks = yf.download(['gme', 'aapl', 'msft'], start = '2022-01-01', end =␣
,→'2023-02-01')['Close']

[*********************100%***********************] 3 of 3 completed

[60]: stocks.head()

[60]: AAPL GME MSFT


Date
2022-01-03 182.009995 38.209999 334.750000
2022-01-04 179.699997 37.227501 329.010010
2022-01-05 174.919998 32.342499 316.380005
2022-01-06 172.000000 32.757500 313.880005
2022-01-07 172.169998 35.154999 314.040009

To create a DataFrame a library named pandas is needed.


In this case pandas statnds for panel data wich is basically using data in columns and rows in order
to provide calculations.
It also provides a better visualization when using data which makes it easier to edit.
[61]: import pandas as pd

[62]: Data_Frame = pd.DataFrame({'Teff':[2500, 3500, 3700, 4500, 7500],


'meet_kg':[250, 450, 650, 800, 1000],
'house_rent':[1500, 3000, 4500, 6000,8000]})

8
14 Getting Started with Python

[63]: Data_Frame

[63]: Teff meet_kg house_rent


0 2500 250 1500
1 3500 450 3000
2 3700 650 4500
3 4500 800 6000
4 7500 1000 8000

[64]: Data_Frame['Teff']

[64]: 0 2500
1 3500
2 3700
3 4500
4 7500
Name: Teff, dtype: int64

[65]: Data_Frame['house_rent']

[65]: 0 1500
1 3000
2 4500
3 6000
4 8000
Name: house_rent, dtype: int64

[66]: # In DataFrames, arithmetic fucntions can be applied


Data_Frame['house_rent'].sum()

[66]: 23000

[67]: Data_Frame['house_rent'].mean()

[67]: 4600.0

[68]: Data_Frame['house_rent'].multiply(3)

[68]: 0 4500
1 9000
2 13500
3 18000
4 24000
Name: house_rent, dtype: int64

[69]: # The DataFrames can be altered to remove a column to create a new DataFrame␣
,→with the drop command

9
Getting Started with Python 15

Data_Frame.drop('Teff', axis = 1)

[69]: meet_kg house_rent


0 250 1500
1 450 3000
2 650 4500
3 800 6000
4 1000 8000

[70]: # let us go back to the stocks we downloaded


stocks['GME']

[70]: Date
2022-01-03 38.209999
2022-01-04 37.227501
2022-01-05 32.342499
2022-01-06 32.757500
2022-01-07 35.154999
...
2023-01-25 20.230000
2023-01-26 20.010000
2023-01-27 22.820000
2023-01-30 21.250000
2023-01-31 21.870001
Name: GME, Length: 271, dtype: float64

[71]: stocks['MSFT'].mean()

[71]: 266.5823243764054

[72]: # plotting is simple


stocks.plot();

10
16 Getting Started with Python

[73]: # Choosing unique values


stocks['AAPL'].unique()

[73]: array([182.00999451, 179.69999695, 174.91999817, 172. ,


172.16999817, 172.19000244, 175.08000183, 175.52999878,
173.07000732, 169.80000305, 166.22999573, 164.50999451,
162.41000366, 161.61999512, 159.77999878, 159.69000244,
159.22000122, 170.33000183, 174.77999878, 174.61000061,
175.83999634, 172.8999939 , 172.38999939, 171.66000366,
174.83000183, 176.27999878, 172.11999512, 168.63999939,
168.88000488, 172.78999329, 172.55000305, 167.30000305,
164.32000732, 160.07000732, 162.74000549, 164.8500061 ,
165.11999512, 163.19999695, 166.55999756, 163.16999817,
159.30000305, 157.44000244, 162.94999695, 158.52000427,
154.72999573, 150.61999512, 155.08999634, 159.58999634,
160.61999512, 163.97999573, 165.38000488, 168.82000732,
170.21000671, 174.07000732, 174.72000122, 175.6000061 ,
178.96000671, 177.77000427, 174.30999756, 178.44000244,
175.05999756, 171.83000183, 172.13999939, 170.08999634,
165.75 , 167.66000366, 170.3999939 , 165.28999329,
165.07000732, 167.3999939 , 167.22999573, 166.41999817,
161.78999329, 162.88000488, 156.80000305, 156.57000732,
163.63999939, 157.6499939 , 157.96000671, 159.47999573,
166.02000427, 156.77000427, 157.27999878, 152.05999756,

11
Getting Started with Python 17

154.50999451, 146.5 , 142.55999756, 147.11000061,


145.53999329, 149.24000549, 140.82000732, 137.3500061 ,
137.58999634, 143.11000061, 140.36000061, 140.52000427,
143.77999878, 149.63999939, 148.83999634, 148.71000671,
151.21000671, 145.38000488, 146.13999939, 147.96000671,
142.63999939, 137.13000488, 131.88000488, 132.75999451,
135.42999268, 130.05999756, 131.55999756, 135.86999512,
135.3500061 , 138.27000427, 141.66000366, 137.44000244,
139.22999573, 136.72000122, 138.92999268, 141.55999756,
142.91999817, 146.3500061 , 147.03999329, 144.86999512,
145.86000061, 145.49000549, 148.47000122, 150.16999817,
147.07000732, 151. , 153.03999329, 155.3500061 ,
154.08999634, 152.94999695, 151.6000061 , 156.78999329,
157.3500061 , 162.50999451, 161.50999451, 160.00999451,
166.13000488, 165.80999756, 165.3500061 , 164.86999512,
164.91999817, 169.24000549, 168.49000549, 172.1000061 ,
173.19000244, 173.02999878, 174.55000305, 174.1499939 ,
171.52000427, 167.57000732, 167.52999878, 170.02999878,
163.61999512, 161.38000488, 158.91000366, 157.22000122,
155.80999756, 154.52999878, 155.96000671, 154.46000671,
157.36999512, 163.42999268, 153.83999634, 155.30999756,
152.36999512, 150.69999695, 154.47999573, 156.8999939 ,
153.72000122, 152.74000549, 150.42999268, 150.77000427,
151.75999451, 149.83999634, 142.47999573, 138.19999695,
142.44999695, 146.1000061 , 146.3999939 , 145.42999268,
140.08999634, 140.41999817, 138.97999573, 138.33999634,
142.99000549, 138.38000488, 142.41000366, 143.75 ,
143.86000061, 143.38999939, 147.27000427, 149.44999695,
152.33999634, 149.3500061 , 144.80000305, 155.74000549,
153.33999634, 150.6499939 , 145.02999878, 138.88000488,
138.91999817, 139.5 , 134.86999512, 146.86999512,
149.69999695, 148.27999878, 150.03999329, 148.78999329,
150.72000122, 151.28999329, 148.00999451, 150.17999268,
151.07000732, 148.11000061, 144.22000122, 141.16999817,
148.02999878, 148.30999756, 147.80999756, 146.63000488,
142.91000366, 140.94000244, 142.6499939 , 142.16000366,
144.49000549, 145.47000122, 143.21000671, 136.5 ,
134.50999451, 132.36999512, 132.30000305, 135.44999695,
132.22999573, 131.86000061, 130.02999878, 126.04000092,
129.61000061, 129.92999268, 125.06999969, 126.36000061,
125.01999664, 129.61999512, 130.1499939 , 130.72999573,
133.49000549, 133.41000366, 134.75999451, 135.94000244,
135.21000671, 135.27000427, 137.86999512, 141.11000061,
142.52999878, 141.86000061, 143.96000671, 145.92999268,
143. , 144.28999329])

12
18 Getting Started with Python

[74]: # Using sum with a column


stocks['MSFT'].sum()

[74]: 72243.80990600586

[75]: # Using mean with a column


stocks['MSFT'].mean()

[75]: 266.5823243764054

[76]: # Using multiply with a column


stocks['MSFT'].multiply(5)

[76]: Date
2022-01-03 1673.750000
2022-01-04 1645.050049
2022-01-05 1581.900024
2022-01-06 1569.400024
2022-01-07 1570.200043
...
2023-01-25 1203.050003
2023-01-26 1240.000000
2023-01-27 1240.800018
2023-01-30 1213.550034
2023-01-31 1239.049988
Name: MSFT, Length: 271, dtype: float64

[77]: # Using drop to remove a column


stocks.drop('MSFT', axis = 1)

[77]: AAPL GME


Date
2022-01-03 182.009995 38.209999
2022-01-04 179.699997 37.227501
2022-01-05 174.919998 32.342499
2022-01-06 172.000000 32.757500
2022-01-07 172.169998 35.154999
... ... ...
2023-01-25 141.860001 20.230000
2023-01-26 143.960007 20.010000
2023-01-27 145.929993 22.820000
2023-01-30 143.000000 21.250000
2023-01-31 144.289993 21.870001

[271 rows x 2 columns]

13
Getting Started with Python 19

[78]: # Sort values


stocks.sort_values('GME')

[78]: AAPL GME MSFT


Date
2023-01-05 125.019997 16.219999 222.309998
2023-01-09 130.149994 16.379999 227.119995
2023-01-06 129.619995 16.459999 224.929993
2023-01-03 125.070000 17.200001 239.580002
2023-01-04 126.360001 17.320000 229.100006
... ... ... ...
2022-08-16 173.029999 42.189999 292.709991
2022-04-04 178.440002 42.682499 314.970001
2022-08-08 164.869995 43.450001 280.320007
2022-03-29 178.960007 44.974998 315.410004
2022-03-28 175.600006 47.397499 310.700012

[271 rows x 3 columns]

[79]: # Using a Boolean


stocks > 140

[79]: AAPL GME MSFT


Date
2022-01-03 True False True
2022-01-04 True False True
2022-01-05 True False True
2022-01-06 True False True
2022-01-07 True False True
... ... ... ...
2023-01-25 True False True
2023-01-26 True False True
2023-01-27 True False True
2023-01-30 True False True
2023-01-31 True False True

[271 rows x 3 columns]

[80]: # Boolean, Loops and Others Features


1>2

[80]: False

[81]: 1<2

[81]: True

14
20 Getting Started with Python

[82]: 2==2

[82]: True

[83]: 1<2<3

[83]: True

[84]: 1 < 10.4 < 3

[84]: False

[85]: 3 > 2 and 3 < 4

[85]: True

[86]: # If, Else and Elif in Python


if True:
print('It is correct')

It is correct

[87]: a = False

if a:
print('a is correct')
else:
print('anything but correct')

anything but correct

[88]: a = True

if a:
print('a is correct')
else:
print('anything but correct')

a is correct

[89]: # For Loop


m = [1, 2 , 3 , 5, 6]

[90]: for x in m:
print(x)

1
2

15
Getting Started with Python 21

3
5
6

[91]: dictionary = {'k1': 1, 'k2':2, 'k3':3}


for element in dictionary:
print(element)

k1
k2
k3

[92]: for k, v in dictionary.items():


print(k)
print(v)

k1
1
k2
2
k3
3
When creating a portfolio, the method of a for loop will be used to group different tickers. The
process is as follows
[93]: import datetime
start = datetime.datetime(2022, 1, 1)
end = datetime.datetime(2023, 1, 1)

tickers = ['NFLX' , 'DIS', 'TSLA', 'AMZN']

stocks = pd.DataFrame()
for x in tickers:
stocks[x] = yf.download(x, start, end)['Close']

[*********************100%***********************] 1 of 1 completed
[*********************100%***********************] 1 of 1 completed
[*********************100%***********************] 1 of 1 completed
[*********************100%***********************] 1 of 1 completed

[94]: # The While Loop

a = 0
while a < 10:
print("a is", a)
a+=1
else:

16
22 Getting Started with Python

print("end")

a is 0
a is 1
a is 2
a is 3
a is 4
a is 5
a is 6
a is 7
a is 8
a is 9
end
To work with while loops it is important to know 3 commands: 1. break, 2. continue and 3. pass
Break allows us to close the loop that is running Continue allows the user to do more iteration and
Pass allows us to leave the loop without effect

List Comprehension
The comprehensions of lists allow us to easily and clearly make a list with a different notation and
that this already includes a loop, specifically a for loop.
[95]: m = []
for letter in "word":
m.append(letter)
print(m)

['w', 'o', 'r', 'd']

[96]: # the above can be developed in a simple manner as follows:


n = [word for word in "word"]
print(n)

['w', 'o', 'r', 'd']

[97]: #
list = [x**2 for x in range(0, 11)]
print(list)

[0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100]

Excel Integration
[1]: # import libraries
import numpy as np
import pandas as pd
import xlrd, xlwt # works only with Microsof Excel 97/2000/XP/2000, OpenOffice.
,→org Calc, and Gnumeric (drowback)

17
Getting Started with Python 23

import xlsxwriter #---> generate spreedsheet files in the current .xslx format

Generating Workbooks(.xls)

[2]: wb = xlwt.Workbook() # generating a workbook

[3]: wb

[3]: <xlwt.Workbook.Workbook at 0x7fc9d94bbeb0>

[4]: # add one or multiple sheets to the Workbook object:


wb.add_sheet('first_sheet', cell_overwrite_ok=True)

[4]: <xlwt.Worksheet.Worksheet at 0x7fc986703700>

[5]: # we now have one worksheet object, which has index number 0
wb.get_active_sheet()

[5]: 0

[8]: ws_1 = wb.get_sheet(0)

[7]: ws_1

[7]: <xlwt.Worksheet.Worksheet at 0x7fc986703700>

[9]: ws_2 = wb.add_sheet('second_sheet')

[10]: # both worksheet objects are still empty. Let us generate a NumPy ndarray object␣
,→containing some numbers:

data = np.arange(1, 65)


data

[10]: array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64])

[12]: data =data.reshape((8, 8))


data

[12]: array([[ 1, 2, 3, 4, 5, 6, 7, 8],


[ 9, 10, 11, 12, 13, 14, 15, 16],
[17, 18, 19, 20, 21, 22, 23, 24],
[25, 26, 27, 28, 29, 30, 31, 32],
[33, 34, 35, 36, 37, 38, 39, 40],
[41, 42, 43, 44, 45, 46, 47, 48],

18
24 Getting Started with Python

[49, 50, 51, 52, 53, 54, 55, 56],


[57, 58, 59, 60, 61, 62, 63, 64]])

[14]: data.shape

[14]: (8, 8)

[107]: # Using the write method and providing row and column information (with␣
,→zero-based indexing),

# data is easily written to a certain worksheet:

[13]: ws_1.write(0, 0, 100) # write 100 in cell "A1"

#In the above way the sample data can be written “in bulk” to the two Worksheet objects:
for c in range(data.shape[0]):

for r in range(data.shape[1]):

ws_1.write(r, c, data[c, r])


ws_2.write(r, c, data[r, c])

Generating Workbooks (.xslx)

[ ]: wb = xlsxwriter.Workbook('workbook.xlsx')

[ ]: ws_1 = wb.add_worksheet('first_sheet')
ws_2 = wb.add_worksheet('second_sheet')

[19]: # wrie data the the Worksheet objects:


for c in range(data.shape[0]):
for r in range(data.shape[1]):
ws_1.write(r, c, data[c, r])
ws_2.write(r, c, data[r, c])

[20]: # close the Workbook file object:


wb.close()

[113]: ll workbook.xlsx

-rw-rw-r-- 1 tamirat 6050 Apr 19 22:34 workbook.xlsx


If everythigh went well, the file opend in Microsoft Excel should look like the figure below:

19
Getting Started with Python 25

Xlsxwriter has many more options to generate Workbook objects, for example with charts
[114]: wb = xlsxwriter.Workbook('chart.xlsx')

[115]: ws = wb.add_worksheet()

[116]: # write cumsum of random values in first column


values = np.random.standard_normal(15).cumsum()
ws.write_column('A1', values)

[116]: 0

[117]: # create a new chart object


chart = wb.add_chart({'type' : 'line'})

[118]: # add a series to the chart


chart.add_series({'values': '=Sheet1!$A$1:$A$15',
'marker': {'type': 'diamond'},})
# series with markers (here: diamond)

[119]: # insert the chart


ws.insert_chart('C1', chart)

[119]: 0

[120]: wb.close()

The resulting spreadsheet file is shown as a screenshot in figure:

20
26 Getting Started with Python

Reading from Workbooks


The library xlrd is responsible for reading data from spreedsheet files (i.e., workbooks):

[121]: book = xlrd.open_workbook('workbook.xlsx')

[122]: book

[122]: <xlrd.book.Book at 0x7f448c666410>

[123]: # names of all work sheet


book.sheet_names()

[123]: ['first_sheet', 'second_sheet']

[124]: # accessing via their names or index values:


sheet_1 = book.sheet_by_name('first_sheet')
sheet_2 = book.sheet_by_index(1)
sheet_1

[124]: <xlrd.sheet.Sheet at 0x7f448c665810>

[125]: sheet_2.name

21
Getting Started with Python 27

[125]: 'second_sheet'

[126]: sheet_1.ncols, sheet_1.nrows

[126]: (8, 8)

[127]: # accessing a single cell


cl = sheet_1.cell(0, 0)

[128]: cl.value

[128]: 1.0

[129]: # accessing the whole rows


sheet_2.row(3)

[129]: [number:25.0,
number:26.0,
number:27.0,
number:28.0,
number:29.0,
number:30.0,
number:31.0,
number:32.0]

[130]: sheet_2.col(3)

[130]: [number:4.0,
number:12.0,
number:20.0,
number:28.0,
number:36.0,
number:44.0,
number:52.0,
number:60.0]

[131]: sheet_1.col_values(3, start_rowx=3, end_rowx=7)

[131]: [28.0, 29.0, 30.0, 31.0]

[132]: sheet_1.row_values(3, start_colx=3, end_colx=7)

[132]: [28.0, 36.0, 44.0, 52.0]

[ ]: for c in range(sheet_1.ncols):
for r in range(sheet_1.nrows):
print('%i' % sheet_1.cell(r, c).value),

22
28 Getting Started with Python

print()

Using OpenPyxl
This library allows us to both create spreedsheet files and read form them.
[134]: import openpyxl as oxl

[135]: wb = oxl.Workbook()

[136]: ws = wb.create_sheet(index=0, title='oxl_sheet')

[137]: for c in range(data.shape[0]):


for r in range(data.shape[1]):
ws.cell(row=r+1, column=c+1).value = data[c,r]
# creates a Cell object and assigns a value

[138]: wb.save('oxl_book.xlsx')

[139]: # With OpenPyxl, you can also read workbooks:


wb = oxl.load_workbook('oxl_book.xlsx')

[140]: # single cells are easily accessed via their cell names:
ws = wb.active

[141]: cell = ws['B4']


cell.column

[141]: 2

[142]: cell.row

[142]: 4

[143]: cell.value

[143]: 12

[144]: # access cell ranges as in Excel


ws['B1':'B4']

[144]: ((<Cell 'oxl_sheet'.B1>,),


(<Cell 'oxl_sheet'.B2>,),
(<Cell 'oxl_sheet'.B3>,),
(<Cell 'oxl_sheet'.B4>,))

23
Getting Started with Python 29

[145]: for cell in ws['B1':'B4']:


print(cell[0].value)

9
10
11
12

24
30 Getting Started with Python

For more reading please refer (Hilpisch, 2014, 2018; Lewinson, 2020).
Chapter 2

Introduction to Stochastic Calculus


and Martingales

In this chapter, we explore the essential mathematical tools for handling randomness and
uncertainty, laying the groundwork for advanced topics in probability and quantitative
finance. Stochastic calculus and martingales are key pillars of this exploration, enabling us
to model dynamic processes and understand fundamental principles of probability.

2.1 Simple mathematical functions for financial engin-


eering

Learning Outcomes
By the end of this section, you will be able to:
• Describe positive mathematical functions for finance.
• Explain the importance of positive part function, maximum function and stop-loss
function in finance
• Work with positive part, maximum and stop-loss function.

31
32 Simple mathematical functions for financial engineering

Positive part function

We define the positive part function by


(
0 if x ≤ 0,
(x)+ = max {x, 0} = (2.1)
x if x > 0.

In simpler terms, it returns 0 if x is less than or equal to 0, and it returns x if x is greater


than 0. Figure 2.2 is an illustration of a positive part function.

Plot of Positive Part Function


10 max{x, 0}

6
y

0
−10.0 −7.5 −5.0 −2.5 0.0 2.5 5.0 7.5 10.0
x

Figure 2.1: Positive part function

This function holds significant importance in describing payoff functions for derivatives,
particularly in scenarios where the payoff is contingent on positive asset prices.

Maximum function

For a fixed real number a, we consider the maximum function x 7→ max{x, a}, defined
by (
a if x ≤ a,
max {x, a} = (2.2)
x if x > a.

When working with call and put options, one very important property of the maximum
Simple mathematical functions for financial engineering 33

function is its behavior with respect to translations. For any real number b, we have

max{x, a} + b = max{x + b, a + b}

or, equivalently,
max{x, a} − b = max{x − b, a − b}.

Stop-loss function

For a fixed real number a, we will call the function x 7→ (x − a)+ , the stop-loss
function at a. From the definition of the positive part function, we can write
(
0 if x ≤ a,
(x − a)+ = max {x − a, 0} = (2.3)
x−a if x > a.

The reversed version of the stop-loss function, for a fixed real number a, we have
(
a − x if x ≤ a,
(a − x)+ = max {a − x, 0} =
0 if x > a.

Using the properties of the maximum function, we get that, for any other real number b,

(x − a)+ + b = max{x − a + b, b}

and, in particular,
(x − a)+ + a = max{x, a}

Taking the difference of a stop-loss function with its reversed version, we get the following
simple relationship:
(x − a)+ − (a − x)+ = x − a.
34 Review of Basic Probability

Indicator function

For a fixed real number a, we define the indicator function of {x > a} by


(
0 if x ≤ a,
x 7→ 1{x>a} =
1 if x > a.

In general, for any interval (a, b), we can define


(
0 if x ∈
/ (a, b),
x 7→ 1(a,b) =
1 if x ∈ (a, b).

2.2 Review of Basic Probability

Learning Outcomes
By the end of this section, you will be able to:
• Describe random variables commonly used in finance.
• List different kinds of distribution functions.
• Compute probabilities using Python.

Definition 2.1 (Random Varaible). A random variable X = X(ω) is a real-valued


function defined on a sample space Ω.

Random variables play a significant role in finance by modeling uncertain outcomes and
facilitating the analysis of various financial scenarios. Here are some examples of random
variables commonly used in finance:

Example 2.2.1

• Stock Price Changes (Returns): In finance, stock prices are often modeled as
random variables. The daily or periodic percentage changes in stock prices, known
as returns, are essential for risk analysis and portfolio management.
• Interest Rates: Interest rates are critical in financial markets. The movement
of interest rates can have a significant impact on bond prices, option values, and
other financial instruments.
• Asset Prices: Asset prices, including stocks, bonds, commodities, and real estate,
Review of Basic Probability 35

are subject to fluctuations due to market dynamics and economic factors.


• Credit Defaults: In credit risk analysis, random variables are used to model
the probability of default by borrowers. This is crucial for evaluating the risk
associated with lending and investing activities.
• Foreign Exchange Rates: Exchange rates between currencies are inherently
uncertain and subject to market forces.
• Option Prices: Option pricing involves modeling the value of options based on
the underlying asset’s price, strike price, time to expiration, and volatility.
• Portfolio Returns: The returns of an investment portfolio are influenced by the
returns of its constituent assets.
• Credit Spreads: Credit spreads represent the difference in yield between a
risk-free bond and a riskier bond. Random variables help model the uncertainty
in credit spreads due to changes in credit risk perception.
• Economic Indicators: Economic indicators such as GDP growth, inflation rates,
and unemployment rates are often modeled as random variables. These variables
have a substantial impact on financial markets.

In all these examples, random variables help capture the inherent uncertainty and variability
in financial markets and economic conditions. They are essential tools for risk assessment,
investment analysis, and decision-making in the field of finance.

For a given random variable X, the following fundamental questions need to be addressed:

(1) What are the most probable values in X(Ω)?


(2) Around what values is the concentration?
(3) What is the extent of their spread?

To approach these problems, one first collects “good” subsets of Ω, the events, in a class F,
say (σ−algebra or σ− field).

When dealing with a share price X, it’s important not only for the event {ω : X(ω) = c} to
be a part of the set F, but also various other events like {ω : a < X(ω) ≤ b}, {ω : b < X(ω)},
and {ω : X(ω) ≤ a}. These events hold relevance in different situations. We desire that basic
operations such as intersection (∩), union (∪), and complement (c ) on the events within F
do not take us outside the scope of this class. This concept aligns with the intuitive essence
of a σ-algebra F. It ensures that the collection of events possesses the necessary properties
to comprehensively represent and manipulate probabilities and outcomes associated with
the underlying random variable. The formal definition is given as follows.
36 Review of Basic Probability

Definition 2.2 (σ−algebra). A sigma-algebra (or σ-algebra) on a set Ω is a collection


of subsets of Ω, denoted as F, that satisfies the following three properties:
(1) The sample space Ω belongs to F: Ω ∈ F.
(2) If A is in F, then its complement Ac is also in F: If A ∈ F, then Ac ∈ F.
(3) F is closed under countable unions: If {An } is a countable collection of sets in
F (An ∈ F for all n), then their union ∪(An ) is also in F: ∪(An ) ∈ F.

Example 2.2.2
Suppose you are modeling the outcome of a fair coin toss experiment. The sample
space Ω consists of two possible outcomes: Heads (H), Tails (T ). You want to define
a sigma-algebra F on Ω. You can define F as follows:

F = {∅, Ω, {H}, {T }}

Here, F contains the empty set ∅, the sample space Ω, and the sets containing
only Heads {H} and only Tails {T }. This collection satisfies the properties of a
sigma-algebra.

Example 2.2.3
Consider a financial scenario where you are analyzing the daily movement of a stock.
The sample space Ω represents three possible outcomes: “Stock Price Up” (U ), “Stock
Price Down” (D), and “No Change” (N ). The sample space: Ω = {U, D, N }.
Now define a σ−algebra as F on Ω:

F = {∅, {U, D, N }, {U }, {D}, {N }, {U, D}, {U, N }, {D, N }}.

Explanation:
(1) The empty set ∅ and the entire sample space {U, D, N } are included.
(2) All individual outcomes, {U }, {D}, and {N }, are in F.
(3) Combinations of two outcomes, such as {U, D}, {U, N }, and {D, N }, are also
included.
This F represents a sigma-algebra for the stock price movement scenario. It includes
various subsets of the sample space Ω and satisfies the sigma-algebra properties. It
can be used to model and analyze different events related to stock price movements.
Review of Basic Probability 37

Definition 2.3 (Propability measure). A probability measure on the class F of


the events is: to each event A ∈ F it assigns a number P (A) ∈ [0, 1].

In probability theory, we rely on key properties to understand events in a sample space Ω.


These properties are controlled by the sigma-algebra F. When dealing with events A and B
from F, two critical principles come to the fore:

(1) The principle of inclusion and exclusion states that the probability of the union of events
A and B can be calculated by adding their individual probabilities and subtracting the
probability of their intersection:

P (A ∪ B) = P (A) + P (B) − P (A ∩ B).

(2) Should events A and B be distinct and non-overlapping, this principle simplifies:

P (A ∪ B) = P (A) + P (B).

Further, our exploration reveals additional insights:

• The complement of event A, denoted as Ac , has a probability that complements its


counterpart:
P (Ac ) = 1 − P (A).

• The sample space, P (Ω) equates to certainty, rendering a probability of 1.


• Conversely, the probability of an empty set ∅ is null:

P (∅) = 0.

These properties together provide the foundation for creating probability distributions,
figuring out how likely events are, and dealing with uncertainty in an organized and
knowledgeable way.

Distribution function
The main use of distribution functions in financial engineering is to understand and manage
risk. These functions help us calculate the likelihood of different financial outcomes,
which is crucial for pricing financial products like options, managing investment portfolios,
and assessing potential losses in various scenarios. Essentially, they’re like roadmaps for
navigating uncertainty in finance.
38 Review of Basic Probability

Definition 2.4 (Distribution function(Cumulative distribution function-CDF)). The


collection of the probabilities

FX (x) = P (X ≤ x) = P ({ω : X(ω) ≤ x}), x ∈ R = (−∞, ∞),

is the distribution function FX of X.


The collection of the probabilities

PX (B) = P (X ∈ B) = P ({ω : X(ω) ∈ B})

for suitable subsets B ⊂ R is the distribution of X.

Most continuous distributions of interest have a density fX :


Z x
FX (x) = fX (y)dy, x ∈ R,
−∞

where Z ∞
fX (x) ≥ 0 for every x ∈ R and fX (y)dy = 1.
−∞
Review of Basic Probability 39

Definition 2.5 (Expectation and Variance). The expectation or mean value of a


random variable X with density fX is given by
Z ∞
µX = EX = xfX (x)dx.
−∞

The variance of X is defined as


Z ∞
2
σX = var(X) = (x − µX )2 fX (x)dx.
−∞

The lth moment of X for l ∈ N is defined as


Z ∞
l
E(X ) = xl fX (x)dx.
−∞

For a real-valued function g the expectation of g(X) is given by


Z ∞
Eg(X) = g(x)fX (x)dx.
−∞

The expectation or mean value of a discrete random variable X with probabilities


pk = P (X = xk ) is given by


X
µX = EX = xk pk .
k=1

The variance of X is defined as



X
2
σX = Var(X) = (xk − µX )2 pk .
k=1

The lth moment of X for l ∈ N is defined as



X
E(X l ) = xlk pk .
k=1

For a real-valued function g the expectation of g(X) is given by


X
Eg(X) = g(xk )pk .
k=1
40 Review of Basic Probability

2.2.1 Binomial Random Varaibles


A binomial random variable is a discrete random variable that represents the number of
successes in a fixed number of independent Bernoulli trials, where each trial has the same
probability of success. It is characterized by two parameters: the number of trials n and the
probability of success p.

Definition 2.6. Let X be a binomial random variable representing the number of


successes in n independent Bernoulli trials, each with a probability of success p. The
probability mass function (PMF) of X is given by:
 
n k
P (X = k) = p (1 − p)n−k , k = 0, 1, 2, . . . , n,
k

n

where k represents the binomial coefficient, which is the number of ways to choose
k successes from n trials.

The mean and variance of the binomial distribution is given by:

E[X] = np
Var(X) = np(1 − p).

Example 2.2.4
Let’s consider an example of a binomial random variable in finance. Imagine an
investor who is considering investing in a stock. Based on historical data, the
probability of the stock price increasing on any given day is 0.6, and the probability
of it decreasing is 0.4. The investor plans to monitor the stock’s performance over a
week (5 trading days).
In this scenario, the investor’s success can be defined as the stock price increasing on
a particular day, and failure as the stock price decreasing. The investor is interested
in knowing the probability of having 3 successful trading days out of the 5 trading
days.
Here, n = 5 (number of trials) and p = 0.6 (probability of success). The probability of
having k = 3 successful trading days can be calculated using the binomial probability
mass function:
 
5
P (X = 3) = × 0.63 × 0.42 ≈ 0.3456.
3
Review of Basic Probability 41

This probability indicates the likelihood of the investor experiencing 3 successful


trading days out of the 5, based on historical probabilities.

Binomial random variables are commonly used in finance to model scenarios where outcomes
can be classified as successes or failures, such as predicting the number of profitable trading
days or the likelihood of loan defaults.

2.2.2 The Poisson Distribution


The Poisson distribution is a discrete probability distribution that models the number
of events occurring in a fixed interval of time or space, given a known average rate of
occurrence. It is widely used to model rare and random events that occur independently
and at a constant average rate.

Definition 2.7. Let X be a random variable representing the number of events


occurring in a fixed interval. The Poisson distribution is defined by the probability
mass function (PMF):

e−λ λk
P (X = k) = , k = 0, 1, 2, . . . ,
k!

where λ is the average rate of events in the interval.

The mean (µ) and variance (σ 2 ) of a Poisson distribution are both equal to λ: µ = λ and
σ 2 = λ. Figure 2.2 shows an example of Poisson distribution for λ = 3.

The Poisson distribution is memory-less, meaning that the probability of an event occurring
in a future interval is not influenced by past events.

Example 2.2.5
Consider a scenario in finance where you’re analyzing the number of customer arrivals
at a bank during a specific hour of the day. On average, 10 customers arrive at the
bank per hour. You can use the Poisson distribution to model the probability of
various numbers of customer arrivals during that hour.
Let X represent the random variable denoting the number of customer arrivals in an
hour. With an average rate of λ = 10, you can calculate probabilities for different
scenarios:
(i) P (X = 5): Probability of exactly 5 customer arrivals.
42 Review of Basic Probability

Poisson Distribution (λ=3)


Poisson PMF

0.20

Probability 0.15

0.10

0.05

0.00
0 2 4 6 8 10 12 14
Number of Events

Figure 2.2: An example of PMF for Poisson distribution for λ = 3

(ii) P (X ≤ 8): Probability of 8 or fewer customer arrivals.


(iii) P (X > 12): Probability of more than 12 customer arrivals.

Using the Poisson distribution formula, you can calculate these probabilities and gain insights
into the likelihood of various levels of customer activity during the specified hour.

Listing 2.1: Python functions for computing probablity in poissond distribution


1 im po rt s c i p y . s t a t s a s s t a t s
2

3 d e f p o i s s o n p r o b ( k , lambda parameter ) :
4 p = s t a t s . p o i s s o n . pmf ( k , lambda parameter )
5 return p
6
7 d e f p o i s s o n p r o p i n t e r v a ( s t a r t , end , lambda parameter ) :
8 prob int = 0.0
9 f o r k i n r a n g e ( s t a r t , end+1) :
10 p = p o i s s o n p r o b ( k , lambda parameter )
11 p r o b i n t += p
12 return prob int

Using the functions in Listing 2.1,

2 8# Example 1 . 5 ( i )
3 lambda parameter = 10 # Adjust t h i s p a r a m e t e r a s needed
Review of Basic Probability 43

4 k = 5 # The number o f e v e n t s you want t o c a l c u l a t e t h e ...


probability for
5
6 prob1 = p o i s s o n p r o b ( k , lambda parameter )
7 p r i n t ( f 'P(X = {k } ) = { prob1 : . 4 f } ' )
8
9 # Example 1 . 5 ( i i )
10 # P(X≤ 8 )
11 start = 0
12 end = 8
13 prob2 = p o i s s o n p r o p i n t e r v a ( s t a r t , end , lambda parameter )
14 p r i n t ( f 'P( { s t a r t } ≤ X ≤ { end } ) = { prob2 : . 4 f } ' )
15

16 # Example 1 . 5 ( i i i )
17 # P(X>12) = 1 - P(X≤ 1 2 )
18 end = 12
19 prob3 = 1 - p o i s s o n p r o p i n t e r v a ( s t a r t , end , lambda parameter )
20 p r i n t ( f 'P( { s t a r t } ≤ X ≤ { end } ) = { prob3 : . 4 f } ' )

One gets the following results:

1 P(X = 5 ) = 0 . 0 3 7 8
2 P( 0 ≤ X ≤ 8 ) = 0 . 3 3 2 8
3 P( 0 ≤ X ≤ 1 2 ) = 0 . 2 0 8 4

In finance, the Poisson distribution is used in various contexts, such as modeling the number
of trades executed in a given time interval, the occurrence of credit defaults, or the frequency
of insurance claims. Its ability to capture random and infrequent events makes it a valuable
tool for risk assessment and decision-making.

The Uniform Distribution

The Uniform distribution is a continuous probability distribution that describes a random


variable with outcomes that are equally likely within a specified interval. In other words, the
probability of any outcome occurring within the interval is constant, resulting in a constant
probability density function (PDF) across the interval.

Definition 2.8. Let X be a continuous random variable following a Uniform distri-


bution over the interval [a, b]. The probability density function (PDF) of X is defined
as:
1
fX (x) = , a ≤ x ≤ b.
b−a

a+b
The mean (µ) of a Uniform distribution is 2 .
44 Review of Basic Probability

(b−a)2
The variance (σ 2 ) of a Uniform distribution is 12 .

Example 2.2.6
Consider an example in finance where you’re analyzing the potential price movement
of a commodity within a certain price range. Let’s say the commodity’s price is
expected to fluctuate between $50 and $100. You can model this situation using a
Uniform distribution.
Let X represent the random variable denoting the commodity’s price. With a = 50
and b = 100, the probability density function (PDF) for the Uniform distribution in
this context is:
1 1
fX (x) = = , 50 ≤ x ≤ 100.
100 − 50 50
This means that any price within the interval [50, 100] is equally likely, and the
distribution is uniform across this range.

In finance, the Uniform distribution can be used to model scenarios where outcomes have
an equal likelihood of occurring within a specified range. For instance, it might be used to
model the distribution of possible returns for investment, assuming that returns are equally
likely across a certain range. However, the Uniform distribution may not always be suitable
for capturing more complex financial scenarios with varying probabilities of outcomes.

2.2.3 The Normal Distribution


The Normal distribution, also known as the Gaussian distribution, is one of the most
important and widely used probability distributions in statistics and probability theory. It’s
often referred to as the “bell curve” due to its characteristic symmetric and bell-shaped
curve when graphed, see Figure 2.3.

Definition 2.9. The Normal distribution N(µ, σ 2 ) is defined by its probability density
function (PDF) given by the equation:

1 (x−µ)2
fX (x) = √ e− 2σ 2 , −∞ < x < ∞,
2πσ 2

where:
• µ is the mean (average) of the distribution.
• σ is the standard deviation, which measures the spread of the distribution.

Properties:
Review of Basic Probability 45

Normal Distribution
0.40 Normal PDF
0.35
0.30
0.25
0.20
PDF

0.15
0.10
0.05
0.00
−3 −2 −1 0 1 2 3
X

Figure 2.3: A typical plot of normal distribution, µ = 0, σ 2 = 1(standard normal distribution)

• The mean (µ) is also the median and mode of the Normal distribution.
• The distribution is symmetric around its mean, with the peak at the mean.
• About 68% of the data falls within one standard deviation from the mean, 95% within
two standard deviations, and 99.7% within three standard deviations (Empirical Rule).

Example 2.2.7
The Normal distribution is extensively used in finance due to its applicability in
modeling various financial phenomena. One common example is modeling stock price
movements. While actual stock price movements can be complex and involve various
factors, the Central Limit Theorem often justifies using the Normal distribution for
modeling returns.
Let’s say you’re interested in modeling the daily returns of a stock. You collect
historical data and find that the average daily return is 0.1% and the standard
deviation is 1%. You can model the distribution of daily returns using the normal
distribution with µ = 0.001 and σ = 0.01:

(x−0.001)2
1 −
fX (x) = p e 2(0.01)2 , −∞ < x < ∞.
2π(0.01)2

By using the normal distribution, you can estimate probabilities of certain ranges
of returns, assess the likelihood of extreme events, and make informed investment
decisions based on statistical analysis.
46 Review of Basic Probability

(i) Calculate the probability of positive returns next day: P (X > 0) = 1 − P (X ≤ 0)


(ii) What is the probability that the stock’s return will be negative by more than 2%
next day: P (X < −0.02).

For this calculation you may use the following Python function.

Listing 2.2: Python functions for computing probablity based on normal distribution
1

2 im po rt s c i p y . s t a t s a s s t a t s
3
4 d e f n o r m a l p r o b ( mean , s t d d e v , x ) :
5 prob = s t a t s . norm . c d f ( x , l o c=mean , s c a l e=s t d d e v )
6 r e t u r n prob
7

8 # Exmaple 1 . 7
9 mean = 0 . 0 0 1 # Mean ( a v e r a g e ) o f t h e normal d i s t r i b u t i o n
10 std dev = 0.01 # Standard d e v i a t i o n o f t h e normal d i s t r i b u t i o n
11 x = 0.02 # Value f o r which t o c a l c u l a t e t h e p r o b a b i l i t y
12

13 # ( i ) P(X> 0 ) = 1 - P(X≤ 0 )
14 x = 0
15 prob1 = 1 - n o r m a l p r o b ( mean , s t d d e v , x )
16 p r i n t ( f ”The p r o b a b i l i t y o f p o s i t i v e r e t u r n i s a p p r o x i m a t e l y = ...
{ prob1 : . 4 f } ” )
17

18 # ( i i ) P(X < - 0 . 0 2 )
19 x = -0.02
20 prob2 = n o r m a l p r o b ( mean , s t d d e v , x )
21 p r i n t ( f ”The p r o b a b i l i t y o f n e g a t i v e by more than 2% = { prob2 : . 4 f } ” )
22

23 # The a n s w e r s :
24 # The p r o b a b i l i t y o f p o s i t i v e r e t u r n i s a p p r o x i m a t e l y = 0 . 5 3 9 8
25 # The p r o b a b i l i t y o f n e g a t i v e by more than 2% = 0 . 0 1 7 9

The normal distribution’s widespread use in finance extends to various applications, such
as risk assessment, option pricing, portfolio management, and hypothesis testing. It serves
as a foundational tool for understanding the behavior of financial variables and making
data-driven decisions in the field of finance.

The normal distribution is also uniquely determined by its moment generating function
(m.g.f). If X ∼ N(µ, σ 2 ), then its m.g.f with respect to P is given by

2
σ 2 /2
MX (λ) = E[eλX ] = eλµ+λ , (2.4)

for all λ ∈ R and vise versa. The m.g.f. is a function of λ, while µ and σ 2 are (fixed)
parameters.
Review of Basic Probability 47

The normal distribution also has the following properties:

(1) If Z ∼ N(0, 1), then X = µ + σZ ∼ N(µ, σ 2 ) . Conversely, if X ∼ N(µ, σ 2 ), then


Z = (X − µ)/σ ∼ N(0, 1). This last transformation, form X to Z, is known as
standardization. Hence we deduce that
   
x−µ x−µ
P(X ≤ x) = P Z ≤ =N , (2.5)
σ σ

for all x ∈ R.
(2) The normal distribution is additive: if X1 ∼ N(µ1 , σ12 ) and X2 ∼ N(µ2 , σ22 ) are inde-
pendent, then X1 + X2 ∼ N(µ1 + µ2 , σ12 + σ22 ).

2.2.4 The Log-Normal Distribution


The Log-Normal distribution is a continuous probability distribution that is commonly used
to model variables whose logarithms follow a normal distribution. It is particularly useful
for describing quantities that are never negative and often exhibit exponential growth.

Definition 2.10. Let X be a continuous random variable following a Log-Normal


distribution X ∼ LN(µ, σ 2 ). The probability density function (PDF) of X is given
by:
1 (ln(x)−µ)2
fX (x) = √ e− 2σ 2 , x > 0,
xσ 2π
where:
• µ is the mean of the logarithm of X.
• σ is the standard deviation of the logarithm of X.
log(X) ∼ N(µ, σ 2 )

Properties:

• The Log-Normal distribution is always positively skewed, meaning that it has a longer
tail on the right side.
• The mean (µ) and standard deviation (σ) of X can be different from the mean and
standard deviation of the logarithm of X.
• The mean and variance of the log-normal distribution satisfy

2
E[X] = eµ+σ /2
(2.6)
2µ+σ 2 σ2
Var(X) = e (e − 1). (2.7)
48 Review of Basic Probability

Indeed, X ∼ LN(µ, σ 2 ), then Y = ln X ∼ N(µ, σ 2 ) and

2
E[X] = E[eY ] = MY (1) = eµ+σ /2

and
2
E[X 2 ] = E[e2Y ] = MY (2) = e2µ+2σ

Finally,

Var(X) = E[X 2 ] − [E[X]]2


2 2
= e2µ+2σ − (eµ+σ /2 2
)
2 2
2µ+σ σ
=e (e − 1).

Example 2.2.8
The Log-Normal distribution is widely used in finance to model the distribution of
asset prices and returns, particularly for assets that have the potential for exponential
growth. For instance, stock prices often follow a Log-Normal distribution because
they can never be negative and tend to exhibit growth over time.
Imagine you’re analyzing the potential future price of a stock. You collect historical
data and find that the mean logarithm of the stock price is 4.5 and the standard
deviation of the logarithm is 0.2. You can model the distribution of the stock price
using the Log-Normal distribution with µ = 4.5 and σ = 0.2:

1 (ln(x)−4.5)2
− 2×0.22
fX (x) = √ e , x > 0.
x × 0.2 × 2π
This model allows you to estimate probabilities of different price levels and assess the
potential for price movements in the future.

In finance, the Log-Normal distribution is also used to model other variables such as
asset returns, interest rates, and growth rates. Its ability to capture the characteristics
of exponential growth makes it a valuable tool for understanding and predicting financial
phenomena in various domains.

Truncated expectations
Useful for option pricing in the Black-Scholes-Merton model.

Let X ∼ LN(µ, σ 2 ) and where a > 0. The truncated expectation


 
σ2 ln(a) − µ
E X1{X≤a} = eµ+ 2 N
 
−σ .
σ
Review of Basic Probability 49

Using the relation, 1{X>a} = 1 − 1{X≤a} , we can also obtain


 
σ2 ln(a) − µ
E X1{X>a} = eµ+ 2 N
 
− +σ .
σ

Stop-loss transforms
Recall the definition of the stop-loss function (x − a)+ . Using its properties, we can write

(X − a)+ = (X − a)1{X>a} = X1{X>a} − a1{X>a} .

The stop-loss transform of X, defined by E[(X − a)+ ], is thus

E[(X − a)+ ] = E[X1{X>a} ] − aE[1{X>a} ]


= E[X1{X>a} ] − aP(X > a).

Using the above formulas,


   
2
µ+ σ2 ln(a) − µ ln(a) − µ
E[(X − a)+ ] = e N − + σ − aN − . (2.8)
σ σ

2.2.5 Random Vectors


A random vector is a collection of random variables that are grouped together as a single
entity. In other words, it represents multiple random variables in a single mathematical
structure. Random vectors are used to model and analyze situations where there is more
than one source of randomness or multiple variables that are related to each other.

Definition 2.11. Let X = (X1 , X2 , . . . , Xn ) be a random vector with n components,


where each Xi is a random variable. The joint probability distribution or joint
probability density function (PDF) of the random vector specifies how the different
components of the vector are related in terms of their probabilities.

Properties and Concepts


The expectation or mean value of a random vector X is given by

µX = EX = (EX1 , . . . , EXn ).

The covariance matrix of X is defined as,

ΣX = (cov(Xi , Xj ) : i, j = 1, . . . , n),
50 Review of Basic Probability

where

cov(Xi , Xj ) = E[(Xi − µXi )(Xj − µXj )]


= E(Xi Xj ) − µXi µXj ,

2
is the covariance of Xi and Xj . Notice that cov(Xi , Xi ) = σX i
.

It is convenient to standardize covariances by dividing the corresponding random variables


by their standard deviations. The resulting quantity

cov(X1 , X2 )
corr(X1 , X2 ) =
σX1 σX2
E[(X1 − µX1 )(X2 − µX2 )]
=
σX1 σX2

is the correlation of X1 and X2 .

Joint Distributions
The joint distribution of a random vector describes the probabilities or densities associated
with various combinations of values for the components of the vector. The collection of the
probabilities

FX (x) = P (X1 ≤ x1 , . . . , Xn ≤ xn )
= P ({ω : X1 (ω) ≤ x1 , . . . , Xn (ω) ≤ xn }),

where x = (x1 , x2 , . . . , xn ) ∈ Rn , is the distribution function of FX of X.

The collection of the probabilities

PX (B) = P (X ∈ B) = P ({ω : X(ω) ∈ B})

for suitable subsets B ⊂ Rn constitutes the distribution of X.

If the distribution of a random vector X has density fX , one can represent the distribution
function FX of X as
Z x1 Z xn
FX (x1 , . . . , xn ) = ··· fX (y1 , . . . , yn )dy1 · · · dyn ,
−∞ −∞

(x1 , . . . , xn ) ∈ Rn , where the density is a function satisfying

fX (X) ≥ 0 for every x ∈ Rn


Review of Basic Probability 51

and Z ∞ Z ∞
··· fX (y1 , . . . , yn )dy1 · · · dyn = 1
−∞ −∞

Marginal Distributions
The individual distributions of each random variable within the vector are called marginal
distributions. They can be obtained by considering the joint distribution and integrating or
summing over the other variables. The marginal distribution of the ith component, denoted
as fXi (xi ), represents the probability density function (PDF) of the random variable Xi ,
ignoring the values of the other components.

Independence
Random variables within a vector can be independent or dependent. Two random variables
Xi and Xj within the vector are independent if their joint distribution factorizes into the
product of their marginal distributions.

Two events A1 and A2 are independent if

P (A1 ∩ A2 ) = P (A1 )P (A2 ).

Two random variables X1 and X2 are independent if

P (X1 ∈ B1 , X2 ∈ B2 ) = P (X1 ∈ B1 )P (X2 ∈ B2 )

for all suitable subsets B1 and B2 of R. Or


The random variables X1 and X2 are independent if and only if

FX1 ,X2 (x1 , x2 ) = FX1 (x1 )FX2 (x2 ), x1 , x2 ∈ R.

Note also that, the independent random variables X1 and X2 and uncorrelated, i.e.
corr(X1 , X2 ) = cov(X1 , X2 ) = 0. The converse is in general not true.

Conditional Distributions
Given a value for one or more components of the random vector, the conditional distribution
describes the distribution of the remaining components.

Recall that, the conditional probability of A given B, i.e.

P (A ∩ B)
P (A|B) = .
P (B)

And, P (A|B) = P (A) if and only if A and B are independent.


52 Review of Basic Probability

Given that P (B) > 0, we can define the conditional distribution function of a random
variable X given B
P (X ≤ x, B)
FX (x|B) = , x ∈ R,
P (B)
and also the conditional expectation of X given B

E(XIB )
E(X|B) = ,
P (B)

where IB is the indicator function of the event B.

If X is a discrete random variable with values x1 , x2 , . . . , then


∞ ∞
X P ({ω : X(ω) = xk }) ∩ B X
E(X|B) = xk = P (X = xk |B).
P (B)
k=1 k=1

If X has density fX , then


Z ∞
1
E(X|B) = xIB (x)fX (x)dx
P (B) −∞
Z
1
=: xfX (x)dx.
P (B) B

Consider a discrete random variable Y on Ω that assumes the distinct values yi on the set
Ai , i.e.
Ai = {ω : Y (ω) = yi }, i = 1, 2, . . . .

For a random variable X on Ω with E|X| < ∞ we define the conditional expectation of X
given Y as the discrete random variable

E(X|Y )(ω) := E(X|Ai ) = E(X|Y = yi ) for ω ∈ Ai , i = 1, 2, . . .

The conditional expectation is linear

EX = E[E(X|Y )]

If X and Y are independent, then E(X|Y ) = EX.

Example 2.2.9
Suppose you are analyzing the returns of two stocks, X and Y , over a certain period.
You can represent the returns as a random vector R = (X, Y ). Here, X and Y are
Stochastic Processes 53

random variables representing the returns of the two stocks.


You can model the joint distribution of the returns of X and Y using various
multivariate probability distributions, such as the bivariate Normal distribution. The
joint distribution can provide insights into the correlation between the returns of the
two stocks, their conditional distributions given certain events, and other statistical
properties.
In finance, random vectors are used to model the behavior of portfolios, where the
returns of multiple assets are combined. They are also used in risk assessment, option
pricing, and various other areas where multiple sources of randomness need to be
considered simultaneously.

Example 2.2.10
Suppose you are analyzing an investment portfolio with three assets: Asset A, Asset
B, and Asset C. You have the following data:
• Asset A has an expected return of 8%.
• Asset B has an expected return of 12%.
• Asset C has an expected return of 10%.
You have invested $10, 000 in Asset A, $5, 000 in Asset B, and $8, 000 in Asset C.
Calculate the expected return of your portfolio.

Solution: The expected return of the portfolio (E(Rp )) can be calculated as weighted
average of the expected returns of the individual assets, where the weights are proportions
of the portfolio invested in each asset.

E(Rp ) = wA E(A) + wB E(B) + wC E(C)


= (10, 000/23, 000) × 8% + (5, 000/23, 000) × 12% + (8, 000/23, 000) × 10%
≈ 9.56

2.3 Stochastic Processes


A stochastic process, also known as a random process, is a mathematical model that describes
the evolution of a system or phenomenon over time in a probabilistic manner. Unlike
deterministic processes that have fixed outcomes, stochastic processes involve randomness
and uncertainty, making them suitable for modeling situations where randomness plays a
significant role.
54 Stochastic Processes

Learning Outcomes
By the end of this section, you will be able to:
• Define Brownian motion.
• Explain the relevance of stochastic process in finance and economics.
• Generate/Simulate sample paths of a given stochastic process.

Definition 2.12. A stochastic process is a parameterized collection of random variables

{Xt }t∈T

defined on a probability space (Ω, F, P) and assuming values in Rn . The parameter space T
can be the halfline [0, ∞), [a, b], the non-negative integer or subset of Rn for n ≥ 1.

Note that, Components of a Stochastic Process:

• Index Set: The parameter that defines the domain over which the random variables are
defined. It could be time (continuous or discrete), space, or any other parameter.
• Sample Space: The set of all possible outcomes for each random variable in the process.
• Sample Paths: A realization of the process, which is a specific sequence of values taken
by the random variables over the index set.
• Transition Probabilities/Densities: The probabilities or densities that describe the
evolution of the process from one state to another. These capture the conditional
probabilities of future states given the past states.

Types of Stochastic Processes:

(1) Discrete-Time Stochastic Process: The random variables are defined at discrete
points in time or space. Examples include the random walk and the Poisson process.
(2) Continuous-Time Stochastic Process: The random variables are defined over
continuous intervals of time or space. Examples include the Brownian motion and the
exponential growth process.
(3) Markov Process: A process where the future state depends only on the present state
and not on past states. It has the Markov property, which simplifies the modeling and
analysis.

Example 2.3.1
Examples in Finance:
(1) Stock Price Modeling: The movement of stock prices over time is often modeled
Stochastic Processes 55

using stochastic processes. The geometric Brownian motion is a common model


where the logarithm of stock prices follows a Brownian motion process.
(2) Interest Rate Modeling: Stochastic processes are used to model the evolution of
interest rates over time. The Vasicek and Cox-Ingersoll-Ross (CIR) models are
examples in this context.
(3) Option Pricing: Stochastic processes are integral in option pricing models like
the Black-Scholes model, which assumes that stock prices follow a geometric
Brownian motion.

Stochastic processes are fundamental in various fields, including finance, physics, biology,
and engineering, where randomness and uncertainty are inherent. They provide a powerful
framework for understanding and predicting the behavior of dynamic systems under the
influence of random factors.

2.3.1 Symmetric random walk


A symmetric random walk is a simple stochastic process where a particle or walker moves
randomly in discrete steps along a one-dimensional line. At each step, the walker has an
equal probability of moving to the left or right by a fixed distance. Symmetric random walks
are often used to model various scenarios, such as financial market movements, diffusion
processes, and statistical phenomena.

Definition 2.13. Consider a sequence of independent and identically distributed (iid)


random variables {ϵi , i = 1, 2, . . . } whose common distribution is given by

1
P (ϵi = 1) = P (ϵi = −1) = , i = 1, 2, . . .
2

We define the corresponding symmetric random walk (SRW) X = {Xn , n ≥ 0} by


X0 = 0 and, for n ≥ 1, by
n
X
Xn = ϵi = ϵ1 + ϵ2 + · · · + ϵn .
i=1

It is discrete-time stochastic process.

For times m and n such that 0 ≤ m < n, the corresponding increment Xn − Xm is given by
n
X m
X n
X
Xn − Xm = ϵi − ϵi = ϵi = ϵm+1 + ϵm+2 + · · · + ϵn .
i=1 i=1 i=m+1
56 Stochastic Processes

We deduce easily that the increments of a SRW X = Xn , n ≥ 0 are independent (over non-
overlapping time intervals) and stationary. More precisely,

(1) for any m ≥ 1 and 0 ≤ n1 ≤ n2 < · · · < nm , the random variables

Xn2 − Xn1 , . . . , Xnm − Xnm−1

are independent;
(2) for any k, n ≥ 1, the random variables Xn+k − Xk and Xn have the same distribution.

Example 2.3.2
In finance, symmetric random walks are used to model price movements in markets.
Imagine a stock’s price movements, where each day’s price change is determined by a
random factor. If we assume that price changes have no directional bias, a symmetric
random walk is a suitable model. Each day’s price change corresponds to the walker’s
step, and the accumulated price change represents the stock’s price over time. While
simplistic, this model helps us understand basic market dynamics and serves as a
starting point for more sophisticated models used in financial analysis.

Markovian property

A SRW possesses the Markovian property, i.e. at each time step it depends only on the last
known values, not on the preceding ones. Mathematically, for 0 ≤ m < n,

P (Xn ≤ x|X0 , X1 , . . . , Xm ) = P (Xn ≤ x|Xm ),

for any x ∈ R, or equivalently

P (Xn = z|X0 , X1 , . . . , Xm ) = P (Xn = z|Xm ),

for any z ∈ Z. This comes form the fact that


n
X
Xn = Xm + ϵi = Xm + ϵm+1 + · · · ϵn .
i=m+1

If we want to predict the value of Xn (in the future) knowing the whole random walk up to
time m(the present), only the knowledge of Xm is useful. Consequently, for a function g(·),
we have
E[g(Xn )|X0 , X1 , . . . , Xm ] = E[g(Xn )|Xm ]. (2.9)
Stochastic Processes 57

In particular, when m = n − 1, we have

E[g(Xn )|X0 , X1 , . . . , Xn−1 ] = E[g(Xn )|Xn−1 ].

Martingale property

A SRW possesses the martingale property, i.e. the prediction of a process in the future is
given by its last known value Mathematically, for 0 ≤ m < n,

E[Xn |X0 , X1 , . . . , Xm ] = Xm . (2.10)

2.3.2 Standard Brownian Motion


Brownian motion, named after the Scottish botanist Robert Brown who observed the random
movement of pollen grains suspended in water, is a fundamental continuous-time stochastic
process used to model various phenomena in physics, finance, and other fields. Brownian
motion is characterized by its unpredictability and the continuous, erratic movement of
particles.

Definition 2.14. A stochastic process W = (Wt , t ∈ [0, ∞)) is called (standard)


Brownian motion or a Wiener process if the following conditions are satisfied:
• It starts at zero: W0 = 0.
• It has stationary, independent increment.
• For every t > 0, Wt has a normal N (0, t) distribution.
• It has continuous sample paths: “no jumps” .

Stationary: Wt − Ws = Wt+h − Ws+h for all t, s ∈ T and h with t + h, s + h ∈ T .


Independent increment: for every choice of ti ∈ T with t1 < · · · < tn and n ≥ 1,

Wt2 − Wt1 , . . . , Wtn − Wtn−1

are independent.

Distribution properties

From the definition of Brownian motion, we deduce that for each t > 0, the random variable
Wt is normally distributed with mean 0 and variance t, i.e. for all a ∈ R,
Z a
1 − y2
P (Wt ≤ a) = √ e 2t dy,
−∞ 2πt
58 Stochastic Processes

Figure 2.4: Sample paths of Brownian motion on [0, 1].

where ,
E[Wt ] = µW = 0, and V ar(Wt ) = E[(Wt )2 ] = t.

For all s, t ≥ 0. First, note that

Cov(Ws , Wt ) = E[Ws Wt ] − E[Wt ]E[Ws ],

can be simplified to
Cov(Ws , Wt ) = E[Ws Wt ]

since E[Wt ] = E[Ws ] = 0.

If we assume that s < t, then Wt − Ws is independent of Ws − W0 = Ws and we can write

Cov(Ws , Wt ) = E[Ws Wt ]
= E[Ws (Wt − Ws + Ws )]
= E[Ws (Wt − Ws )] + E[(Ws )2 ]
= E[Ws ]E[Wt − Ws ] + s
=s

By symmetry, if we assume that s > t, then we get Cov(Wt , Ws ) = t. Consequently, we


have obtained the
Cov(Ws , Wt ) = min{s, t}, for all s, t > 0.
Stochastic Processes 59

Markovian property

Brownian motion is a Markov process, i.e. for any 0 ≤ t < T , we have

P (WT ≤ x|Ws , 0 ≤ s ≤ t) = P (WT ≤ x|Wt ),

for all x ∈ R. For a sufficiently well-behaved function g(·), we can write

E[g(WT )|Ws , 0 ≤ s ≤ t] = E[g(WT )|Wt ].

Building on the independence WT − Wt and Wt , we can further write

E[g(WT )|Wt ] = E[g(WT − Wt + Wt )|Wt ] = E[g(WT − Wt + x)]|x=Wt . (2.11)

How to compute/understand the last expectation:

(1) Consider x as a dummy variable and compute E[g(WT − Wt + x)] using the fact that
WT − Wt ∼ N(0, T − t), which will generate an expression in terms of x.
(2) Set f (x) to be this expression computed in step 1.
(3) Set E[g(WT )|Wt ] = f (Wt ).

Example 2.3.3

Let us compute E[WT2 |Wt ] using equation (2.11) with g(x) = x2 . The first step is to
compute
E[(WT − Wt + x)2 ],

where x is a dummy variable. Since WT − Wt ∼ N(0, T − t), expanding the square,


we get

E[(WT − Wt + x)2 ] = E[(WT − Wt )2 ] + 2xE[WT − Wt ] + x2


= (T − t) + 2x × 0 + x2
= T − t + x2

Now, we set f (x) = (T − t) + x2 and, finally, we have

E[WT2 |Wt ] = f (Wt ) = (T − t) + Wt2 .


60 Stochastic Processes

Martingale property

Brownian motion W = {Wt , t ≥ 0} is a martingale, i.e. for any 0 ≤ t < T , we have

E[WT |Ws , 0 ≤ s ≤ t] = Wt .

As W = {Wt , t ≥ 0} is also a Markov process, we only need to show that

E[WT |Wt ] = Wt

to verify that it is a martingale. Using the fact that WT = Wt + (WT − Wt ) and the
independence between WT − Wt and Wt . Using the linearity of conditional expectations,
we can write

E[WT |Wt ] = E[(WT − Wt ) + Wt |Wt ]


= E[WT − Wt |Wt ] + E[Wt |Wt ]
= E[WT − Wt ] + Wt
= Wt .

So, a standard Brownian motion is indeed a martingale.

2.3.3 Linear Brownian motion


Linear Brownian motion, also known as arithmetic Brownian motion or Brownian motion
with drift, is obtained by transforming a standard Brownian motion using an affine function.
For two constants µ and σ > 0, we define the corresponding linear Brownian motion,
issued form X0 ∈ R, by X = {Xt , t ≥ 0}, where

Xt = X0 + µt + σWt .

We call µ the drift coefficient and σ the volatility coefficient or diffusion coefficient of X.
The effect of µ and σ on the Brownian motion is illustrated in Figure 2.5.

Distributional properties

Since Xt is obtained as linear transformation of Wt which is normally distributed, Xt is also


normally distributed. For each t > 0, we have

Xt ∼ N(X0 + µt, σ 2 t)
Stochastic Processes 61

Linear Brownian Mo ion wi h Differen Drif and Diffusion Parameters


X0 = 2, μ = 2.0, σ = 2.0 X0 = 2, μ = 2.0, σ = -2.0

2
Xt

Xt
2

1
1

0
0

0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
t t
X0 = 2, μ = -2.0, σ = 2.0 X0 = 2, μ = -2.0, σ = -2.0
2.0 2.0
1.5 1.5

1.0 1.0

0.5 0.5
Xt

Xt
0.0 0.0

−0.5 −0.5

−1.0 −1.0
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
t t

Figure 2.5: Sample paths of linear Brownian motion s along with the corresponding standard
Brownian motion trajectory

We see that the mean increases (resp. decreases), as time goes by, at rate µ > 0 (resp.
µ < 0) while the variance increases at rate σ 2 .

Note that for 0 ≤ s < t, we have

Xt − Xs = (x + µt + σWt ) − (x + µs + σWs )
= µ(t − s) + σ(Wt − Ws ).

Since the increment Wt − Ws is normally distributed with mean 0 and variance t − s, the
increment Xt −Xs is also normally distributed with mean µ(t−s) and variance σ 2 (t−s). Also,
since the increments of a Brownian motion (over disjoint time intervals) are independent,
and because a linear Brownian motion is just one affine transformation away form a standard
Brownian motion, its increments are also independent.

2.3.4 Geometric Brownian motion


For two constants µ and σ > 0, we define the corresponding geometric Brownian motion
(GBM), issued from S0 , by S = {St , t ≥ 0}, where

St = S0 exp(µt + σWt ) = eXt ,


62 Stochastic Processes

where X is a linear Brownian motion issued form X0 = ln(S0 ), with drift coefficient µ and
volatility coefficient σ. Figure 2.6 illustrates three sample paths of geometric Brownian
motions (with different parameters).

μ=0.1, σ=0.2
15
μ=0.2, σ=0.3
μ=0.01, σ=0.1
14

13

12
St

11

10

0.0 0.2 0.4 0.6 0.8 1.0


Time

Figure 2.6: Sample paths of geometric Brownian motions (GBMs) with different parameters.

Distributional properties

From the definition, we have that St is log-normally distributed, for each t > 0. Indeed,
since we have
St = exp(ln(S0 ) + µt + σWt ),

where
ln(S0 ) + µt + σWt ∼ N(ln(S0 ) + µt, σ 2 t),

then
St ∼ LN(ln(S0 ) + µt, σ 2 t),

Therefore, from equation (2.6) and (2.7), the mean and the variance of a GBM:

σ2
E[St ] = S0 e(µ+ 2 )t
.

and
2 2
Var(St ) = S02 e2µt+σ t (eσ t − 1)

Geometric Brownian motion, a longstanding model, represents risky asset prices. It underlies
the Black-Scholes-Merton framework for stock prices and aids in generating economic
scenarios for banking and insurance.
Stochastic Processes 63

From the definition, for 0 ≤ t < T , we can write

ST S0 exp(µt + σWT )
=
St S0 exp(µt + σWt )
= exp(µ(T − t) + σ(WT − Wt ))
= exp(XT − Xt ).

Since XT − Xt is normally distributed, then ST /St is log-normally distributed.

Unlike standard and linear Brownian motion, the increments of a geometric Brownian
motion (GBM) aren’t independent or stationary. However, since linear Brownian motion’s
increments over separate time intervals are independent, and a GBM is an exponential
transformation of linear BM, the relative increments of the GBM are independent.

For further reading : (Choe et al., 2016), (Boudreault and Renaud, 2019, Chapter 14,
15),
64 Python Implementation

2.4 Python Implementation

Normal distributions
[1]: # import important packeges
import numpy as np
# a library for downloading data from Yahoo Finance website.
import yfinance as yf
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import norm, multivariate_normal, uniform
import seaborn; seaborn.set()

[2]: # creating normal distribution


X_norm = norm(0, 1)

[3]: # calculating the mean


X_norm.mean()

[3]: 0.0

[4]: # calculating variance


X_norm.var()

[4]: 1.0

[5]: # calculating standard deviation


X_norm.std()

[5]: 1.0

[6]: # computing the value of the pdf at a specific point.


X_norm.pdf(0)

[6]: 0.3989422804014327

[7]: # calculating cdf - the cumulative distribution function


X_norm.cdf(0)

[7]: 0.5

1
Python Implementation 65

[8]: # generating some sample


X = X_norm.rvs(100)

[9]: # plotting histogram


plt.hist(X)
plt.show()

[10]: # Generate equally spaced 11 points between -4 and 4.


x = np.linspace(-4, 4, 11)
x

[10]: array([-4. , -3.2, -2.4, -1.6, -0.8, 0. , 0.8, 1.6, 2.4, 3.2, 4. ])

[11]: # calculate the probability density points at all the obove 11 points.
y = X_norm.pdf(x)
y

[11]: array([1.33830226e-04, 2.38408820e-03, 2.23945303e-02, 1.10920835e-01,


2.89691553e-01, 3.98942280e-01, 2.89691553e-01, 1.10920835e-01,
2.23945303e-02, 2.38408820e-03, 1.33830226e-04])

[12]: # ploting the probability density function of a standard normal distribution


x = np.linspace(-4, 4, 100) # generate 100 points between -4 and 4.
y = X_norm.pdf(x)
plt.plot(x, y,'--k')

2
66 Python Implementation

plt.show()

Two-dimensional normal distribution


[13]: cov = np.array([[1, 0.0],[0.0, 1.0]]) # covariance matrix
mean= np.array([0, 0]) # mean vector

[14]: # generate multivariate normal distribution


distr = multivariate_normal(mean = mean, cov = cov, seed= 1000)

[15]: # generate points


x = np.linspace(-4, 4, num = 30)
y = np.linspace(-4, 4, num = 30)
# create a meshgrid of 2 dimensions
X, Y = np.meshgrid(x, y)

[16]: pdf = np.zeros(X.shape) # create a matrix with the same size as X all elements␣
,→zero, will be updated as follows:

for i in range(X.shape[0]):
for j in range(X.shape[1]):
pdf[i,j] = distr.pdf([X[i,j], Y[i,j]])

[17]: # plotting
fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(projection = '3d')

3
Python Implementation 67

ax.plot_surface(X,Y, pdf, cmap = 'jet')


plt.xlabel("$X_1$")
plt.ylabel("$X_2$")
plt.title('Standard normal distribution in 2d')
plt.savefig('pdf_2d.eps')
plt.show()

The PostScript backend does not support transparency; partially transparent


artists will be rendered opaque.

4
68 Python Implementation

Example of random variable

[18]: # obtaining a single stock data form yahoo finance: Example AAPL
start = '2015-01-01'
end = '2023-04-01'
apl = yf.download('AAPL', start= start, end = end, progress = True)

[*********************100%***********************] 1 of 1 completed

[19]: apl.head()

[19]: Open High Low Close Adj Close Volume


Date
2015-01-02 27.847500 27.860001 26.837500 27.332500 24.498678 212818400
2015-01-05 27.072500 27.162500 26.352501 26.562500 23.808512 257142000
2015-01-06 26.635000 26.857500 26.157499 26.565001 23.810755 263188400
2015-01-07 26.799999 27.049999 26.674999 26.937500 24.144634 160423600
2015-01-08 27.307501 28.037500 27.174999 27.972500 25.072327 237458000

[20]: apl.tail()

[20]: Open High Low Close Adj Close \


Date
2023-03-27 159.940002 160.770004 157.869995 158.279999 157.848206
2023-03-28 157.970001 158.490005 155.979996 157.649994 157.219925
2023-03-29 159.369995 161.050003 159.350006 160.770004 160.331421
2023-03-30 161.529999 162.470001 161.270004 162.360001 161.917084
2023-03-31 162.440002 165.000000 161.910004 164.899994 164.450150

Volume
Date
2023-03-27 52390300
2023-03-28 45992200
2023-03-29 51305700
2023-03-30 49501700
2023-03-31 68749800

[21]: X = apl['Adj Close']


X.plot()
plt.show()

5
Python Implementation 69

[22]: X_mean = X.mean()


X_mean

[22]: 73.35910640745954

[23]: X_std = X.std()


X_std

[23]: 50.273539806281306

Compute the mean, standard deviation, skewness, and excess kurtosis of its log returns
Simple Retrrns
The return from time t to time t + 1 is given by:

Xt+1 − Xt
Rt,t+1 =
Xt
or alternatively

Xt+1
Rt,t+1 = −1
Xt

[24]: ret = X/X.shift(1)-1


ret.head()

6
70 Python Implementation

[24]: Date
2015-01-02 NaN
2015-01-05 -0.028172
2015-01-06 0.000094
2015-01-07 0.014022
2015-01-08 0.038422
Name: Adj Close, dtype: float64

There is a built-in method in DataFrame that computes the percent change from one row to another.
Since that is exactly what a return is (the percent change in price) we can just use this method to
compute the return.
[25]: ret = X.pct_change()
ret.head()

[25]: Date
2015-01-02 NaN
2015-01-05 -0.028172
2015-01-06 0.000094
2015-01-07 0.014022
2015-01-08 0.038422
Name: Adj Close, dtype: float64

[26]: ret = ret.dropna() # drop the NaN


ret_mean = ret.mean() # caclcuating mean return
ret_mean

[26]: 0.0010942281372229837

[27]: ret.plot(); # plotting the return

7
Python Implementation 71

[28]: ret_std = ret.std()


ret_std

[28]: 0.01877288642555937

[29]: # skewness
ret_skew = ret.skew()
ret_skew

[29]: -0.024857622105484853

[30]: # Kurtosis
ret_kurtosis = ret.kurtosis()
ret_kurtosis

[30]: 5.04715253421797

[31]: # using the built in function


ret.describe()

[31]: count 2075.000000


mean 0.001094
std 0.018773
min -0.128647
25% -0.007566

8
72 Python Implementation

50% 0.000901
75% 0.010512
max 0.119808
Name: Adj Close, dtype: float64

Log returns:
Log retruns are defined as:

rt = log(Xt /Xt−1 ) = log(Xt ) − log(Xt−1 )

[32]: log_ret = np.log(X/X.shift(1)).dropna() # log return


log_ret.head()

[32]: Date
2015-01-05 -0.028576
2015-01-06 0.000094
2015-01-07 0.013925
2015-01-08 0.037703
2015-01-09 0.001072
Name: Adj Close, dtype: float64

[33]: log_ret.plot();

9
Python Implementation 73

Example on Multivariate Analysis


Collection of Data
Download 2 years of price history of 5 stocks and one index from yahoo finance
1. Apple (AAPL)
2. Microsoft (MSFT)
3. Crude oil (CL=F) future
4. Coffee (KC=F)

[34]: tickers = ["AAPL", "MSFT", "CL=F", "KC=F"]


df = yf.download(tickers, period="2y", progress=False)

[35]: df.tail()

[35]: Adj Close Close \


AAPL CL=F KC=F MSFT AAPL
Date
2023-09-18 177.970001 91.480003 158.699997 329.059998 177.970001
2023-09-19 179.070007 91.199997 167.500000 328.649994 179.070007
2023-09-20 175.490005 90.279999 158.199997 320.769989 175.490005
2023-09-21 173.929993 89.629997 154.850006 319.529999 173.929993
2023-09-22 174.789993 90.330002 150.199997 317.010010 174.789993

High ... \
CL=F KC=F MSFT AAPL CL=F ...
Date ...
2023-09-18 91.480003 158.699997 329.059998 179.380005 92.430000 ...
2023-09-19 91.199997 167.500000 328.649994 179.630005 93.739998 ...
2023-09-20 90.279999 158.199997 320.769989 179.699997 91.980003 ...
2023-09-21 89.629997 154.850006 319.529999 176.300003 90.980003 ...
2023-09-22 90.330002 150.199997 317.010010 177.078995 91.330002 ...

Low Open \
KC=F MSFT AAPL CL=F KC=F
Date
2023-09-18 158.699997 326.359985 176.479996 91.199997 158.699997
2023-09-19 162.500000 324.510010 177.520004 92.220001 162.500000
2023-09-20 157.649994 320.510010 179.259995 91.550003 160.399994
2023-09-21 154.500000 315.000000 174.550003 89.300003 158.000000
2023-09-22 150.050003 316.149994 174.669998 89.620003 154.750000

Volume
MSFT AAPL CL=F KC=F MSFT
Date
2023-09-18 327.799988 67257600 119258.0 0.0 16834200
2023-09-19 326.170013 51826900 94597.0 28898.0 16505900
2023-09-20 329.510010 58436200 457854.0 17552.0 21436500

10
74 Python Implementation

2023-09-21 319.260010 63047900 457854.0 17552.0 35529500


2023-09-22 321.320007 55110610 379104.0 19795.0 21103284

[5 rows x 24 columns]

[36]: df["Close"].tail()

[36]: AAPL CL=F KC=F MSFT


Date
2023-09-18 177.970001 91.480003 158.699997 329.059998
2023-09-19 179.070007 91.199997 167.500000 328.649994
2023-09-20 175.490005 90.279999 158.199997 320.769989
2023-09-21 173.929993 89.629997 154.850006 319.529999
2023-09-22 174.789993 90.330002 150.199997 317.010010

[37]: df["Close"].plot(figsize = (8,5))


plt.show()

Mean Vectors
[38]: X = df['Adj Close'].dropna()
X.mean()

11
Python Implementation 75

[38]: AAPL 159.141829


CL=F 85.621614
KC=F 199.685657
MSFT 284.536231
dtype: float64

Variance -Covariance Matrices


Covarince of two random variables X and Y is given by

covXY = σXY = E(X − µX )(Y − µY ))

and and their correlation is given by


E(X − µX )(Y − µY )
corrXY = ρXY =
σX σY
Covaiance is a measrue to incicate the extent to which the two random returns change in tandem,
while their correlation masures the strength of the relation. It refers to the scaled form of covariance.

covXY
ρXY =
σX σY

[39]: X.cov()

[39]: AAPL CL=F KC=F MSFT


AAPL 265.830391 -52.562763 -47.037222 470.376883
CL=F -52.562763 167.838002 180.248163 -132.012130
KC=F -47.037222 180.248163 885.761297 -13.820873
MSFT 470.376883 -132.012130 -13.820873 1230.933452

[40]: X.corr()

[40]: AAPL CL=F KC=F MSFT


AAPL 1.000000 -0.248846 -0.096935 0.822293
CL=F -0.248846 1.000000 0.467485 -0.290437
KC=F -0.096935 0.467485 1.000000 -0.013236
MSFT 0.822293 -0.290437 -0.013236 1.000000

[41]: returns = X/X.shift(1)-1


returns.head()

[41]: AAPL CL=F KC=F MSFT


Date
2021-09-24 NaN NaN NaN NaN
2021-09-27 -0.010550 0.019870 -0.003602 -0.017304
2021-09-28 -0.023801 -0.002121 0.025562 -0.036204
2021-09-29 0.006483 -0.006110 -0.026183 0.001693
2021-09-30 -0.009312 0.002673 0.003102 -0.007324

12
76 Python Implementation

[42]: returns = X.pct_change()


returns.head()

[42]: AAPL CL=F KC=F MSFT


Date
2021-09-24 NaN NaN NaN NaN
2021-09-27 -0.010550 0.019870 -0.003602 -0.017304
2021-09-28 -0.023801 -0.002121 0.025562 -0.036204
2021-09-29 0.006483 -0.006110 -0.026183 0.001693
2021-09-30 -0.009312 0.002673 0.003102 -0.007324

[43]: returns = returns.dropna()


returns_mean = returns.mean()
returns_mean

[43]: AAPL 0.000546


CL=F 0.000750
KC=F -0.000264
MSFT 0.000341
dtype: float64

[44]: returns_std = returns.std()


returns_std

[44]: AAPL 0.018810


CL=F 0.026410
KC=F 0.022425
MSFT 0.019544
dtype: float64

[45]: # skewness
returns_skew = returns.skew()
returns_skew

[45]: AAPL 0.144779


CL=F -0.570232
KC=F 0.321198
MSFT 0.157987
dtype: float64

[46]: # Kurtosis
returns_kurtosis = returns.kurtosis()
returns_kurtosis

[46]: AAPL 1.671090


CL=F 2.205064
KC=F 0.257943

13
Python Implementation 77

MSFT 1.290831
dtype: float64

[47]: # using the built in function


returns.describe()

[47]: AAPL CL=F KC=F MSFT


count 501.000000 501.000000 501.000000 501.000000
mean 0.000546 0.000750 -0.000264 0.000341
std 0.018810 0.026410 0.022425 0.019544
min -0.058679 -0.130629 -0.057041 -0.077156
25% -0.009913 -0.015586 -0.015313 -0.010986
50% 0.000502 0.003813 -0.002301 -0.000364
75% 0.011806 0.017480 0.014100 0.012311
max 0.088975 0.083544 0.078922 0.082268

[48]: log_returns = np.log(X/X.shift(1)).dropna() # log return


log_returns.head()

[48]: AAPL CL=F KC=F MSFT


Date
2021-09-27 -0.010606 0.019675 -0.003608 -0.017456
2021-09-28 -0.024089 -0.002123 0.025240 -0.036875
2021-09-29 0.006462 -0.006128 -0.026532 0.001692
2021-09-30 -0.009356 0.002669 0.003098 -0.007351
2021-10-01 0.008094 0.011265 0.050507 0.025149

[49]: log_returns.plot(figsize = (8,5))


plt.show()

14
78 Python Implementation

[50]: # covariance using the built in funciton


log_returns.cov()

[50]: AAPL CL=F KC=F MSFT


AAPL 0.000353 0.000027 0.000008 0.000270
CL=F 0.000027 0.000709 0.000111 0.000027
KC=F 0.000008 0.000111 0.000500 0.000017
MSFT 0.000270 0.000027 0.000017 0.000381

[51]: # Correlation matrix


corr_matrix = log_returns.corr()
corr_matrix

[51]: AAPL CL=F KC=F MSFT


AAPL 1.000000 0.054664 0.019580 0.736454
CL=F 0.054664 1.000000 0.185696 0.051499
KC=F 0.019580 0.185696 1.000000 0.038756
MSFT 0.736454 0.051499 0.038756 1.000000

Simulation of Brwonian Motion


[52]: n_sims = 1000
N = 250
t = np.linspace(0, 1, N)

15
Python Implementation 79

dt = t[1] - t[0]
dB = np.random.normal(scale=np.sqrt(dt), size=(n_sims, N))

B = np.cumsum(dB, axis=1)
B.shape

[52]: (1000, 250)

[53]: B[0,:] = 0
B

[53]: array([[ 0. , 0. , 0. , ..., 0. ,


0. , 0. ],
[ 0.05981603, 0.05582455, 0.07779295, ..., -0.44407196,
-0.38348857, -0.36687509],
[ 0.02149884, 0.05710695, -0.02500712, ..., -1.60834894,
-1.5732561 , -1.52500278],
...,
[ 0.04396493, 0.14330693, 0.09369251, ..., -0.74336877,
-0.73867959, -0.69577415],
[ 0.02775872, 0.09866125, 0.2083035 , ..., -0.2345022 ,
-0.23315263, -0.23617264],
[-0.05869993, 0.00377483, -0.07129909, ..., -0.74758406,
-0.73325019, -0.58710479]])

[54]: fig, ax = plt.subplots(2, 2, sharex=True,)


ax[0,0].plot(t, B[5].T)
ax[0,0].set(ylabel = 'Brownian motion', title = '1 path')
ax[0,1].plot(t, B[10:15].T)
ax[0,1].set(title = '5 paths')
ax[1,0].plot(t, B[0:20].T)
ax[1,0].set(xlabel = 't', ylabel = 'Brownian motion',title = '20 paths')
ax[1,1].plot(t, B.T)
ax[1,1].set(xlabel = 't', title = '100 paths')
plt.savefig('Brwonian.png')

16
80 Python Implementation

17
Python Implementation 81

Problems 2.1

(1) Assume X ∼ LN(−1, 2)(log-normal distribution). Compute the following prob-


ability: P(X > 9).
(2) Let W = {Wt : t ≥ 0} be a Brownian motion. Compute the following quantity.

(i) E[W15 ]
(ii) E[Ws+2 − Wt24 ]
(iii) V(3Ws − 2Wt ), where 0 < s < t
(3) What is the probability that a Brownian motion is below 0 at time 2.5?
82 Python Implementation
Chapter 3

The Fundamental Theorem of Asset


Pricing

The Fundamental Theorem of Asset Pricing is a central concept in mathematical finance


that establishes a link between the absence of arbitrage opportunities and the existence of a
risk-neutral probability measure. It plays a fundamental role in understanding the pricing
of financial derivatives and the concept of no-arbitrage.

Learning Outcomes
By the end of this section, you will be able to:
• Explain the no arbitrage principle.
• Use Binomial Trees and the no arbitrage principle in option pricing.
• List the steps for applying risk-neutral valuation to the pricing of a derivative.

Risk
Risk encompasses the potential exposure to uncertain future losses, an integral aspect of
various financial scenarios. This concept revolves around the anticipation of unfavorable
outcomes that may arise due to uncertain events or fluctuations.

Types of risks: Diverse categories of risks contribute to the complex landscape of financial
uncertainties. Notable among these are:

83
84 No Arbitrage Principle

(1) Credit risk : This risk emerges from the possibility of borrowers defaulting on their loan
obligations, leading to potential losses for lenders.
(2) Market risk : Stemming from unexpected and often adverse movements in asset prices,
market risk underscores the unpredictability inherent in financial markets.
(3) Operational risk : Operational setbacks, encompassing factors such as technical mal-
functions or fraudulent activities by employees, introduce operational risk, a potential
source of financial loss.

Risk and Investment:

Investors are inclined towards less risky investment options under equivalent conditions.
The foundational tenet of investment dictates that higher levels of risk should yield com-
mensurately higher payoffs.

Risk Management:

The practice of risk management involves a suite of strategic activities aimed at safeguarding
asset values from the uncertainties inherent in investment. This proactive approach mitigates
potential losses and enhances the resilience of investment portfolios.

Hedging:

Among the strategies in risk management, “hedging” stands out as a method of complete
risk elimination in investments. Employed to offset potential losses, hedging bolsters the
stability of investments in the face of volatile circumstances.

3.1 No Arbitrage Principle


Imagine discovering a way to make money without any possibility of losing it in the future.
This intriguing opportunity is known as arbitrage and arises when markets aren’t working
perfectly. In such cases, prices of related assets don’t match up as they should, opening a
brief window for risk-free gains.

In financial terms, arbitrage involves smartly buying and selling assets to lock in profits
without investing any money upfront. But here’s the catch: if markets were flawless, these
opportunities wouldn’t exist. Participants in financial markets are always on the lookout for
arbitrage chances. When they spot one, they act quickly to make a profit without taking on
any risk.

However, these chances are like shooting stars—they appear for just a short time before
disappearing. The No Arbitrage Principle reminds us that while these opportunities can
offer a quick way to profit, they’re limited and can’t be exploited indefinitely. It’s a reminder
Binomial Trees 85

that market efficiency and fair pricing are constantly at play, making sure that risk-free
profits remain a temporary phenomenon.

Let us denote Vt the value of a portfolio at time t. We consider two time points t = 0 and
t = T > 0.

Definition 3.1. We say that there exist an arbitrage if there is a portfolio V satisfying
one of the following conditions:
(i) V0 = 0, and VT ≥ 0 with probability one and VT > 0 with positive probability, or
(ii) V0 < 0, and VT ≥ 0 with probability one.
The no arbitrage principle means that one cannot create positive value out of nothing,
i.e., there is no free lunch.

3.2 Binomial Trees


A binomial tree is a visual and mathematical tool employed in financial modeling to evaluate
the possible price movements of an underlying asset over discrete time intervals. This
approach provides insights into option pricing, risk assessment, and various decision-making
processes within the realm of finance.

3.2.1 A one-step binomial model and a no-arbitrage argument


Let’s examine a straightforward scenario: the current stock price stands at $20 dollars. Over
the course of 3 months, there are two possible outcomes: the price may either rise to $22
dollars or fall to $18 dollars. Refer to Figure 3.1 for a visual representation.

Stock price =$22

Stock price = $20

Stock price =$18

Figure 3.1: Simple Binomial Model: Example

Let’s consider a 3-month call option for the stock with a strike price of $21. At the
conclusion of these three months, the corresponding payoffs for the two potential scenarios
are highlighted in Figure 3.2.
86 Binomial Trees

Stock price =$22


Option Payoff = $1

Stock price = $20


Option Price = ?

Stock price =$18


Option Payoff =$0

Figure 3.2: Stock price movements

In order to establish the premium for pricing the option at the outset, we operate under the
premise of eliminating any arbitrage opportunities. This involves constructing a portfolio
consisting of both the stock and the option in a manner that effectively eradicates uncertainty.

Consider a portfolio consisting of a long position in ∆ shares and a short position in 1 call
option. The portfolio attains a riskless status when the value of ∆ is carefully selected to

22∆ − 1

18∆

Figure 3.3: The value of the portfolio at the final period

ensure equivalence in the final portfolio value for both alternatives. Therefore, the portfolio
becomes riskless under the conditions:

22∆ − 1 = 18∆

or
∆ = 0.25.

A risk-free portfolio is, therefore, constructed as follows:

• Long: 0.25 shares


• Short: 1 option
Binomial Trees 87

When the stock price rises to $22, the portfolio’s value becomes:

22 × 0.25 − 1 = 4.50.

In the event of a stock price decline to $18, the portfolio’s value becomes:

18 × 0.25 = 4.50.

Irrespective of the two scenarios, the portfolio value remains constant at $4.5 throughout
the option’s lifespan.

In the realm of no arbitrage opportunities, riskless portfolios are expected to yield the risk-
free interest rate. Assuming a risk-free rate of 4% per annum (with continuous compounding),
the present value of the portfolio today must match the value of 4.5 in the future:

4.5e−0.04×0.25 = 4.455.

The value of the stock price today is known to be $20. Suppose the option price is denoted
by f . The value of the portfolio today is

20 × 0.25 − f = 5 − f.

It follows that
5 − f = 4.455,

or
f = 0.545.

This shows that, in the absence of artbitrage oportunities, the current value of the option
must be 0.545.

A Generalization
Let’s consider a stock with a current price of S0 and an associated option priced at f .
Assume that the option has a maturity of T , and during its lifespan, the stock price can
either increase from S0 to a new level S0 u (where u > 1), or decrease from S0 to a new
level S0 d (where d < 1). If the stock price rises, the option yields a payoff of fu , whereas a
downward movement results in a payoff of fd . Refer to Figure 3.4 for a graphical depiction.

Considering a portfolio that holds a long position in ∆ shares and is short 1 derivative, the
valuation unfolds as follows:
88 Binomial Trees

S0 u
p fu
S0
f
(1 − S0 d
p)
fd

Figure 3.4: Stock and option prices in a general one-step tree

In the event of an upward movement in the stock price, the portfolio’s value at the option’s
maturity becomes:
S0 u∆ − fu .

Conversely, if the stock price takes a downward plunge, the portfolio’s value transforms into:

S0 d∆ − fd .

The equilibrium between these values emerges when:

S0 u∆ − fu = S0 d∆ − fd .

This equation simplifies to:


fu − fd
∆= . (3.1)
S0 u − S0 d
Significantly, under this condition, the portfolio’s risk is eliminated, rendering it riskless.
Moreover, in order to maintain no arbitrage opportunities, the portfolio is mandated to yield
the risk-free interest rate.

The portfolio’s value at time T equals

S0 u∆ − fu .

The present value of the portfolio is

(S0 u∆ − fu )e−rT .

An alternative representation for the current portfolio value is

S0 ∆ − f.
Risk-Neutral Valuation 89

Consequently, the equation becomes

f = S0 ∆ − (S0 u∆ − fu )e−rT .

By Substituting for ∆ we obtain

f = [pfu + (1 − p)fd ]e−rT (3.2)

where
erT − d
p= . (3.3)
u−d
Naturally, we can interpret p and 1 − p as the probabilities associated with upward and
downward movements. In this context, the value of a derivative corresponds to its expected
payoff within a risk-neutral framework, discounted at the risk-free rate.

In the numerical example considered previously, u = 1.1, d = 0.9, r = 0.04, T = 0.25,


fu = 1, and fd = 0. From (3.3), we have

erT − d e0.04×0.25 − 0.9


p= = = 0.5503
u−d 1.1 − 0.9

and, form (3.2), we have p is the probability that gives a return on the stock equal to the
risk-free rate:
f = e0.04×0.25 (0.5503 × 1 + 0.4497 × 0) = 0.545

Remark 3.1. • When we are valuing an option in terms of the price of the underlying
asset, the probability of up and down movements in the real world are irrelevant.
• This is an example of a more general result stating that the expected return on the
underlying asset in the real world is irrelevant

3.3 Risk-Neutral Valuation


When valuing a derivative, we can make the assumption that investors are risk-neutral. A
world where investors are risk-neutral is referred to as a risk-neutral world. The world we
live in is, of course, not a risk-neutral world. The higher the risks investors take, the higher
the expected returns they require. However, it turns out that assuming a risk-neutral world
gives us the right option price for the world we live in, as well as for a risk-neutral world.

Risk-neutral valuation seems a surprising result when it is first encountered. Options are
risky investments. Should not a person’s risk preferences affect how they are priced? The
answer is that, when we are pricing an option in terms of the price of the underlying stock,
90 Risk-Neutral Valuation

risk preferences are unimportant. As investors become more risk-averse, stock prices decline,
but the formulas relating option prices to stock prices remain the same.

A risk-neutral world has two features that simplify the pricing of derivatives:

(1) The expected return on a stock (or any other investment) is the risk-free rate.
(2) The discount rate used for the expected payoff on an option (or any other instrument)
is the risk-free rate.

In equation (3.2),
f = [pfu + (1 − p)fd ]e−rT ,

the parameter p should be interpreted as the probability of an up movement in a risk-neutral


world, so that 1 − p is the probability of a down movement in this world. The expression

pfu + (1 − p)fd

is the expected future payoff form the option in a risk-neutral world and equation (3.2),
states that the value of the option today is its expected future payoff in a risk-neutral world
discounted at the risk-free rate. This is application of risk-neutral valuation.

To prove the validity of our interpretation of p, we note that, when p is the probability of
an up movement, the expected stock price E(ST ) at time T is given by

E(ST ) = pS0 u + (1 − p)S0 d

or
E(ST ) = pS0 (u − d) + S0 d

Substituting for p gives,


E(ST ) = S0 erT (3.4)

Remark 3.2. • Risk-neutral valuation is a very important general result in the pricing
of derivatives.
• It also works when the stock price follows a continuous-time stochastic process.
• It is a result that is true regardless of the assumptions made about the evolution
of the stock price.
Two-Step Binomial Trees 91

Remark 3.3. To apply risk-neutral valuation to the pricing of a derivative,


(1) calculate what the probabilities of different outcomes would be if the world were
risk-neutral.
(2) calculate the expected payoff from the derivative and
(3) discount that expected payoff at the risk-free rate of interest

3.4 Two-Step Binomial Trees


Expanding our analysis to encompass a two-step binomial tree, depicted in Figure 3.5, we
delve into an illustrative scenario. Here, the strike price stands at K = 21, the interest rate
1
r is 4%, and the time to maturity T is 2 year or 6 months. Each time interval spans 3
months. Our objective involves computing the option price at the initial node of the tree.

24.2
D
22
B
19.8
20 A E
18
C
16.2
F

Figure 3.5: Stock prices in a two step tree

The pricing process involves iteratively employing the procedures utilized in the single-period
scenario. Calculating the value at node B entails evaluating the expression e−0.04×0.25 (0.5503×
3.2+0.4497×0) = 1.7433. Similarly, the value at node A can be computed as e−0.04×0.25 (0.5503×
1.7433 + 0.4497 × 0) = 0.9497, as depicted in Figure (3.6).

3.5 A Put Example


Consider a 2-year European put with strike price K = 52, time step =1yr, the current price
is $50 , r = 5%, u = 1.2, d = 0.8. The tree is shown in (3.7).

e0.05×1 − 0.8
p= = 0.6282.
1.2 − 0.8
92 American Options

24.2
D
3.2
22
B
1.7433
19.8
20 A E
0.9497 0.0
18
C
0.0
16.2
F
0.0

Figure 3.6: Stock and option prices in a two-step tree. The upper number at each node is
the stock price and the lower number is the option price.

72
D
0.0
60
B
1.4147
48
50 A E
4.1923 4
40
C
9.4636
32
F
20

Figure 3.7: Using a two-step tree to value a European put option. At each node, the upper
number is the stock price and the lower number is the option price

3.6 American Options


In the case of pricing an American options, the procedure is to work back through the tree
form the end to the beginning, testing at each node to see whether early exercise is optimal.
When comparing the pricing of European put and American put options under identical
conditions, refer to Figures (3.7) and (3.8).

• The American feature increases the value at node C from 9.4636 to 12.0000.
• This results in an increase in the option’s value from 4.1932 to 5.0894.
Delta 93

72
D
0.0
60
B
1.4147
48
50 A E
5.0894 4
40
C
12.0
32
F
20

Figure 3.8: Using a two-step tree to value an American put option. At each node, the upper
number is the stock price and he lower number is the option price

3.7 Delta
The delta (∆), often called a “Greek letter”, is the proportion of the stock option price
change in relation to the underlying stock price change. It signifies the amount of stock
units required for every shorted option to craft a portfolio without risk. This ∆ corresponds
to the one introduced earlier in the examples, refer Equation (3.1). The ∆ value fluctuates
from node to node. The process of creating a risk-free portfolio is known as “delta hedging”.

3.8 Matching Volatility with u and d


The three parameters u, d, and p are crucial for constructing a binomial tree with a time
step ∆t. The parameters u and d must be chosen to match the volatility. One way to
achieve this alignment with volatility is by setting:

u = eσ ∆t , (3.5)
1 √
d = = e−σ ∆t . (3.6)
u

Here, σ represents the volatility, and ∆t denotes the length of the time step. This approach
aligns with the methodology employed by Cox, Ross, and Rubinstein (Cox et al., 1979).

The volatility of a stock (or any other asset), σ, is defined so that the standard deviation of

its return in a short period of time ∆t is σ ∆t. Equivalently the variance of the return in
time ∆t is σ 2 ∆t.

During a time step of length ∆t, there is a probability p that the sock will provide a return
94 Matching Volatility with u and d

of u − 1 and a probability 1 − p that will provide a return of d − 1. Let X denote the random
variable representing the return. Recall that, the variance of X is defined as E(X 2 )−[E(X)]2 .
It follows that volatility is matched if

p(u − 1)2 + (1 − p)(d − 1)2 + [p(u − 1) + (1 − p)(d − 1)]2 = σ 2 ∆t (3.7)

Substituting for p this simplifies to

er∆t (u + d) − ud − e2r∆t = σ 2 ∆t (3.8)

When terms in ∆t2 and higher powers of ∆t are ignored, a solution to the equation is
√ √
u = eσ ∆t
and d = e−σ ∆t
(3.9)

What happen if instead we match volatility in the real world? Suppose that p∗ is the
probability of an up-movement in the real world. Define µ as the expected return in the
real world. We must have
p∗ u + (1 − p∗ )d = eµ∆t

or
eµ∆t − d
p∗ = (3.10)
u−d
Suppose that σ is the volatility in the real world. The equation matching the variance is,

eµ∆t (u + d) − ud − e2µ∆t = σ 2 ∆t

Similar with the discussion as for the case of risk-neutral world, we have
√ √
u = eσ ∆t
and d = e−σ ∆t

Grisanov’s Theorem
The above results are closely related to an important result known as Girsanov’s theorem.
Moving form the risk neutral world to the real world, expected return from the stock price
changes, but its volatility remains the same.

• Volatility is the same in the real world and the risk-neutral world.
• We can therefore measure volatility in real world and use it to build a tree for the an
asset in the risk-neutral world.

Moving form one set of risk preferences to another is sometimes referred to as changing
Matching Volatility with u and d 95

them measure. The real-world measure is sometimes referred to as the P- measure, while the
risk-neutral world measure is referred to as the Q- measure.

3.8.1 Options on Other Assets


Options on Stocks with Continuous Dividend Yield:

We’ll begin by examining a scenario in which a stock provides a known dividend yield,
denoted as q. In a risk-neutral setting, the cumulative return from both dividends and
capital gains is expressed as r. The dividend yield contributes q to the return, while capital
gains account for r − q.

If the stock’s initial price is S0 , its anticipated value after a single time step of duration ∆t
equals S0 e(r−q)∆t . This expectation stems from the assumption that the stock price evolves
exponentially within the risk-neutral framework.

Hence, we can formulate this relationship as follows:

pS0 u + (1 − p)S0 d = S0 e(r−q)∆t

leading to

e(r−q)∆t − d
p= .
u−d

Options on Stock Indices:

Valuing an option on a stock index closely resembles the process for valuing an option on a
dividend-yielding stock.

Options on Currencies:

A foreign currency can be viewed as an asset generating a yield at the foreign risk-free
interest rate, rf . Drawing parallels with the stock index case, we can construct a tree for
currency options, with:

e(r−rf )∆t − d
p= .
u−d

Options on Futures:
96 Arbitrage Free Market(General Portfolio)

Taking either a long or short position in a futures contract involves no initial cost. In a
risk-neutral environment, this implies that a futures price should exhibit an expected growth
rate of zero. If F0 represents the initial futures price, the anticipated futures price at the
end of a time step ∆t remains F0 . Consequently, we have:

pF0 u + (1 − p)F0 d = F0

resulting in

1−d
p=
u−d

To summarize, for options on stock indices, currencies, and futures, the fundamental process
for constructing the tree remains consistent, with the key distinction lying in the calculation
of p:

a−d
p= , (3.11)
u−d

where:

(1) For non-dividend paying stocks, a = er∆t .


(2) For stock indices with a dividend yield (q), a = e(r−q)∆t .
(3) For currencies with a foreign risk-free rate (rf ), a = e(r−rf )∆t .
(4) For futures contracts, a = 1.

3.9 Arbitrage Free Market(General Portfolio)


Consider a one-period model of a financial market which is observed at times t = 0 and
t = T . Let N be the number of asset with prices St1 , St2 , . . . , StN at t = 0, T . What is known?
all the prices at t = 0.

What is uncertain? the prices at t = T , i.e., St1 , St2 , . . . , StN are random.

Uncertainty in the financial market at T is modeled using a finite number of possible future
states. Assume that there are M states at time T , which is represented by a sample space,

Ω = {ω1 , . . . , ωM }.

The probability that the future state is ωj is equal to pj > 0, 1 ≤ i ≤ M, p1 + · · · + pM = 1,


Arbitrage Free Market(General Portfolio) 97

and STi takes one of the values

STi (ω1 ), . . . , STi (ωM ),

depending on the future state. Let

St1
 
 2
 St 
 ..  ,
St =  
 . 
StN

and define the matrix of securities by,


 
ST1 (ω1 ) . . . ST1 (ωM )
 .. .. 
D=
 . .
,

N
ST (ω1 ) . . . STN (ωM )

the entry Dij represents the value (including dividend payments) of the ith asset the j th
state at time T .

A portfolio Vtπ of securities is defined by π · S t where


 
π1
 π2 
 
N
 ..  ∈ R ,
π= 
 . 
πN

and πi is the number of units of the ith asset held in the portfolio. It assumed to be constant
over the time interval [0, T ].

If πi > 0, then the investor has a long position in the ith asset and will receive cash flow
πi Dij at time T depending on the outcome.

If πi < 0 for some i, then the investor has a short position in the ith asset, i.e., he need to
borrow πi unit of S i at t = 0 and have the obligation to return it at time T .

The total value of the portfolio defined by π is equal to

N
X
Vtπ = πi Sti = π · S t , for t = 0, T. (3.12)
i=1
98 Arbitrage Free Market(General Portfolio)

In particular, for t = T , the cash flow of the portfolio in the j th state is,

N
X N
X
VTπ (ωj ) = πi STi (ωj ) = πi Dij . (3.13)
i=1 i=1

Definition 3.2 (Arbitrage Portfolio). Let d1 , . . . , dM denote the columns of D. An


arbitrage portfolio is a portfolio π satisfying one of the following conditions:
(i) π · S 0 = 0 (zero cost), and π · dj ≥ 0 for all j (no loss) and π · dk > 0 for some
k (possibility of profit), or
(ii) π · S 0 < 0, and π · dj ≥ 0 for all j.
If there does not exist any arbitrage portfolio, we say that the market is arbitrage free.

Definition 3.3 (Arrow - Debreu Security). If a securitya θti , 1 ≤ i ≤ M , satisfies the


condition that (
1, if i = j
θTi (ωj ) =
0, if i ̸= j,
then it is called an Arrow-Debreu security.
a A tradable financial instrument such as a stock and bond.

Definition 3.4 (State Price Vector). A column vector ψ = (ψ1 , . . . , ψM )t is called a


state price vector if ψi > 0 for every i, 1 ≤ i ≤ M, and

S 0 = Dψ. (3.14)

Equivalently, there exist positive constant ψ1 , . . . , ψM such that

S0i = ψ1 STi (ω1 ) + · · · + ψM STi (ωM ) (3.15)

for every 1 ≤ i ≤ N , or
S 0 = ψ1 d1 + · · · + ψM dM . (3.16)

Remark 3.4. • Note that (3.15) implies that the asset price today is equal to a
weighted average of its future values, with weights given by the state price vector
ψ.
• The weights ψi , 1 ≤ i ≤ M , are called the state prices, and ψi is the value of one
unit of the Arrow-Debreu security θi at time 0, i.e., ψi = θ0i , 1 ≤ i ≤ M.

Theorem 3.1. A market is arbitrage free if and only if there exists a state price vector.
Risk-Neutral Pricing and Martingale Measures 99

Definition 3.5 (Complete Market). If a contingent claima at time T is expressed


as a linear combination of the asset traded in the market, we say that the claim is
replicated, or hedged. If any contingent claim at T can be replicated, then we say that
the market is complete.
a Contingent Claim: A claim that can be made depending on whether one or more specified
outcomes occur or do not occur in the future

Theorem 3.2. The market is complete if and only if the rank of the matrix D of securities
is equal to M .

Proof.

3.10 Risk-Neutral Pricing and Martingale Measures


Theorem 3.3. Let ψ = (ψ1 , . . . , ψM ) be a state price vector. Assume that there exists a
risk-free securities, i.e., a risk-free bond, S 0 = 1 and ST0 = 1 + r regardless of future state,
where r > 0 is a constant that is regarded as the risk-free interest rate. Then

M
X 1
ψj = .
j=1
1+r

Proof. Since S 0 = ψ1 S10 (ω1 ) + · · · + ψM ST0 (ωM ) which implies

1 = ψ1 (1 + r) + · · · + ψM (1 + r)
M M
X X 1
1 = (1 + r) ψj =⇒ ψj =
j=1 j=1
1+r

Definition 3.6. Let

ψj
p∗j = PM = (1 + r)ψj > 0, 1 ≤ j ≤ M.
k=1 ψk

Then the positive constant p∗1 , . . . , p∗M add up to 1, and define a probability on the
future states ω1 , . . . , ωM , which is called a risk-neutral probability or a martingale
measure.
100 Risk-Neutral Pricing and Martingale Measures

Note that we can write,

S0i = ψ1 STi (ω1 ) + · · · + ψM STi (ωM )

as
M
X STi (ωk ) 1
S0i = p∗k = E∗ [STi ] (3.17)
1+r 1+r
k=1

where E∗ denotes the expectation under the martingale measure (p∗1 , . . . , p∗M ).
The idea given in (3.17) is called the risk-neutral pricing of financial claims.

Remark 3.5. The state price ψi , 1 ≤ i ≤ M , are the prices at time t = 0 of the Arrow-
Debreu securities θj , 1 ≤ j ≤ M . Indeed,
  M
1 j 1 X ∗ j 1 ∗
θ0j ∗
=E θ = pk θk (ωk ) = p = ψj .
1+r T 1+r 1+r j
k=1

Corollary 3.1. The following statements are equivalent:

(i) There exists a state price vector.


(ii) There exists a martingale measure.
(iii) The market is arbitrage-free.
Theorem 3.4. Suppose that the market is arbitrage-free. Then the market is complete if
and only if there exists a unique martingale measure.

The One Period Binomial Tree Model


Consider the case of two assets say, St1 , St2 at t = 0, T , i.e., N = 2. The market consists
of risky asset St1 = S and a risk-free asset B = St2 such as a bound. Assume two possible
states, M = 2, ωu and ωd .

Let C be any contingent claim with cash flows C u in state ωu and C d in state ωd at time T .

p∗u Cu

C0
pd∗
Cd

Figure 3.9: The one period binomial tree and the risk-neutral probabilities
Risk-Neutral Pricing and Martingale Measures 101

p∗u uS0

S0
pd∗
dS0

Figure 3.10: The one period binomial tree and the risk-neutral probabilities

If there are no arbitrage opportunities, then there exists a martingale measure (p∗u , p∗d ) such
that the price C0 at time 0 is given by

1 1
C0 = E∗ [CT ] = (p∗ C u + p∗d C d ). (3.18)
1+r 1+r u

1
Here the discounting factor is discrete 1+r . Recall that for the continuous case the discount
−rT
factor is e .

Furthermore, ST has values uS0 and dS0 where 0 < d < u depending on whether the future
state is up or down.

Then by (3.17) or (3.18) we have

1 1
S0 = E∗ [ST ] = (p∗ uS0 + p∗d dS0 ). (3.19)
1+r 1+r u

and
1 1
B0 = E∗ [CT ] = (p∗ (1 + r)B0 + p∗d (1 + r)B0 ) = B0 . (3.20)
1+r 1+r u
From (3.19), we have
1 + r = p∗u u + p∗d d. (3.21)

Since p∗u + p∗d = 1, we finally obtain

1+r−d u − (1 + r)
p∗u = and p∗u = .
u−d u−d

Thus p∗u > 0 and p∗d > 0 iff d < 1 + r < u.


Remark 3.6. • Note that p∗u > 0 and p∗d > 0 is the condition for the existence of a martingale
measure.
• Also note that the inequality d < 1 + r < u is the no arbitrage condition.
• if d < u ≤ 1 + r, for example, then every investor would buy the risk-free asset B making
a risk-free profit that is at leas the maximum possible profit form investment in the risky
102 Risk-Neutral Pricing and Martingale Measures

asset S.

For further reading: (Hull, 2021, Chapter 13) and (Choe et al., 2016, Chapter 1)
Risk-Neutral Pricing and Martingale Measures 103

Problems 3.1

(1) Consider a one period binomial model. Suppose S0 = 1 at t = T0 ; and Su = 2


1
and Sd = 2 at time T1 . If we assume the risk free rate R = 1.2,
(i) Compute the current value of a European put with strike K = 1.
(ii) Compute the number of units of stock we need to short in order to replicate
the option
(2) Can a trading rule based on the past history of a stock’s price ever produce
returns that are consistently above average? Discuss.
(3) A stock whose price is $30 has an expected return of 9% and a volatility of 20%.
In Python (or Excel), simulate the stock price path over 5 years using monthly
time steps and random samples from a normal distribution. Chart the simulated
stock price path.
(4) Suppose that a stock price has an expected return of 16% per annum and volatility
of 30% per annum. When the stock price at the end of a certain day is $50,
calculate the following:
(i) The expected stock price at the end of the next day
(ii) The standard deviation of the stock price at the end of the next day
(ii) The 95% confidence limit for the stock price at the end of the next day.
(5) Stock A, whose price is $30, has an expected return of 11% and a volatility of 25%.
Stock B, whose price is $40, has an expected return of 15% and a volatility of
30%. The processes driving the returns are correlated with correlation parameter
ρ. In Python (or Excel), simulate the two stock price paths over 3 months using
daily time steps and random samples from normal distributions. Consider values
for ρ equal to 0.25, 0.75, and 0.95.
104 Risk-Neutral Pricing and Martingale Measures
Chapter 4

Wiener Processes and Itô’s


Lemma(Applications)

In stochastic calculus and financial modeling, Wiener processes and Itô’s Lemma are
foundational concepts with a pivotal role in understanding continuous-time processes and
their financial applications. Itô’s Lemma is particularly useful in deriving differential
equations for asset prices and derivatives, helping assess how factors like volatility and
interest rates affect derivative prices. In finance, these concepts are crucial for option
pricing, risk assessment, and portfolio optimization, enabling the modeling of continuous
price movements and the valuation of financial instruments in dynamic markets.
Example 4.1. • Each day a stock price
– increases by $1 with probability 30%
– stays the same with probability 50%
– reduces by $1 with probability 20%
Example 4.2. Each day a stock price change is drawn from a normal distribution with
mean $0.2 and standard deviation $1.

Learning Outcomes
By the end of this chapter, you will be able to:
• Use Itô’s formula for diffusion process
• Identify the process for a stock price
• Apply Monte Carlo simulation

105
106 The Markov Property

4.1 The Markov Property


In finance, the Markov Property asserts that only the current state matters for predicting
future behavior, reshaping strategies based on historical data. This simplifies predictions and
aligns with weak-form market efficiency, where information is swiftly reflected in prices. In
this context, Wiener processes and Itô’s Lemma are indispensable tools for valuing options
and gauging financial instruments’ reactions to market changes.

4.2 Continuous-Time Stochastic Processes


Consider a random variable that follows a Markov stochastic processes, its currently value
is S0 = 40. Change in its value during a year is ϕ(0, 1), i.e., S1 − S0 = ϕ(0, 1) where
ϕ(m, ν) = ϕ(0, 1), denotes a normal distribution .

At the end of 1 year the variable will have a normal probability distribution with mean 40
and standard deviation 1.

S1 = S0 + ϕ(0, 1) = 40 + ϕ(0, 1).

What is the probability distribution of the stock price at the end of 2 years?

S2 = S1 + ϕ(0, 1) = S0 + ϕ(0, 1) + ϕ(0, 1).

The change in 2 years is the sum of two normal distributions, each of which has a mean
zero and variance 1. Since the variable is Markov, the two probability distributions are
independent. When we add two independent normal distributions, the result is a normal
distribution where the mean is the sum of the means and the variance is the sum of the
variances. Thus,
E(S2 − S0 ) = 0 and Var(S2 − S0 ) = 2.

the change in the variable over 2 years has distribution ϕ(0, 2). The standard deviation of

the change is 2.

With similar arguments, the change in the variable during

1
• 2 years or 6 months is ϕ(0, 0.5).
1
• 4 years is ϕ(0, 0.25),
• ∆t years is ϕ(0, ∆t).

Taking limits we have defined a continuous stochastic process


Continuous-Time Stochastic Processes 107

Variances and Standard Deviations

• In Markov processes changes in successive periods of time are independent


• This means that variances are additive
• Standard deviations are not additive
• In our example it is correct to say that the variance is 100 per year.
• It is strictly speaking not correct to say that the standard deviation is 10 per year.

Wiener Process/Brownian motion(revision)

Wiener process or Brownian motion is a particular type of Markov stochastic process


with mean change of zero and variance rate of 1 per year.
A variable W follows a Wiener process if it has the following two properties:
(1) The change in W during a small period of time ∆t is

∆W = ε ∆t,

where ε has a standard normal distribution ϕ(0, 1).


(2) The values of ∆W for any two different short intervals of time, ∆t, are are
independent.

It follows form the first property that ∆W itself has a normal distribution with

mean of ∆W = 0

standard deviation of ∆W = ∆t
variance of ∆W = ∆t.

Change in the value of W during a relatively long period of time, T . This can be denoted by
W (T ) − W (0). It can be regarded as the sum of the changes in W in N small time intervals
of length ∆t, where
T
N= .
∆t
Thus,
N
X √
W (T ) − W (0) = εi ∆t, εi = ϕ(0, 1)(i = 1, 2, . . . , N ).
i=1
108 Continuous-Time Stochastic Processes

It follows that W (T ) − W (0) is normally distributed, with

mean of [W (T ) − W (0)] = 0
variance of [W (T ) − W (0)] = N ∆t = T

standard deviation of [W (T ) − W (0)] = T

The notation dW as a Wiener process, means that it has the properties for ∆W given above
in the limit as ∆t → 0. The Figure in 4.1 is a simulation of Brownian motion.

1.2

1.0

0.8

0.6
W

0.4

0.2

0.0

−0.2

0.0 0.2 0.4 0.6 0.8 1.0


t

Figure 4.1: Brownian motion

Generalized Wiener Process

The basic Wiener process, dW , has a drift rate of 0 and a variance rate of 1. A
generalized Wiener process for a variable X can be defined in terms of dW as,

dX = adt + bdW, (4.1)

where a and b are constants, see Figure 4.2.

Mean change in X per unit time is a and variance of change in X per unit time is b2 . In a
small time interval ∆t, the change ∆X is given by

∆X = a∆t + bε ∆t.
Continuous-Time Stochastic Processes 109

It follows that ∆X is normally distributed, with

mean of ∆X = a∆t,
variance of ∆X = b2 ∆t,

standard deviation of ∆X = b ∆t.

Similarly, the change in the value of X in any time interval T is normally distributed with

mean of change in X = aT,



standard deviation of change in X = b T ,
varaince of change in X = b2 T.

10.5

10.4

10.3
X

10.2

10.1

10.0

0.0 0.2 0.4 0.6 0.8 1.0


t

Figure 4.2: A simulation generalized Brownian motion with a = 0.3, b = 0.2

Ito’s lemma for Brownian motion

If f is a twice differentiable function, then


Z t Z t
′ 1
f (Wt ) − f (W0 ) = f (Ws )dWs + f ′′ (Ws )ds, for all 0 ≤ t ≤ T. (4.2)
0 2 0
110 Continuous-Time Stochastic Processes

Example 4.2.1
Let us compute the stochastic integral:
Z T
Wt dWt .
0

To use the Itô’s lemma, we choose f (x) = x2 /2, then f ′ (x) = x and f ′′ (x) = 1. By
Itô’s lemma, we have

T T T
WT2 W2
Z Z Z
1 T
− 0 = Wt dWt + 1dt = Wt dWt +
2 2 0 2 0 0 2

Thus,
T
WT2
Z
T
Wt dWt = − .
0 2 2

4.2.1 Diffusion processes

A diffusion processes X = {Xt , 0 ≤ t ≤ T } is a continuous-time stochastic process that


can be written in the following form:
Z t Z t
Xt − X0 = a(Xs )ds + b(Xs )dWs , (4.3)
0 0

where a(·) and b(·) are deterministic functions and where X0 = x0 ∈ R initial value of the
processes X.

• a(x) is known as drift coefficient


• b(x) is called the diffusion or volatility coefficient

Diffusion process is generalization of linear Brownian motions. Recall that, a linear Brownian
motion Xt = X0 + µt + σWt can be written as
Z t Z t
Xt = X0 + µds + σdWs .
0 0

In other words, such linear Bm is diffusion process as with a constant drift coefficient
a(x) = µ and a constant volatility coefficient b(x) = σ.
The Process for a Stock Price 111

4.2.2 Stochastic differential equations


In many actuarial and financial models, the dynamics of a financial variable over time (e.g.
the stock price) is expressed with a stochastic differential equation.

Symbolically, a stochastic differential equation (SDE) is a stochastic equation: for given


functions a(·) and b(·), we are looking for a process X such that

dXt = a(Xt )dt + b(Xt )dWt , (4.4)

with initial condtion X0 = x0 . More rigorously, we are looking for a diffusion process X
such that Z t Z t
Xt − X0 = a(Xs )ds + b(Xs )dWs ,
0 0

4.2.3 Itô’s lemma for diffusion process


Let f (t, x) be a function of two variables, i.e. of time and space respectively, such that
∂g ∂2f
∂t and ∂x2 are both continuous.If X = {Xt , 0 ≤ t ≤ T } is a diffusion process solving the
general SDE given in (4.4), then the process Yt = f (t, Xt ) solves the following SDE:

∂f ∂f 1 ∂2f
df (t, Xt ) = (t, Xt )dt + (t, Xt )dXt + (t, Xt )(dXt )2 . (4.5)
∂t ∂x 2 ∂x2

Here (dXt )2 = (b(Xt ))2 dt. Hence substituting dXt by its expression in (4.4) and reorganizing
equation (4.5), we get

∂2f
 
∂f ∂f 1
df (t, Xt ) = (t, Xt ) + a(Xt ) (t, Xt ) + (b(Xt ))2 2 (t, Xt ) dt
∂t ∂x 2 ∂x
∂f
+ (t, Xt )b(Xt )dWt (4.6)
∂x

4.3 The Process for a Stock Price


Recall that the generalized Wiener process has a constant expected drift rate and a constant
variance rate. However, this is not appropriate for modeling stock price movements, as it
fails to capture a fundamental aspect of stock prices. Specifically, it does not account for the
fact that the expected percentage return required by investors from a stock is independent
of the stock’s price.

The assumption of a constant expected drift rate should be replaced by the assumption that
the expected return (i.e., the expected drift divided by the stock price) is constant.
112 The Process for a Stock Price

If S represents the stock price at time t, then the expected drift rate in S should be assumed
to be µS for some constant parameter µ. This implies that within a short interval of time,
∆t, the expected increase in S is µS∆t. The parameter µ serves as the expected rate of
return on the stock.

If the coefficient of dW is zero, so that there is no uncertainty, then this model implies that

∆S = µS∆t,

in the limit, as ∆t → 0, so that:


dS = µSdt,

or
dS
= µdt.
S
Integrating between time 0 and time T , we get

ST = S0 eµT (4.7)

where S0 and ST are the stock price at time 0 and time T . Equation (4.7) shows that, when
there is no uncertainty, the stock price grows at a continuously compounded rate of µ per
unit of time. In reality, there is uncertainty. A reasonable assumption is that the variability
of the return in a short period of time, ∆t, is the same regardless of the stock price. This
suggests that the standard deviation of the change in a short period of time ∆t should be
proportional to the stock price and leads to the model

dS = µSdt + σSdW,

or
dS
= µdt + σdW. (4.8)
S
Equation (4.8) is the most widely used model of stock price behavior. The variable µ is the
stock’s expected rate of return. The variable σ is is the volatility of the stock price. The
variable σ 2 is referred to as its variance rate. The model in equation (4.8) represents the
stock price process in the real world. In a risk-neutral world, µ equals the risk-free rate r.
The Process for a Stock Price 113

Discrete-Time Model
The model of stock price behavior (4.8) is known as geometric Brownian motion. The
discrete-time version of the model is

∆S √
= µ∆t + σε ∆t, (4.9)
S

or

∆S = µS∆t + σSε ∆t. (4.10)

Remark 4.1. • ∆S is the change in the stock price S in a small time interval ∆t,
• ε has a standard normal distribution.
• The left-hand side of equation (4.9) is the discrete approximation to the return provided
by the stock in a short period of time, ∆t.
• The term µ∆t is the expected value of this return, and

• the term σε ∆t is the stochastic component of the return. The variance of the stochastic
component is σ 2 ∆t.
• Equation (4.9) shows that ∆S
S is approximately normally distributed with mean µ∆t and

standard deviation σ ∆t. In other words,

∆S
∼ ϕ(µ∆t, σ 2 ∆t) (4.11)
S

Example 4.3.1
• We can sample random paths for the stock price by sampling values for ε
1
• Suppose µ = 0.15, σ = 0.30, and ∆t = 1 week (= 52 or 0.0192 years), then

∆S = 0.15 × 0.0192S + 0.30 × 0.0192Sε,

or
∆S = 0.00288S + 0.0416Sε.

Monte Carlo Simulation


A Monte Carlo simulation of a stochastic process is a procedure for sampling random
outcomes for the process.

Listing 4.1: Python functions for Monte Carlo simulation


1
114 The Process for a Stock Price

Table 4.1: Simulation of stock price when µ = 0.15 and σ = 0.30 during 1-week periods.
Time Stock price at Random Change in Stock
0.00 100.00 0.00 -0.73
0.00 99.27 -0.06 -0.05
0.01 99.22 -2.14 -3.96
0.01 95.27 1.64 3.14
0.02 98.41 -1.79 -3.18
0.02 95.23 -0.84 -1.51
.. .. .. ..
. . . .
0.98 100.09 0.38 0.79
0.99 100.88 0.51 1.03
0.99 101.91 -0.33 -0.58
1.00 101.33 -0.28 -0.49
1.00 100.85 0.54 1.09

2 d e f path ( S0 , mu, sigma , T, N) :


3 ”””
4 A f u n c t i o n f o r s i m u l a t i n g one p o s s i b l e path f o r s t o c k p r i c e :
5 Parameters :
6 mu : expted retun
7 simga : volatility
8 T : l e n g t h o f time f o r s i m u l a t i o n
9 N : number o f p e r i o d s
10 S0 : i n i t i a l price
11 Outputs :
12 S : p o s s i b l e p a t t e r n o f s t o c k p r i c e movement b/ 0 and T
13 R sample : t h e random s a m p l e s
14 changes : the changes in stock p r i c e during period
15 ”””
16 np . random . s e e d ( 2 ) # for consistency
17 t = np . l i n s p a c e ( 0 , T, N)
18 dt = t [ 1 ] - t [ 0 ]
19 S = np . z e r o s ( l e n ( t ) )
20 S [ 0 ] = S0
21 R sample = np . z e r o s l i k e ( t )
22 e = np . random . normal ( 0 , 1 )
23 c h a n g e s = np . z e r o s l i k e ( t )
24 dS = mu∗ dt ∗ S0 + S0 ∗ sigma ∗np . s q r t ( dt ) ∗ e
25 c h a n g e s [ 0 ] = dS
26 f o r i in range (1 , len ( t ) ) :
27 S [ i ] = dS + S [ i - 1 ]
28 e = np . random . normal ( 0 , 1 )
29 R sample [ i ] = e
30 dS = mu∗ dt ∗S [ i - 1 ] + S [ i - 1 ] ∗ sigma ∗np . s q r t ( dt ) ∗ e
31 c h a n g e s [ i ] = dS

The following code is an example for applying the Monte Carlo simulation.
Correlated Processes 115

1 # Example
2 mu = 0 . 1 5
3 sigma = 0 . 3
4 N = 252
5 T = 1
6 S0 = 100
7 # c a l l the f u n c t i o n
8 S , R sample , changes , t = path ( S0 , mu, sigma , T, N)
9

10 plt . plot ( t , S , 'b ' )


11 plt . xlabel ( ' t ' )
12 plt . y l a b e l ( ' $S ( t ) $ ' )
13 plt . grid ()
14 plt . s a v e f i g ( ”MCs . e p s ” )
15 plt . show ( )

The plot for the above simulation in indicated in Figure 4.3

115

110

105

100
S(t)

95

90

85

80

0.0 0.2 0.4 0.6 0.8 1.0


t

Figure 4.3: One possible the price movement for S0 = 100, µ = 0.15, σ = 0.3, T = 1

4.4 Correlated Processes


Suppose that the the processes followed by two variables X1 and X2 are

dX1 = a1 dt + b1 dW1 and


dX2 = a2 dt + b2 dW2 ,
116 Correlated Processes

where dW1 and dW2 are Wiener processes. The discrete-time approximations for these
processes are:

∆X1 = a1 ∆t + b1 ε1 ∆t and

∆X2 = a2 ∆t + b2 ε2 ∆t,

where ε1 and ε2 are random samples form a standard normal distribution.

Let ρ be the correlation of the processes X1 and X2 . To sample standard normal variables
ε1 and ε2 with correlation ρ, we can set
p
ε1 = u and ε2 = ρu + 1 − ρ2 v

where u and v are sampled as uncorrelated variables with standard normal distributions.
The Listing 4.2 is a Python function for Monte Carlo simulation of two stocks.

Listing 4.2: Python functions for Monte Carlo simulation of two stocks
1 d e f t w o s t o c k s ( S01 , S02 , mu1 , mu2 , sigma1 , sigma2 , rho , T, N) :
2 ”””
3 A f u n c t i o n f o r s i m u a t i n g one p o s s i b l e path f o r two c o r r e l a t e d s t o c k s
4 ”””
5 t = np . l i n s p a c e ( 0 , T, N)
6 dt = t [ 1 ] - t [ 0 ]
7 S1 = np . z e r o s ( l e n ( t ) )
8 S2 = np . z e r o s ( l e n ( t ) )
9

10 S1 [ 0 ] = S01
11 S2 [ 0 ] = S02
12

13 np . random . s e e d ( 2 )
14 f o r i in range (1 , len ( t ) ) :
15 u = np . random . normal ( 0 , 1 )
16 v = np . random . normal ( 0 , 1 )
17 e1 = u
18 e2 = rho ∗u + np . s q r t ( 1 - rho ∗ ∗ 2 ) ∗v
19 dS1 = mu1∗ dt ∗ S1 [ i - 1 ] + S1 [ i - 1 ] ∗ sigma1 ∗np . s q r t ( dt ) ∗ e1
20 dS2 = mu2∗ dt ∗ S2 [ i - 1 ] + S2 [ i - 1 ] ∗ sigma2 ∗np . s q r t ( dt ) ∗ e2
21 S1 [ i ] = dS1 + S1 [ i - 1 ]
22 S2 [ i ] = dS2 + S2 [ i - 1 ]
23 r e t u r n S1 , S2 , t

For an illustration, see the following code and the graphical out come in Figure 4.4

1 # Example
2 # Stock1
3 S01 = 30
Correlated Processes 117

4 mu1 = 0 . 1 1
5 sigma1 = 0 . 2 5
6 # Stock2
7 S02 = 40
8 mu2 = 0 . 1 5
9 sigma2 = 0 . 3 0
10

11 # corrolations
12 rhos = [ - 0 . 7 5 , 0.25 , 0.75 , 0 . 9 5 ]
13 T = 1
14 N = 252
15 f i g , a x s = p l t . s u b p l o t s ( 2 , 2 , f i g s i z e =(12 , 8 ) )
16 conter = 0
17 f o r rho , ax i n z i p ( rh os , a x s . r a v e l ( ) ) :
18 S1 , S2 , t = t w o s t o c k s ( S01 , S02 , mu1 , mu2 , sigma1 , sigma2 , rho , T, N)
19 ax . p l o t ( t , S1 , ' b ' )
20 ax . p l o t ( t , S2 , ' k ' )
21 ax . l e g e n d ( [ ' S t o c k 1 ' , ' S t o c k 2 ' ] )
22 ax . s e t t i t l e ( ' rho = '+s t r ( rho ) )
23 ax . s e t x l i m ( [ 0 , T ] )
24 ax . g r i d ( True )
25

26 p l t . s a v e f i g ( ” MCs 2Stocks . e p s ” )

rho = -0.75 rho = 0.25


Stock1 Stock1
55 Stock2 50 Stock2
50 45
45
40
40
35
35
30
30

25 25

0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
rho = 0.75 rho = 0.95
Stock1 Stock1
45 Stock2 45 Stock2

40 40

35 35

30 30

25 25

0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0

Figure 4.4: A plot for Monte Carlo simulation for four different correlations scenario.
118 Applying Itô’s lemma on the stock price process

4.5 Applying Itô’s lemma on the stock price process


The stock price process is
dS = µSdt + σSdW (4.12)

For a function G of S and t

∂G 1 ∂ 2 G 2 2
 
∂G ∂G
dG = µS + + σ S dt + σSdW (4.13)
∂S ∂t 2 ∂S 2 ∂S

Application to Forward Contracts


Define F as the forward price at a general time t, and S as the stock price at time t, with
t < T . The relationship between F and S is given by

F = Ser(T −t) (4.14)

Assuming that the process for S is given by equation (4.12), we can use Itô’s lemma to
determine the process for F .

∂F ∂2F ∂F
= er(T −t) , = 0, = −rSer(T −t)
∂S ∂S 2 ∂t

From equation (4.13), the process for F is given by

dF = [er(T −t) µS − rSer(T −t) ]dt + er(T −t) σSdW

Substituting F for Ser(T −t) gives

dF = (µ − r)F dt + σF dW

Like S, the forward price F follows geometric Brownian motion. It has the same volatility
as S and an expected growth rate of µ − r rather than µ.

The Lognormal Property


The log of a stock price
G = ln S

Since
∂G 1 ∂2G 1 ∂G
= , = − 2, =0
∂S S ∂S 2 S ∂t
Python Implementations 119

it follows from equation (4.13) that the process followed by G is

σ2
 
dG = µ− dt + σdW
2

Since µ and σ are constant, this equation indicates that G = ln S follows a generalized
2
Wiener process. It has constant drift rate µ − σ2 and constant variance rate σ 2 . The change
in ln S between time 0 and some future time T is therefore normally distributed, with mean
σ2
(µ − 2 )T and variance σ 2 T . This means that

σ2
  
2
ln ST − ln S0 ∼ ϕ µ− T, σ T (4.15)
2

or
σ2
   
ln ST ∼ ϕ ln S0 + µ − T, σ 2 T (4.16)
2
where ST is the stock price at time T , S0 is the stock price at time 0. Equation (4.16) shows
that ln ST is normally distributed. The model of stock price behavior we have developed
in this chapter therefore implies that a stock’s price at time T , given its price today, is

log-normally distributed. The standard deviation of the logarithm of the stock price is σ T .
It is proportional to the square root of how far ahead we are looking. For further reading:
(Hull, 2021, Chapter 14)

4.6 Python Implementations


(1) Simulation of Wiener process
(2) Simulation of generalized Wiener process
(3) Monte Carlo simulation
(4) Simulation of correlated stock process
120 Python Implementations

Simulation of Wiener process/Brownian motion


[1]: import numpy as np
import matplotlib.pyplot as plt

[2]: T = 1 # the time horizon is one year


N = 12 # numbers of trading periods in a year
t = np.linspace(0, T, N) # dividing the interval [0, T] into N equal period

[3]: dt = t[1] - t[0] # length of each time period

[4]: z = [] # creating empty list for storing the values


z0 = 0 # the process starts with value 0
z.append(z0) # appending the empty list with new value
for i in range(1, len(t)):
next_z = z[i-1] + np.sqrt(dt)*np.random.normal(0, 1)
z.append(next_z)

[5]: z

[5]: [0,
-0.04492082756994361,
0.06413135919754354,
0.5829015791380767,
0.5268946041079664,
0.26150283373756494,
0.13399465941549557,
0.6722713073264389,
0.1491715836377906,
0.3757823994383025,
0.35747840264144637,
0.8550366145286061]

[6]: plt.plot(t, z, '--o')


plt.xlabel('t')
plt.ylabel('z')
plt.grid()

1
Python Implementations 121

[7]: def Wiener_process(T, N):


"""
A function for generating Brownian motion
"""
t = np.linspace(0, T, N)# dividing the interval [0, T] into N equal period
z = [] # creating empty list for storing the values
z0 = 0 # the process starts with value 0
z.append(z0) # appendin the empty list with new
for i in range(1, len(t)):
next_z = z[i-1] + np.sqrt(dt)*np.random.normal(0, 1)
z.append(next_z)
return z , t

[8]: T = 1
# we will do the simulation for different N's
N1 = 21
N2 = 101
N3 = 365

[9]: # Call the function


z1, t1 = Wiener_process(T, N1)
z2, t2 = Wiener_process(T, N2)
z3, t3 = Wiener_process(T, N3)

2
122 Python Implementations

[10]: # plot the reuslt


fig , ax = plt.subplots(3,1, figsize=(10, 10))

ax[0].plot(t1, z1, 'k')


ax[0].set_xlabel('Relatively large value $\Delta t$')
ax[0].set_ylabel('$z_1$')

ax[1].plot(t2, z2, 'g')


ax[1].set_xlabel('smaller value of $\Delta t$')
ax[1].set_ylabel('$z_2$')

ax[2].plot(t3, z3, 'r')


ax[2].set_xlabel("The true process obtained as $\Delta t$ goes to 0")
ax[2].set_ylabel('$z_3$');

3
Python Implementations 123

The simulation of generalized Wiener precess


dx = adt + bdz
In discrete form, p
∆x = a∆t + bϵ (∆t)

[11]: def gWiener_process(T, N, x0, a, b):


"""
A function for generating a generalized Brownian motion
"""
t = np.linspace(0, T, N) # dividing the interval [0, T] into N equal period
x = [] # creating empty list for storing the values
x.append(x0) # appendin the empty list with new
for i in range(1, len(t)):
next_x = x[i-1]+ a*dt + b*np.sqrt(dt)*np.random.normal(0, 1)
x.append(next_x)
return x , t

[12]: # Example
T = 1
N = 252
a = 0.3
b = 0.2
x0 = 10

# call the funcitontion


x, t = gWiener_process(T, N, x0, a, b)

[13]: plt.plot(t, x)
plt.xlabel('t')
plt.ylabel('x');

4
124 Python Implementations

Monte Carlo Simulation


[14]: def path(S0, mu, sigma, T, N):
"""
A function for simulating one possible path for stock price:
Parameters:
mu : expted retun
simga : volatility
T : length of time for simulation
N : number of periods
S0 : initial price
Outputs:
S : possible patter of stock price movement b/ 0 and T
R_sample : the random samples
changes : the changes in stock price during period
"""
t = np.linspace(0, T, N)
dt = t[1] - t[0]
S = np.zeros(len(t))
S[0] = S0
R_sample = np.zeros_like(t)
e = np.random.normal(0, 1)
changes = np.zeros_like(t)
dS = mu*dt*S0 + S0*sigma*np.sqrt(dt)*e

5
Python Implementations 125

changes[0] = dS
for i in range(1, len(t)):
S[i] = dS + S[i-1]
e = np.random.normal(0,1)
R_sample[i] = e
dS = mu*dt*S[i-1] + S[i-1]*sigma*np.sqrt(dt)*e
changes[i] = dS
return S.round(2) , R_sample.round(2), changes.round(2), t.round(2)

[15]: # Example
mu = 0.15
sigma = 0.3
N = 252
T = 1
S0 = 100
# call the function
S, R_sample, changes, t = path(S0, mu, sigma, T, N)

[16]: print(S[-1]) # the simulated price of the stock at T, S_T

112.41

[17]: plt.plot(t, S, 'b')


plt.xlabel('t')
plt.ylabel('$S(t)$')
plt.show()

6
126 Python Implementations

[18]: import pandas as pd


data = {'Stock price':S, 'Random sample': R_sample, 'Changes': changes}
summary_table = pd.DataFrame(data, index = t)
summary_table

[18]: Stock price Random sample Changes


0.00 100.00 0.00 4.00
0.00 104.00 -1.15 -2.12
0.01 101.89 0.93 1.89
0.01 103.78 0.67 1.36
0.02 105.14 0.29 0.64
... ... ... ...
0.98 108.63 0.27 0.64
0.99 109.27 -0.31 -0.58
0.99 108.70 0.47 1.03
1.00 109.73 1.27 2.69
1.00 112.41 1.87 3.96

[252 rows x 3 columns]

Simulation of correlated stock process


[19]: def two_paths(S01, S02, mu1, mu2, sigma1, sigma2, rho, T, N):
"""
A function for simuating one possible path for two correlated stocks
"""
t = np.linspace(0, T, N)
dt = t[1]-t[0]
S1 = np.zeros(len(t))
S2 = np.zeros(len(t))

S1[0] = S01
S2[0] = S02

#
for i in range(1, len(t)):
u = np.random.normal(0, 1)
v = np.random.normal(0, 1)
e1 = u
e2 = rho*u + np.sqrt(1-rho**2)*v
dS1 = mu1*dt*S1[i-1] + S1[i-1]*sigma1*np.sqrt(dt)*e1
dS2 = mu2*dt*S2[i-1] + S2[i-1]*sigma2*np.sqrt(dt)*e2
S1[i] = dS1 + S1[i-1]
S2[i] = dS2 + S2[i-1]
return S1, S2, t

7
Python Implementations 127

[20]: # Example
# Stock1
S01 = 30
mu1 = 0.11
sigma1 = 0.25
# Stock2
S02 = 40
mu2 = 0.15
sigma2 = 0.30

# corrolations
rhos = [-0.75, 0.25, 0.75, 0.95]
T = 1
N = 252
fig, axs = plt.subplots(2, 2, figsize=(12, 8))
conter = 0
for rho, ax in zip(rhos, axs.ravel()):
S1, S2, t = two_paths(S01, S02, mu1, mu2, sigma1, sigma2, rho, T, N)
ax.plot(t, S1, 'b')
ax.plot(t, S2, 'k')
ax.legend(['Stock1', 'Stock2'])
ax.set_title('rho = '+str(rho))
ax.set_xlim([0, T])
plt.show()

8
128 Problems

4.7 Problems
(1) A stock whose price is $30 has an expected return of 9% and a volatility of 20%. In
Python (or Excel), simulate the stock price path over 5 years using monthly time steps
and random samples from a normal distribution. Chart the simulated stock price path.
(2) Suppose that a stock price has an expected return of 16% per annum and volatility of
30% per annum. When the stock price at the end of a certain day is $50, calculate the
following:
(1) The expected stock price at the end of the next day
(2) The standard deviation of the stock price at the end of the next day
(3) The 95% confidence limit for the stock price at the end of the next day.
(3) Stock A, whose price is $30, has an expected return of 11% and a volatility of 25%.
Stock B, whose price is $40, has an expected return of 15% and a volatility of 30%. The
processes driving the returns are correlated with correlation parameter ρ. In Python (or
Excel), simulate the two stock price paths over 3 months using daily time steps and
random samples from normal distributions. Consider values for ρ equal to 0.25, 0.75,
and 0.95.
Chapter 5

The Black-Scholes-Merton Model

The Black-Scholes-Merton model stands as a groundbreaking framework in the realm


of quantitative finance, offering a robust methodology for valuing financial derivatives,
particularly options. This model has revolutionized the understanding and pricing of options,
providing a theoretical foundation that has transformed the financial industry.

5.1 Lognormal Property of Stock Prices


Consider a stock with a price denoted as S. In a brief interval of time of length ∆t, the
∆S
percentage return on the stock, represented by S , follows a normal distribution:

∆S
∼ ϕ µ∆t, σ 2 ∆t .

(5.1)
S

Here, µ represents the expected return, and σ stands for the volatility of the stock. This
probabilistic framework captures the inherent uncertainty and variability in stock price
movements within a compact time span, forming a crucial underpinning for modeling
financial assets’ behavior.

Recall that the implementation of Itô’s formula on the log of a stock price G = ln S satisfies
the stochastic differential equation,

σ2
 
dG = d ln S = µ− dt + σdW.
2

129
130 Lognormal Property of Stock Prices

It follows that,
σ2
  
2
ln ST − ln S0 ∼ ϕ µ− T, σ T ,
2
so that
σ2
  
ST 2
ln ∼ϕ µ− T, σ T , (5.2)
S0 2
and
σ2
   
2
ln ST ∼ ϕ ln S0 + µ − T, σ T . (5.3)
2

Since the logarithm of ST is normal, ST is log-normally distributed.

• µ : Expected return in a short period of time (annualized).


• σ : Volatility of the stock price.
 
σ2
• The mean of ln ST is ln S0 + µ − 2 T.

• The standard deviation of ln ST is σ T .

Remark 5.1. Recall the 68 − 95 − 99.7 rule:

P (µ − 1σ ≤ X ≤ µ + 1σ) ≈ 68.27%
P (µ − 2σ ≤ X ≤ µ + 2σ) ≈ 95.45%
P (µ − 3σ ≤ X ≤ µ + 3σ) ≈ 99.73%
P (µ − 1.96σ ≤ X ≤ µ + 1.96σ) ≈ 95%

For the case X = ln ST , With 95% confidence level,

σ2 √ σ2 √
   
ln S0 + µ − T − 1.96σ T ≤ ln ST ≤ ln S0 + µ − T + 1.96σ T
2 2

or √ √
2 2
 
ln S0 + µ− σ2 T −1.96σ T ln S0 + µ− σ2 T +1.96σ T
e ≤ ST ≤ e

Example 5.1.1

Consider a stock with: initial price, S0 = $40, expected return µ = 0.16 per annum,
and volatility σ = 20% per annum. Then the probability distribution of the stock
price ST in 6 months’ time T = 0.5 is given by

ln ST ∼ ϕ[ln 40 + (0.16 − 0.22 /2) × 0.5, 0.22 × 0.5]


ln ST ∼ ϕ(3.759, 0.002)
Lognormal Property of Stock Prices 131

with 95% confidence,

e3.759−1.96×0.141 ≤ ST ≤ e3.759+1.96×0.141

or
32.55 ≤ ST ≤ 56.56

A variable that has a lognormal distribution can take any value between 0 and ∞. Figure
(5.1) illustrates the shape of a lognormal distribution. It is skewed so that the mean, median,
and mode are all different. One can show that the excpeted value and variance of ST are

0.25

0.20

0.15

0.10

0.05

0 2 4 6 8 10

Figure 5.1: Lognormal distribution

given by

E(ST ) = S0 eµT , (5.4)


2
Var(ST ) = S02 e2µT (eσ T − 1). (5.5)

Indeed, since ST ∼ LN(ln S0 + (µ − σ 2 /2)T, σ 2 T ), using the formula (2.6) and (2.7), follows
(5.4) and (5.5).

Example 5.1.2

Consider a stock where: Current price S0 = $20, Expected return µ = 20% per
annum, and Volatility σ = 40% per annum. Find the expected stock price, and the
variance of the stock price, in 1 year.
132 The Distribution of the Rate of Return

5.2 The Distribution of the Rate of Return


If x is the realized continuously compounded return between 0 and T , then

ST = S0 exT
1 ST
x= ln (5.6)
T S0

From equation (5.2),


σ2 σ2
 
x∼ϕ µ− , (5.7)
2 T

Thus, the continuously compounded rate of return per annum is normally distributed with
2
mean µ − σ2 and standard deviation √σ
T
. As T increase, the standard deviation of x declines.
i.e, we are more certain about the average return over long period of time.

5.3 The Expected Return


The model for stock price behavior implies that, in a very short period of time ∆t the mean
return is µ∆t. It is natural to assume from this that µ is the expected continuously com-
pounded return on the stock. However, this is not the case. The continuously compounded
return, x, actually realized over a period of time of length T is given by equation (5.6) as

1 ST
x= ln .
T S0

σ2
and, as indicated in equation (5.7), the expected value E(x) = µ − 2 .

For another explanation, we start with

E(ST ) = S0 eµT

Taking logarithms, we get


ln[E(ST )] = ln(S0 ) + µT

It is now tempting to set ln[E(ST )] = E[ln(ST )], so that ln[E(ST )] − ln(S0 ) = µT, or
E[ln( SST0 )] = µT , which leads to E(x) = µ. However, we cannot do this because ln is a
nonlinear function. In fact, ln[E(ST )] > E[ln(ST )], so that E[ln( SST0 )] < µT , which leads to
σ2
E(x) < µ. (As shown above, E(x) = µ − 2 )

Mutual Fund Returns∗


∗ a financial vehicle that pools assets from shareholders to invest in securities like stocks, bonds, money
Volatility 133

• Suppose that returns in successive years are 15%, 20%, 30%, −20% and 25% (measure
using annual compounding).
• The arithmetic mean of the returns is 14%.
• The returned that would actually be earned over the five years (the geometric mean) is
12.4% (ann. comp.)
• The arithmetic mean of 14% is analogous to µ
σ2
• The geometric mean of 12.4% is analogous to µ − 2

5.4 Volatility
The volatility is the standard deviation of the continuously compounded rate of return in 1
year. The standard deviation of the return in a short time period time ∆t is approximately

σ ∆t.

Example 5.4.1

If a stock price is $50 and its volatility is 25% per year what is the standard deviation
of the price change in one day?

Estimating Volatility from Historical Data


1
(1) Take observations S0 , S1 , . . . , Sn at intervals of τ years (e.g. for weakly data τ = 52 )
(2) Calculate the continuously compounded return in each intervals as:
 
Si
ui = ln
Si−1

(3) Calculate the standard deviation, s, of the u′i s


(4) The historical volatility estimate is: σ̂ = √s .
τ

Nature of Volatility

• Volatility is usually much greater when the market is open (i.e. the asset is trading) than
when it is closed.
• For this reason time is usually measured in “trading days” not calendar days when options
are valued
• It is assumed that there are 252 trading days in one year for most assets

market instruments, and other assets.


134 The Idea Underlying The Black-Scholes-Merton Differential Equation

Example 5.4.2
• Suppose it is April 1 and an option lasts to April 30 so that the number of days
remaining is 30 calendar days or 22 trading days
• The time to maturity would be assumed to be 22/252 = 0.0873 years

5.5 The Idea Underlying The Black-Scholes-Merton Dif-


ferential Equation

The relationship between option prices and stock prices is intrinsically linked through their
shared dependence on a common source of uncertainty. To eliminate this uncertainty,
a portfolio can be strategically constructed, comprising both the stock and the option.
Remarkably, this portfolio achieves instantaneous risklessness, ensuring that it must, by
necessity, earn the risk-free rate at any given moment. This pivotal insight underpins the
development of the Black-Scholes-Merton differential equation, which serves as a cornerstone
in option pricing theory.

Assumptions:
The assumptions we use to derive the Black-Scholes-Merton differential equations are as
follows:

(1) The stock price follows the process

dS = µSdt + σSdW,

whith µ and σ constant.


(2) The short selling of securities with full use of proceeds is permitted.
(3) There are no transaction cost or taxes. All securities are perfectly divisible.
(4) There are no dividends during the life of the derivative.
(5) There are no riskless arbitrage opportunities.
(6) Security trading is continuous.
(7) The risk-free rate of interest, r, is constant and the same for all maturities.
The Derivation of the Black-Scholes-Merton Differential Equations 135

5.6 The Derivation of the Black-Scholes-Merton Differ-


ential Equations
The stock price process
dS = µSdt + σSdW,

in discrete form,
∆S = µS∆t + σS∆W (5.8)

Let f = f (S, t) be the price of a call option or other derivative contingent on S , then
applying Ito’s formula and the discrete version gives,

1 ∂2f 2 2
 
∂f ∂f ∂f
∆f = µS + + 2
σ S ∆t + σS∆W (5.9)
∂S ∂t 2 ∂S ∂S

We set up a portfolio consisting of

−1 : derivative (5.10)
∂f
+ : shares (5.11)
∂S

This gets rid of the dependence on ∆W. The value of the portfolio, Π, is given by

∂f
Π = −f + S (5.12)
∂S

The change in its value in time ∆t is given by

∂f
∆Π = −∆f + ∆S (5.13)
∂S

Substituting equations (5.8) and (5.9) into equation (5.13) gives,

1 ∂2f 2 2
 
∂f
∆Π = − − σ S ∆t (5.14)
∂t 2 ∂S 2

The return on the portfolio must be the risk-free rate. Hence

∆Π = rΠ∆t (5.15)

Substituting from equation (5.12) and (5.14) into (5.15), we obtain the Black-Scholes
differential equation:
∂f ∂f 1 ∂2f
+ rS + σ 2 S 2 2 = rf (5.16)
∂t ∂S 2 ∂S
136 The Derivation of the Black-Scholes-Merton Differential Equations

The Differential Equation


Any security whose price is dependent on the stock price satisfies the differential equation
(5.16). The particular security being valued is determined by the boundary conditions of the
differential equation. In the case of a European call option, the key boundary condition is,

f = max(S − K, 0) when t = T

In the case of a European put option, it is

f = max(K − S, 0) when t = T

Example 5.6.1
A forward contract on a non-dividend paying stock is a derivative dependent on the
stock. It should satisfy equation (5.16). In a forward contract the boundary condition
is f = S–K when t = T . We know that the the value of the forward contract is

f = S–Ke–r(T –t)

where K is the delivery price. This means that

∂f ∂f ∂2f
= −rKe−r(T −t) , = 1, =0
∂t ∂S ∂S 2

When these are substituted into the left-hand side of equation (5.16), we obtain

−rKe−r(T −t) + rS

This equals rf , showing that equation (5.16) is indeed satisfied.

Perpetual Derivative

Consider a perpetual derivative that pays off a fixed amount Q when the stock price equals
H for this time.

For a perpetual derivative there is no dependence on time and the differential equation
becomes an ordinary differential equation.

df 1 d2 f
rS + σ 2 S 2 2 = rf
dS 2 dS
Risk-Neutral Valuation 137

If S < H, the boundary conditions f = 0 when S = 0 and f = Q when S = H. The solution

QS
f=
H

If S > H, the boundary condition are f = 0 as S → ∞ and f = Q, when S = H. The value


of the derivative is
S −2r/σ2
f = Q( )
H

5.7 Risk-Neutral Valuation


The variable µ does not appear in the Black-Scholes-Merton differential equation. The
equation is independent of all variables affected by risk preference. The solution to the
differential equation is therefore the same in a risk-free world as it is in the real world. This
leads to the principle of risk-neutral valuation. Applying Risk-Neutral Valuation

(1) Assume that the expected return from the stock price is the risk-free rate
(2) Calculate the expected payoff form the option
(3) Discount at the risk-free rate

Application to Forward Contract on a Stock

Consider a long forward contract that mature at time T with delivery price, K. The value
of the contract at maturity is
ST − K

where ST is the stock price at time T . The value of the forward contract at time zero is

f = e−rT Ê(ST − K) = e−rT Ê(ST ) − Ke−rT

where Ê denotes the expected value in a risk-neutral world. The expected return µ on the
stock becomes r in a risk-neutral world. Hence,

Ê(ST ) = S0 erT

Present value of expected payoff is

e−rT [S0 erT − K] = S0 − Ke−rT


138 Black-Scholes-Merton Pricing Formulas

5.8 Black-Scholes-Merton Pricing Formulas

Solutions of the differential equation (5.16) are Black-Scholes-Merton formulas for the prices
of European call and put options:

c = S0 N (d1 ) − Ke−rT N (d2 ) (5.17)


p = Ke−rT N (−d2 ) − S0 N (−d1 ) (5.18)

where,

ln(S0 /K) + (r + σ 2 /2)T


d1 = √ (5.19)
σ T
ln(S0 /K) + (r − σ 2 /2)T √
d2 = √ = d1 − σ T . (5.20)
σ T

The function N (x) is the probability that a normally distributed variable with a mean of
zero and a standard deviation of 1 is less than x, see, Figure 5.8.

Normal Distrib tion PDF with Area Shaded


0.40

0.35

0.30

0.25
PDF

0.20

0.15

0.10

0.05
PDF
0.00 Area nder PDF (-4 to 1)
−4 −3 −2 −1 0 1 2 3 4
X

Figure 5.2: Normal distribution PDF with area shaded

Understanding N (d1 ) and N (d2 )


For another way of looking at the Black-Scholes-Merton equation for the value of a European
call option, note that it can be written as

c = e−rT N (d2 ) S0 erT N (d1 )/N (d2 ) − K


 
Black-Scholes-Merton Pricing Formulas 139

The terms have the following interpretation:

e−rT : Present value factor


N (d2 ) : Is the probability that a call option will be exercised in a risk-neutral world
rT
S0 e N (d1 )/N (d2 ) : Expected stock price in a risk-neutral world if options is exercised .
K : Strike price paid if option is exercised.

Properties of Black-Scholes-Merton Formulas

• As S0 becomes very large c tends to S0 − Ke−rT and p tends to zero


• As S0 becomes very small c tends to zero and p tends to Ke−rT − S0
• What happen as σ becomes very large?
• What happen as T becomes very large?

The differential equation (5.16) gives the call and put prices at a general time t.

c(t) = SN (d1 ) − Ke−r(T −t) N (d2 ) (5.21)


p(t) = Ke−rT (T −t) N (−d2 ) − SN (−d1 ), (5.22)

where,

ln(S/K) + (r + σ 2 /2)(T − t)
d1 = √ (5.23)
σ T −t
ln(S/K) + (r − σ 2 /2)(T − t) √
d2 = √ = d1 − σ T − t (5.24)
σ T −t

Proving Black-Scholes-Merton Using Risk-Neutral Valuation


Z ∞
c = e−rT max(ST − K, 0)g(ST )dST
K

where g(ST ) is the probability density function for the lognormal distribution of ST in a
risk-neutral world. ln ST is ϕ(m, s2 ) where

m = ln S0 + (r − σ 2 /2)T s=σ T

We substitute
ln ST − m
A=
s
140 Implied Volatilities

so that Z ∞
c = e−rT max(eQs+m − K, 0)h(Q)dQ
(ln K−m)/s

where h is the probability density function for a standard normal Evaluating the integral
leads to the BSM result.

5.9 Implied Volatilities


The implied volatility of an option is the volatility for which the Black-Scholes-Merton price
equals the market price. There is a one-to-one correspondence between prices and implied
volatilities. Traders and brokers often quote implied volatilities rather than dollar prices.

Example 5.9.1
Suppose that the market price of a European call option on a non-dividend-paying
stock is 1.875 when S0 = 21, K = 20, r = 0.1, and T = 0.25. Then implied volatility
is calculated form the following equation

1.875 = 21N (d1 ) − 20e−0.1×0.25 N (d2 )

where

ln(21/20) + (0.1 + σ 2 /2)(0.25)


d1 = √
σ 0.25

d2 = d1 − σ 0.25

It is not possible to invert this equation. However, an iterative search procedure can
be used to find the implied σ.

5.10 Options on Stock Indices and Currencies

Index Options
The most popular underlying indices in the U.S are: the S&P 100 index (OEX and XEO),
the S&P 500 Index (SPX), the Dow Jones Index times 0.01 (DJX) and the Nasdaq 100
Index (NDX).

Exchange-traded contracts are on 100 times index; they are settled in cash; OEX is American;
the XEO and all others are European
Options on Assets Providing a Known Yield 141

Currency Options
Currency options trade on NASDAQ OMX. There also exists a very active over-the-counter
(OTC) market. Currency options are used by corporations to buy insurance when they have
an FX exposure.

5.11 Options on Assets Providing a Known Yield


We get the same probability distribution for the asset price at time T in each of the following
cases:

(1) The stock starts at price S0 and provides a dividend yield at a rate q.
(2) The stock starts at price S0 e–qT and provides no dividends.

When valuing a European options lasting for time T on a stock paying a known dividend
yield at rate q, we reduce the current stock price from S0 to S0 e–qT and value the option as
though the stock pays no dividends.

Put-Call Parity
The put-call parity for on option on a stock paying a dividend yield at rate q:

c + Ke−rT = p + S0 e−qT . (5.25)

Pricing Formulas
By replacing S0 by S0 e−qT in the Black-Scholes-Merton formulas, we obtain the price, c, of
a European call and the price, p, of a European put on a stock paying a dividend yield at
rate q as

c = S0 e−qT N (d1 ) − Ke−rT N (d2 ) (5.26)


−rT −qT
p = Ke N (−d2 ) − S0 e N (−d1 ). (5.27)

Since,
S0 e−qT S0
ln = ln − qT,
K K
it follows that d1 and d2 are given by

ln(S0 /K) + (r − q + σ 2 /2)T


d1 = √
σ T
ln(S0 /K) + (r − q − σ 2 /2)T √
d2 = √ = d1 − σ T .
σ T
142 Valuation of European Currency Options

Differential Equation
The results in equations (5.26) and (5.27) are also the analytical solution for the following
differential equation obtained when including the dividend yield q in the Black-Scholes
differential equation (5.16),

∂f ∂f 1 ∂2f
+ (r − q)S + σ 2 S 2 2 = rf (5.28)
∂t ∂S 2 ∂S

5.12 Valuation of European Currency Options

To value currency option, we define S0 as the spot exchange rate. A foreign currency is
analogous to a stock paying a known dividend yield. The owner of foreign currency receives
a yield equal to the risk-free interest rate rf , in the foreign currency. Replacing q with rf ,
provides the put-call parity for European currency options:

c + Ke−rT = p + S0 e−rf T , (5.29)

the pricing formulas for European currency options,

c = S0 e−rf T N (d1 ) − Ke−rT N (d2 ) (5.30)


p = Ke−rT N (−d2 ) − S0 e−qrf N (−d1 ) (5.31)

where

ln(S0 /K) + (r − rf + σ 2 /2)T


d1 = √
σ T
ln(S0 /K) + (r − rf − σ 2 /2)T √
d2 = √ = d1 − σ T
σ T

Both the domestic interest rate, r, and the foreign interest rate, rf , are the rate for a
maturity T

Using Forward Exchange Rates


Since banks and other financial institutions trade forward contracts on foreign exchange rates
actively, forward exchange rates are often used for valuing options. The forward exchange
rate, F0 , for maturity T is given by

F0 = S0 e(r−rf )T
American Options 143

This relationship allows equation (5.30) and (5.31) to be simplified to

c = e−rT [F0 N (d1 ) − KN (d2 )] (5.32)


p = e−rT [KN (−d2 ) − F0 N (−d1 )] (5.33)

where

ln(F0 /K) + σ 2 T /2
d1 = √
σ T
ln(F0 /K) + −σ 2 T /2 √
d2 = √ = d1 − σ T
σ T

Remark 5.2. A European option on the spot price of any asset can be valued in terms
of the price of a forward or futures contract on the asset using the equations (5.32)
and (5.33). The maturity of the forward or the futures contract must be the same as
the maturity of the European option.

5.13 American Options


Binomial trees can be used to value American options on indices and currencies.

In some circumstances, it is optimal to exercise American currency and index options


prior to maturity. Thus, American currency and index options are worth more than their
European counterparts. In general, call options on high-interest currencies and put options
on low-interest currencies are the most likely to be exercised early. The reason is that a
high-interest currency is expected to be depreciate and a low-interest currency is expected
to appreciate. Similarly, call options on indices with high-dividend yields and put options
on indices with low-dividend yields are most likely to be exercised early.

For further reading: (Hull, 2021, Chapter 15, 17)


144 Python Implementations

5.14 Python Implementations

[1]: # required packages


import numpy as np
import pandas as pd
from scipy.stats import norm
import matplotlib.pyplot as plt
from datetime import datetime

Fundamental financial calculations


[2]: # read a excel file for S&P 500 stock price index (Adj Close)
sp = pd.read_excel('sp_500.xlsx', index_col=0, header=0)["Adj Close"]
sp.head()

[2]: Date
2016-01-04 2012.660034
2016-01-05 2016.709961
2016-01-06 1990.260010
2016-01-07 1943.089966
2016-01-08 1922.030029
Name: Adj Close, dtype: float64

Calculating simple daily percentage change


pt
rt = −1
pt−1

[3]: ## Calculating returns


sp_returns = sp/sp.shift(1) - 1
sp_returns = sp_returns.dropna()
sp_returns = sp_returns['2022-01-01':'2023-01-31']
sp_returns.head()

[3]: Date
2022-01-03 0.006374
2022-01-04 -0.000630
2022-01-05 -0.019393
2022-01-06 -0.000964
2022-01-07 -0.004050

1
Python Implementations 145

Name: Adj Close, dtype: float64

[4]: sp_returns.plot(title = "S&P 500 returns", figsize = (8, 6))


plt.grid();

Calculating simple daily cumulative returns


• is useful to determine the vlaue of an investment at regular intervals after investement.

it = (1 + rt )it−1

[5]: cum_sp_returns = (1+sp_returns).cumprod()


cum_sp_returns.head()

[5]: Date
2022-01-03 1.006374
2022-01-04 1.005740
2022-01-05 0.986236
2022-01-06 0.985286
2022-01-07 0.981295
Name: Adj Close, dtype: float64

2
146 Python Implementations

Log returns
Pt
rt = log( ) = log(Pt ) − log(Pt )
Pt−1

[6]: log_returns = np.log(sp/sp.shift(1))


log_returns = log_returns.dropna()
log_returns = log_returns['2022-01-01':'2023-01-31']
log_returns.head()

[6]: Date
2022-01-03 0.006354
2022-01-04 -0.000630
2022-01-05 -0.019583
2022-01-06 -0.000964
2022-01-07 -0.004058
Name: Adj Close, dtype: float64

[7]: # calculating the normal Probability function (PDF) using the mean and standard␣
,→deviation of the observed

# returns

r_range = np.linspace(sp_returns.min(), sp_returns.max(), num = 100)


mu = sp_returns.mean() # the mean return
sigma = sp_returns.std() # the standard deviation

norm_pdf = norm.pdf(r_range, loc = mu, scale = sigma)


# plot
plt.plot(r_range, norm_pdf, 'r-', label = 'PDF');
plt.hist(sp_returns, bins=50, label = 'histogram')
plt.legend()
plt.grid();

3
Python Implementations 147

[8]: sp_returns.describe()

[8]: count 271.000000


mean -0.000465
std 0.014949
min -0.043237
25% -0.009511
50% -0.001296
75% 0.009528
max 0.055434
Name: Adj Close, dtype: float64

[9]: sp_returns.skew()

[9]: 0.015388815608160697

[10]: sp_returns.kurtosis()

[10]: 0.42285809997837287

[11]: r_range = np.linspace(log_returns.min(), log_returns.max(), num = 100)


mu = log_returns.mean()
sigma = log_returns.std()
norm_pdf = norm.pdf(r_range, loc = mu, scale = sigma)

# plot

4
148 Python Implementations

plt.plot(r_range, norm_pdf, 'r-', label = 'PDF');


plt.hist(log_returns, bins=50);
plt.grid()

[12]: log_returns.describe()

[12]: count 271.000000


mean -0.000577
std 0.014959
min -0.044199
25% -0.009557
50% -0.001297
75% 0.009483
max 0.053953
Name: Adj Close, dtype: float64

[13]: log_returns.skew()

[13]: -0.03826067014680983

[14]: log_returns.kurtosis()

[14]: 0.4064839959609401

5
Python Implementations 149

Estimating Volatillity from Historical Data

[15]: # for S&P 500, for '2022-01-01':'2023-12-30'


annual_volatility = np.sqrt(252)*sigma
annual_volatility

[15]: 0.2374705117331707

Simulating stock price dynamics using a geometric Brownian motion

[16]: # Split the data into training and test sets:


train = sp_returns["2022"]
test = sp_returns["2023"]

[17]: len(train)

[17]: 251

[18]: len(test)

[18]: 20

[19]: len(sp_returns)

[19]: 271

[20]: # Specify the parameters of the simulation


T = len(test)
N = len(test)
S_0 = sp.loc[train.index[-1]]
N_SIM = 100
mu = train.mean()
sigma = train.std()

[21]: # Define the function used for the simulation


def simulate_gbm(s_0, mu, sigma, n_sims, T, N, random_seed=0):
np.random.seed(random_seed)
dt = T/N
dW = np.random.normal(scale=np.sqrt(dt), size=(n_sims, N))
W = np.cumsum(dW, axis=1)
time_step = np.linspace(dt, T, N)
time_steps = np.broadcast_to(time_step, (n_sims, N))
S_t = (s_0 * np.exp((mu - 0.5 * sigma**2) * time_steps + sigma * W))
S_t = np.insert(S_t, 0, s_0, axis=1)
return S_t

6
150 Python Implementations

[22]: # Run the simulation


gbm_simulations = simulate_gbm(S_0, mu, sigma, N_SIM, T, N)
sim_sp = pd.DataFrame(np.transpose(gbm_simulations),
index=train.index[-1:].union(test.index))

[23]: # create a DataFrame with the average value of each time step and correspoinding␣
,→actual price

res_sp = sim_sp.mean(axis=1).to_frame()
res_sp = res_sp.join(sp)
res_sp.columns = ["simulation_average", "adj_close_price"]

[24]: # plot the result of the simulation


ax = sim_sp.plot(alpha= 0.2, legend=False, title="Simulation's results")
res_sp.plot(ax=ax, color = ["red", "blue"], figsize = (10, 8))
plt.grid();

7
Python Implementations 151

Black-Scholes formula analytical


[25]: # valuation function using the analytical solution:
def black_scholes_analytical(S_0, K, T, r, sigma, type="call"):
d1 = (np.log(S_0 / K) + (r + 0.5*sigma**2) * T) / (sigma*np.sqrt(T))
d2 = d1 - sigma * np.sqrt(T)
if type == "call":
N_d1 = norm.cdf(d1, 0, 1)
N_d2 = norm.cdf(d2, 0, 1)
val = S_0 * N_d1 - K * np.exp(-r * T) * N_d2
elif type == "put":
N_d1 = norm.cdf(-d1, 0, 1)
N_d2 = norm.cdf(-d2, 0, 1)
val = K * np.exp(-r * T) * N_d2 - S_0 * N_d1
else:
raise ValueError("Wrong input for type!")
return val

[26]: # Example: Value a call opption


S_0 = 100
K = 100
r = 0.05
sigma = 0.50
T = 1
call = black_scholes_analytical(S_0=S_0, K=K, T=T, r=r, sigma=sigma, type="call")
call

[26]: 21.79260421286685

[27]: # Simulate the stock path using the simulate_gbm function:


N = 252
dt = T / N
N_SIMS = 1000
discount_factor = np.exp(-r * T)
gbm_sims = simulate_gbm(s_0=S_0, mu=r, sigma=sigma,
n_sims=N_SIMS, T=T, N=N)

[28]: premium = (discount_factor * np.mean(np.maximum(0, gbm_sims[:, -1] - K)))


premium

[28]: 22.413952824809225

[ ]:

8
152 Python Implementations
Chapter 6

The Greek Letters

An alternative strategy for risk management involves the utilization of the “Greek letters,”
often simply referred to as the “Greeks.” Each Greek quantifies a distinct facet of risk within
an options position, and the objective of a trader is to adeptly manage these Greeks to
ensure that all associated risks remain at acceptable levels.

Learning Outcomes
By the end of this chapter, you will be able to:
• Explain the best hedging strategy.
• Determine the Greek letters for an option.
• Apply replicating portfolio for dynamical delta hedging

Consider scenario where financial institution (bank) has sold for $300, 000 a European call
option on 100, 000 shares of a non-dividend paying stock. Assume,

S0 = 49, K = 50, r = 5%, σ = 20%, T = 20 weeks , µ = 13%.

The Black-Scholes-Merton value of the option is $240, 000 (This is because the value of an
option to buy one share is $2.4).

How does the bank hedge its risk to lock in a $60, 000 profit?

Naked and Covered Positions

• Naked position

153
154 Greek Letter Calculation

– Take no action
• Covered position
– Buy 100, 000 shares today
• What are the risks associated with these strategies?

In the case of a naked position, if the stock price drops below the strike price after 20 weeks,
the strategy works well. However, if the stock price moves up, the call will be exercised,
incurring costs for the bank. The institution will have to purchase 100,000 shares at the
market price to cover the call. For example, if after 20 weeks the stock price is $60, the
option will cost the institution $1,000,000. This will result in a loss for the institution,
calculated as $300,000 - $1,000,000, which equals -$700,000.

In the case of a covered position, if the stock price goes above the strike price, the call
will be exercised. Since the institution has already purchased the shares, there will be no
problem covering the call. In this scenario, the institution will gain the premium charged for
the option, which is $300,000. However, if the stock price drops to $40, the bank will incur
a loss of $900,000 on its stock position. This loss is significantly greater than the $300,000
charged for the option.

Neither a naked position nor a covered position provides a good hedge.

Stop-Loss Strategy
This involves:

• Buying 100, 000 shares as soon as prices reaches $50


• Selling 100, 000 shares as soon as prices falls below $50

To maintain a naked position when the stock price is below K = 50 and a covered position
when the stock price is above K = 50 is a strategy that guarantees ownership of the stock if
the position closes in the money at time T and avoids ownership if the position closes out
of the money. Refer to Figure (6.1) for a visual representation and consider the timing for
both buying and selling. Ignoring discounting, the cost of writing and hedging the option
appears to be max(S0 − K, 0).

6.1 Greek Letter Calculation


Greek letters are the partial derivatives with respect to the model parameters that are liable
to change. Usually traders use the Black-Scholes-Merton model when calculating partial
derivatives. The volatility parameter in BSM is set equal to the implied volatility when
Greek letters are calculated. This is referred to as using the “practitioner Black-Scholes”
model
Delta Hedging 155

50.2

50.0

49.8

49.6

49.4

49.2

49.0

48.8 Stock price, S(t)


Strike priec K = 50
48.6
0.0 0.2 0.4 0.6 0.8 1.0
t

Figure 6.1: A stop-loss strategy

6.2 Delta Hedging

The Delta (∆) is the rate of change of the option price with respect to the underlying
asset price
∂c
∆= . (6.1)
∂S

Example 6.2.1

Suppose the delta of a call option on stock is 0.6, (see Figure (6.2)). When the stock
price changes by small amount, the option price changes by about 60% of the amount.
Suppose that the stock price is 70 and the option price is 8. Imagine an investor who
has sold call option to buy 2, 000 shares on a stock. The investor’s position could be
hedged by buying
0.6 × 2, 000 = 1, 200 shares.

Gain/loss on the option position is offset by loss/gain on stock position. For instance,
if the stock price goes up by $1, i.e., ∆S = 1 producing a gain on the shares purchased,
the option price will tend to go up by ∆ × ∆S = 0.6 × 1 = $0.6 (producing a loss of
$1, 200 on the options written); if the stock price goes down by $1 (producing a loss of
$1, 200 on the shares purchased), the options will tend to go down by $0.60(producing
156 Delta Hedging

A graphical demonstration for Delta as a slop


Slope = Δ = 0.6
Tangent Point

Option price

Stock price

Figure 6.2: Calculation of delta

a gain of $1, 200 on the options written).

Table 6.1: Table demonstrating that gain/loss on option is offset by loss/gain on stock.
Initially: stock price $70, option price $8, the delta of the call option is 0.6.
Scenario (∆S) (∆c) Gain/Loss Gain/Loss
on Option on Stock
Stock Up (1) +1 +0.60 -1, 200 +1, 200
Stock Down (1) -1 -0.60 +1, 200 -1, 200

The delta of the trader’s overall position in our example is zero (6.1). A position with a
delta of zero is referred to as delta neutral.

Note that the delta of an option does not remain constant. The trader’s position remains
delta hedged(or delta neutral) for only a relatively short period of time. The hedge has to
be adjusted periodically. This is known as rebalancing.

Delta of European Stock Options


The delta of a European call on a non-dividend paying stock, it can be shown that the
Black-Scholes-Merton model gives

∆(call) = N (d1 ).
Delta Hedging 157

1.0 0.0

0.8 −0.2

0.6 −0.4
delta

delta
0.4 −0.6

0.2 −0.8

0.0 −1.0
20 40 60 80 100 20 40 60 80 100
(a) Stock price ($) (b) Stock price ($)

Figure 6.3: Variation of delta with stock price for (a) a call option and (b) a put option on
a non-dividend-paying stock (K = 50, r = 0, σ = 25%, T = 2).

1.0 In the money (K = 40)


At the money (K = 50)
Out of the money (K = 60)
0.8

0.6
Delta

0.4

0.2

0.0
0 2 4 6 8 10
Time to maturity

Figure 6.4: Typical patterns for variation of delta with time to maturity for a call option
(S0 = 50, r = 0, σ = 25%)

The delta of a European put on the stock is

N (d1 ) − 1.

Example 6.2.2

Consider a coll option on a non-dividend-paying stock: the stock price is $49, the
strike price is $50, the risk-free rate is 5%, the time to maturity is 20 weeks (= 0.3846
years), the volatility is 20%

49
ln( 50 ) + (0.05 + 0.22 /2) × 0.3846
d1 = √ = 0.0542
0.2 × 0.3846
158 Theta

∆ = N (d1 ) = N (0.0542) = 0.522. When the stock price changes by ∆S, the option
price changes by 0.522∆S.

Delta of a Portfolio
The delta of a portfolio of options or other derivatives dependent on a single asset whose
price is S is
∂Π
∂S
where Π is the value of the portfolio. It can be computed from the deltas of the individual
options in the portfolio.

6.3 Theta

Theta (Θ) of a derivative (or portfolio of derivatives) is the rate of change of the value
with respect to the passage of time.

The theta of a call or put is usually negative. This means that, if time passes with the price
of the underlying asset and its volatility remaining the same, the value of a long call or put
option declines
S0 N ′ (d1 )σ
Θ(call) = − √ − rKe−rT N (d2 ), (6.2)
2 T
here,
1 2
N ′ (x) = √ e−x /2

is the probability density function for a standard normal distribution.

For a European put option on the stock,

S0 N ′ (d1 )σ
Θ(put) = − √ + rKe−rT N (−d2 )
2 T

Since N (−d2 ) = 1 − N (d2 ), the theta of a put exceeds the theta of the corresponding call
by rKe−rT .
Gamma 159

0.00

−0.25

−0.50

−0.75

theta
−1.00

−1.25

−1.50

−1.75
20 40 60 80 100 120 140
Stock price ($)

Figure 6.5: Variation of theta of a European call option with stock price (K = 50, r = 0, σ =
0.25, T = 2

0
−1
−2
−3
Theta

−4
−5
−6
In the money (K = 40)
−7 At the money (K = 50)
Out of the money (K = 60)
−8
0 2 4 6 8 10
Time to maturity

Figure 6.6: Typyical pattern for variation of theta of a European call option with time to
maturity (S0 = 50, K = 50, r = 0, σ = 25%).

6.4 Gamma
The gamma (Γ) of a portfolio of options on an underlying asset is the rate of change of the
portfolio’s delta (∆) with respect to the price of the underlying asset.

∂2Π
Γ= . (6.3)
∂S 2

If gamma is small, delta changes slowly, and adjustments to keep a portfolio delta neutral
need to be made only relatively infrequently. However, if gamma is highly negative or highly
positive, delta is very sensitive to the price of the underlying asset. It is then quite risky to
leave a delta-neutral portfolio unchanged for any length of time.

For a delta neutral portfolio,


1
∆Π ≈ Θ∆t + Γ∆S 2 (6.4)
2
160 Gamma

Figure 6.7 shows the nature of the relationship between ∆Π and ∆S. When gamma is
positive, theta tend to be negative. The portfolio declines in value if there is no change S,
but increases in value if there is a large positive or negative change in S. When gamma is
negative, theta tends to be positive and the reverse is true: the portfolio increases in value if
there is no change in S but decreases in value if there is a large positive of negative change
in S. As the absolute value of gamma increases, the sensitivity of the value of the portfolio
to S increases.

slightly positive gamma large positive gamma


3 3

2 2

1 1

0 0
ΔΠ

ΔΠ
−1 −1

−2 −2

−3 −3
ΔS ΔS
slightly negative gamma large negative gamma
3 3

2 2

1 1

0 0
ΔΠ

ΔΠ

−1 −1

−2 −2

−3 −3

−4 −3 −2 −1 0 1 2 3 4 −4 −3 −2 −1 0 1 2 3 4
ΔS ΔS

Figure 6.7: Relationship between ∆Π and ∆S in time ∆t for a delta neutral portfolio

Calculation of Gamma
For a European call or put option on a non-dividend-paying stock, the gamma given by the
Black-Scholes-Merton model is
N ′ (d1 )

S0 σ T
The gamma of a long position is always positive and varies with S0 in the way indicated in
Figure 6.8.

The variation of gamma with time to maturity for out-of-the-money, at-the-money, and
in-the-money options is shown in Figure 6.9. As the time to maturity decreases for an
at-the-money option, its gamma tends to increase. Short-term at-the-money options exhibit
notably high gamma values, indicating that the option holder’s position becomes extremely
Relationship between delta, theta, and gamma 161

0.025

0.020

0.015

Gamma 0.010

0.005

0.000
20 40 60 80 100 120
Stock price ($)

Figure 6.8: Variation of gamma with stock price for an option (K = 50, r = 0, σ = 25%, T =
2)

responsive to sudden movements in the stock price.

0.10 In the money (K = 40)


At the money (K = 50)
Out of the money (K = 60)
0.08

0.06
Gamma

0.04

0.02

0.00
0 2 4 6 8 10
Time to maturity

Figure 6.9: Variation of gamma with time to maturity for a stock option (S0 = 50, r =
0, σ = 25%).

6.5 Relationship between delta, theta, and gamma


The price of a single derivative dependent on a non-dividend-paying stock that follows a
geometric Brownian motion process must satisfies the differential equation (5.16). It follows
that the value of Π of a portfolio of such derivatives also satisfies the differential equation

∂Π ∂Π 1 2 2 ∂ 2 Π
+ rS + σ S = rΠ (6.5)
∂t ∂S 2 ∂S 2

Since
∂Π ∂Π ∂2Π
Θ= , ∆= , Γ=
∂t ∂S ∂S 2
162 Vega

it follows that
1
Θ + rS∆ + σ 2 S 2 Γ = rΠ (6.6)
2
For a delta-neutral portfolio, ∆ = 0 and

1
Θ + σ 2 S 2 Γ = rΠ
2

6.6 Vega
The vega of an option, (ν), is the rate of change of the value of a derivatives portfolio with
respect to volatility,
∂f
ν= (6.7)
∂σ
If vega is calculated for a portfolio as a weighted average of the vegas for the individual
transactions comprising the portfolio, the result shows the effect of all implied volatilities
changing by the same small amount.

For a European call or put option on a non-dividend-paying stock, vega given by the
Black-Scholes-Merton model is

ν = S0 T N ′ (d1 )

6.7 Rho
The rho of an option is the rate of change of its price f with respect to the interest rate r:

∂f
∂r

It measures the sensitivity of the value of portfolio to a change in the interest rate when all
else remains the same.

For a European call option on a non-dividend-paying stock,

rho(call) = KT e−rT N (d2 )

For a European put option,

rho(call) = −KT e−rT N (−d2 )


Dynamic Aspect of Delta Hedging 163

6.8 Dynamic Aspect of Delta Hedging


The sensitivity of an option to changes in the underlying asset is represented by the delta,
denoted as ∆. Careful selection of the delta value is crucial for effective risk management.
Delta can be used to construct a portfolio that hedges against risk. A trader can neutralize
the effect of stock price fluctuations by offsetting the sale of options with a simultaneous
purchase of the stock itself. Recall that the delta for call and put are given by,

∂C ∂P
= N (d1 ), and = N (d1 ) − 1,
∂S ∂S

respectively.

Replication and hedging


Replication of a call option C(t) needs to find a self-financing portfolio {(θ(t), ∆(t)), 0 ≤
t ≤ T } such that,
∆(t)S(t) + θ(t)B(t) = C(t), (6.8)

in all possible scenario, at any time 0 ≤ t ≤ T . In equation (6.8), B(t) represents the value
of the risk-free (bond) asset at time t, B(0) = 1. From the Black-Scholes formula

C(t) = SN (d1 ) − e−r(T −t) KN (d2 )


= N (d1 )S(t) + (−Ke−rT N (d2 ))ert

we directly obtain,

∆(t) = N (d1 (t, S)) , (6.9)


θ(t) = −Ke−rT N (d2 (t, S)) . (6.10)

That means, at any time t, in order to replicate the value of the call, we must be long
N (d1 (t, S)) units of S and short Ke−rT N (d2 (t, S)) units of B(t).

Listing 6.1: Python functions for calculation of replicating portfolio for call/put
1

2 im po rt numpy a s np
3 from s c i p y . s t a t s i mpo rt norm
4

5 d e f r e p l i c a t i n g p o r t ( t , S , K, r , T, sigma , o p t i o n t y p e = ' c a l l ' ) :


6 d1 = ( np . l o g ( S / K) + ( r + 0 . 5 ∗ sigma ∗ ∗ 2 ) ∗ (T- t ) ) / ...
( sigma ∗np . s q r t (T- t ) )
7 d2 = d1 - sigma ∗ np . s q r t (T- t )
8 i f o p t i o n t y p e == ” c a l l ” :
9 D e l t a = norm . c d f ( d1 , 0 , 1 )
164 Dynamic Aspect of Delta Hedging

10 t h e t a = - np . exp ( - r ∗T) ∗K∗norm . c d f ( d2 , 0 , 1 )


11 v a l = S ∗ D e l t a + t h e t a ∗ np . exp ( r ∗ t )
12 e l i f o p t i o n t y p e == ” put ” :
13 D e l t a = - norm . c d f ( - d1 , 0 , 1 )
14 t h e t a = np . exp ( - r ∗T) ∗K∗norm . c d f ( - d2 , 0 , 1 )
15 v a l = S ∗ D e l t a + t h e t a ∗ np . exp ( r ∗ t )
16 else :
17 r a i s e V a l u e E r r o r ( ”Wrong i n p u t f o r t y p e ! ” )
18 r e t u r n v a l , Delta , t h e t a

Example 6.8.1

Assume a stock, currently trading for $100, behaves according to a geometric Brownian
motion with mean return of 6% and volatility of 30%. If the risk-free rate is 3%, find
the replicating strategy of a 1−year at-the-money call option:
• at inception;
• after 6 months, in the scenario where S(0.5) = 115;
• and just before maturity, in the scenario where S(1−) = 107.

We can use the Python function in Listing 6.1 and the solutions are as follows:

1 # Example
2 # at i n c e p t i o n
3

4 S0 = 100
5 K = 100
6 sigma = 0 . 3
7 r = 0.03
8 T = 1
9 c 0 , ∆ 0 , t h e t a 0 = r e p l i c a t i n g p o r t ( 0 , S0 , K, r , T, sigma )
10 p r i n t ( ” D e l t a 0 = ” , ∆ 0 . round ( 4 ) )
11 p r i n t ( ” t h e t h a 0 = ” , t h e t a 0 . round ( 4 ) )
12

13 # a f t e r 6 months
14

15 S 6m = 115
16 t 6m = 0 . 5
17

18 c 6m , ∆ 6m , theta 6m = r e p l i c a t i n g p o r t ( t 6m , S 6m , K, r , T, sigma )
19 p r i n t ( ” Delta 6m = ” , ∆ 6m . round ( 4 ) )
20 p r i n t ( ” theta 6m = ” , theta 6m . round ( 4 ) )
21
22 # j u s t b e f o r e m a tu r it y ,
23

24 S 1 = 107
25 t = 0.999
26 c , ∆ , t h e t a =r e p l i c a t i n g p o r t ( t , S 1 , K, r , T, sigma )
27 p r i n t ( ” D e l t a 1 - = ” , ∆ . round ( 4 ) )
28 p r i n t ( ” t h e t a 1 - - ” , t h e t a . round ( 4 ) )
Dynamic Aspect of Delta Hedging 165

29

30 ”””
31 Delta 0 = 0.5987
32 thetha 0 = -46.5873
33 Delta 6m = 0 . 7 9 8 3
34 theta 6m = - 7 1 . 1 8 4
35 Delta 1 - = 1.0
36 theta 1 - - -97.0446
37 ”””

For periodic dynamic delta hedging for European call option follows the following steps:

Step 1: Estimate the necessary parameter-volatility


Step 2: At t = t0 = 0, calculate the theoretical price C(t0 ). Compute the ∆(t0 ) = N (d1 (t0 , S0 )).
Hence the initial portfolio value

Π0 = C(t0 ) = ∆(t0 )S0 + θ(t0 )B(t0 ). (6.11)

C(t0 )−∆(t0 )S0


Here we can see that θ(t0 ) = B(t0 ) . Since, B(t0 ) = 1, the initial portfolio can
be written as:
Π0 = ∆(t0 )S0 + (C(t0 ) − ∆(t0 )S0 ). (6.12)

In other word, the portfolio should have ∆(t0 )S0 invested in the stock and the remainder
(C(t0 ) − ∆(t0 )S0 ) invested in the risk-free asset. Note that we hold on to the quantities
(∆(t0 ), θ(t0 )) up to the next period t1 .
Step 3: At t = t1 , S(t1 ) is realized form the market, we will choose (∆(t1 ), θ(t1 )) such that

∆(t0 )S(t1 ) + θ(t0 )B(t1 ) = ∆(t1 )S(t1 ) + θ(t1 )B(t1 ) = Π(t1 ). (6.13)

Now, ∆(t1 ) = N (d1 (S(t1 ), t1 )) and calculating for θ(t1 ) gives;

θ(t1 ) = e−rt1 {(∆(t0 )S(t1 ) + θ(t0 )ert1 ) − ∆(t1 )S(t1 )}. (6.14)

Step 4: Repeat the similar procedure in Step 3 for i = 2, . . . , m − 1. At the trading date ti ,

∆(ti−1 )S(ti ) + θ(ti−1 )B(ti ) = ∆(ti )S(ti ) + θ(ti )B(ti ) = Π(ti ). (6.15)

Solving for θ(ti ),

θ(ti ) = e−rti {(∆(ti−1 )S(ti ) + θ(ti−1 )erti ) − ∆(ti )S(ti )}. (6.16)

P&L

Suppose we sold a call C(t0 , S) at time t0 , with maturity T and strike K. By selling, we
166 Dynamic Aspect of Delta Hedging

obtained a cash amount equals C(t0 , S) and perform a dynamic hedging strategy until time
T . Initially, at the inception time, we have

Φ(t0 , S) := C(t0 , S) − ∆(t0 )S0 .

This value may be negative when ∆(t0 )S0 > C(t0 , S). If funds are needed for buying ∆(t)
shares, we make use of a funding account, P nL(t) ≡ P &L(t). P nL(t) represents the total
value of the option sold and the hedge, and it keeps track of the change in the asset value
S(t).

At some time t1 > t0 , we then receive (or pay) interest over the time period [t0 , t1 ], which
will amount to P &L(t0 )er(t1 −t0 )

At t1 we have ∆(t0 )S(t1 ) which may be sold, and we will update hedge portfolio. Particularly,
we purchase ∆(t1 ) stocks, costing −∆(t1 )S(t1 ). The overall P &L(t1 ) account will become:

P &L(t1 ) = P &L(t0 )er(t1 −t0 ) −(∆(t1 ) − ∆(t0 ))S(t1 ) (6.17)


| {z }| {z }
interest borrow

T
Assuming a time grid with ti = i m , the following recursive formula for the m time steps is
obtained.

P &L(t0 ) = C(t0 , S) − ∆(t0 )S(t0 ) (6.18)


P &L(ti ) = P &L(ti−1 )er(ti −ti−1 ) − (∆(ti ) − ∆(ti−1 ))S(ti ), i = 1, . . . , m − 1. (6.19)

At the maturity time T , the option holder may exercise the option or the option will expire
worthless. As the option writer, we will thus encounter a cost equal to the option’s payoff
at tm = T , i.e. max(S(T ) − K, 0). On the other hand, at maturity time we own ∆(tm−1 )
stocks, that may be sold in the market. The value of the portfolio at maturity time tm = T
is then given by:

P &L(tm ) = P &L(tm−1 )er(tm −tm−1 ) − max(S(tm ) − K, 0) + ∆(tm−1 )S(tm ) . (6.20)


| {z } | {z }
option payoff sell stocks

In a perfect world, with continuous re-balancing, the P &L(T ) would equal zero on average,
i.e. E(P &L(T )) = 0.
Dynamic Aspect of Delta Hedging 167

Remark 6.1. One might question the rationale behind dynamic hedging when the
average profit for the option writer is zero. In option trading, particularly with
over-the-counter (OTC) transactions, the profit arises from charging an additional
fee, commonly known as a ”spread,” at the contract’s initiation. At time t0 , the cost
for the client is not C(t0 , S) but C(t0 , S) + spread, where spread > 0 represents the
profit for the option writer.

Example 6.8.2
Dynamic hedge experiment, Black-Scholes model:
Consider the following scenario: For the asset price, the following model parameters
are set S(t0 ) = 1, r = 0.1, σ = 0.2. The option’s maturity is T = 1 and strike
K = 0.85.

On a time grid stock path S(ti ) is simulated. Based on these paths, the hedging strategy
were performed. In Figure 6.10 the option ends in-the-money at time T , Figure 6.11 shows

1.5

1.0

0.5
Price
0.0 Call
P\&L
−0.5 Delta

−1.0

−1.5

0 50 100 150 200 250


time (days)

Figure 6.10: Delta hedging a call option. Option ending ITM

the options ends out-of-money at time T , Figure 6.12 shows the option ends at-the-money
at time T . In all the simulation graphs ∆(ti ) behaves like the stock process S(t), however
when the stock S(t) give a coll price deep in or out of the money, ∆(ti ) is either 0 or 1. In
all three cases, the initial hedge quantities are the same, however, they change over time
with the stock paths. In all three cases the final P &L(tm ) is close to zero.
168 Dynamic Aspect of Delta Hedging

1.0

0.5

0.0

−0.5
Price
−1.0 Call
P\&L
Delta
0 50 100 150 200 250
time (days)

Figure 6.11: Delta hedging a call option: Option ending OTM

1.0

0.5

0.0 Price
Call
P\&L
−0.5 Delta

−1.0

−1.5
0 50 100 150 200 250
time (days)

Figure 6.12: Delta hedging a call option. Option ending ATM


Chapter 7

Basic Numerical Procedures

In this chapter, we delve into three essential numerical approaches for the valuation of
derivatives when an analytical solution, such as the Black-Scholes-Merton formula, is not
readily available. These approaches provide valuable alternatives to tackle complex financial
instruments and risk management challenges. First, we explore more on the concept of trees,
a method that involves constructing binomial or trinomial trees to model the evolution of
asset prices over time. Next, we venture into Monte Carlo simulation, a powerful technique
that employs random sampling to simulate a wide range of potential future scenarios. Lastly,
we delve into finite difference methods, which discretize the differential equations governing
option pricing, allowing us to approximate derivative values. Each of these numerical
methods offers unique advantages and insights, making them indispensable tools for financial
professionals and analysts in navigating the intricacies of derivative valuation and risk
assessment.

Learning Outcomes
By the end of this chapter, you will be able to:
• Use the binomial trees for pricing an asset.
• Determine the parameters u, d and p.
• Apply Monte Carlo simulation for option pricing.
• Apply finite difference method for pricing an American option.

169
170 Binomial Trees

7.1 Binomial Trees


Binomial trees serve as a common tool for approximating the dynamic behavior of asset
prices, particularly in the context of options pricing and risk management. Within these
trees, the price of the underlying asset, such as a stock, is divided into discrete time intervals.
During each of these intervals, the asset’s price is assumed to exhibit one of two behaviors: it
can either increase by a factor represented as ‘u’ or decrease by a factor denoted as ‘d’. This
binomial framework allows financial analysts and option traders to model and assess various
scenarios, enabling more informed decision-making when it comes to derivative investments
and portfolio management.

The binomial tree model assumes that in each time interval ∆t, the price of the underlying
asset moves form its initial value of S to one of two new values, Su and Sd. The approach
is illustrated in Figure 7.1. In general, u > 1 and d < 1. The probability of an up movement

Su

1−p
Sd

Figure 7.1: Asset price movements in time ∆t under the binomial model

is p while the down movement is 1 − p.

Risk-Neutral Valuation

(1) Assume that the expected return from all traded assets is the risk-free interest rate.
(2) Value payoffs form the derivative by calculating their expected values and discounted at
the risk-free interest rate.

This principle underlies the way trees are used.


Binomial Trees 171

Determination of p, u, and d
The parameters p, u, and d are chosen so that the tree gives correct values for the mean and
variance of the stock price changes in a risk-neutral world. Suppose that the asset provides
a yield of q.

• Mean : e(r−q)∆t = pu + (1 − p)d


• Variance: σ 2 ∆t = pu2 + (1 − p)d2 − e2(r−q)∆t .

A further condition often imposed is u = 1/d . When ∆t is small a solution to the equations
is √
u = eσ ∆t


d = e−σ ∆t

a−d
p=
u−d
where
a = e(r−q)∆t .

The variable a is sometimes referred to as the growth factor.

Tree of Asset Prices


Figure 7.2 shows the complete tree of asset prices that is considered when the binomial
model is used with four time steps.

At t = 0, we know the asset price, S0 .

At t = ∆t, the asset price will go up S0 u or go down S0 d.

At t = 2∆t, there are three possible asset price, S0 u2 , S0 , and S0 d2 ; and so on.

In general, at t = i∆t, we consider i + 1 asset prices. These are

S0 uj di−j , j = 0, 1, . . . , i

Working backward through the tree


We know the value of the option at final nodes. We work back through the tree using
risk-neutral valuation to calculate the value of the option at each node, testing for early
exercise when appropriate.
172 Binomial Trees

S0u 4
S0u 3
S0u 2 S0du 3
S0u S0 du 2
S0 S0du S0d 2u 2
S0d S0 d 2u
S0d 2 S0d 3u
S0d 3

S0d 4

Figure 7.2: Tree used to value an option

Example 7.1.1

Consider the following scenario: S0 = 50; K = 50; r = 10%; σ = 40%;


T = 5 months = 0.4167; ∆t = 1 month = 0.0833
In this case,
1
a = e0.1× 12 = 1.0084
√1
u = e0.4 12 = 1.1224
1
d= = 0.8909
d
a−d
p= = 0.5073
u−d

European

Listing 7.1: Python functions for computing European options


1 d e f b i n o m i a l o p t i o n E r o ( S , K, r , dv , T, sigma , N, o p t i o n t y p e = ' put ' ) :
2 ”””
3 S = underlying price
4 K = strike price
5 r = risk - free rate
6 dv = dividend y i e l d
7 T = time t o m a t u r i t y
Binomial Trees 173

8 sigma = v o l a t i l i t y
9 N = number o f time s t e p s
10 o p t i o n t y p e = c a l l by d e f a u l t
11 ”””
12 i f o p t i o n t y p e == ' put ' :
13 option type = 1
14 e l i f o p t i o n t y p e == ' c a l l ' :
15 o p t i o n t y p e = -1
16 dt = T / N # time s t e p s i z e
17 d f = np . exp ( - r ∗ dt ) # discount factor
18 u = np . exp ( sigma ∗ np . s q r t ( dt ) ) # up f a c t o r
19 d = 1 / u # down f a c t o r
20 p = ( np . exp ( ( r - dv ) ∗ dt ) - d ) / ( u - d ) # p r o b a b i l i t y o f up move
21 q = 1 - p # p r o b a b i l i t y o f down move
22

23 # I n i t i a l i z e the stock p r i c e t r e e
24 s t o c k t r e e = np . empty ( (N + 1 , N + 1 ) )
25 s t o c k t r e e [ : ] = np . nan
26 stock tree [ -1 , 0] = S
27
28 # Populate the stock p r i c e t r e e
29 f o r j in range (1 , N + 1) :
30 stock tree [ -1 , j ] = stock tree [ -1 , j -1]∗d
31

32 f o r i in range (1 , N + 1) :
33 f o r j i n r a n g e ( i , N+1) :
34 stock tree [ -1 - i , j ] = stock tree [ - i , j -1] ∗ u
35
36 # I n i t i a l i z e the option value t r e e
37 p r i c e t r e e = np . empty ( (N + 1 , N + 1 ) )
38 p r i c e t r e e [ : ] = np . nan
39

40 # Populate the option value t r e e at maturity


41 f o r j i n r a n g e (N + 1 ) :
42 p r i c e t r e e [ j , - 1 ] = max ( 0 , o p t i o n t y p e ∗ (K - s t o c k t r e e [ j , -1]) )
43

44 # Work backwards t h r o u g h t h e t r e e t o compute o p t i o n v a l u e s


45 f o r i i n r a n g e (N+1) :
46 f o r j i n r a n g e ( i + 1 , N+1) :
47 p r i c e t r e e [ j , - 2 - i ] = d f ∗ ( p ∗ p r i c e t r e e [ j - 1 , - 1 - i ] + q ...
∗ p r i c e t r e e [ j , -1 - i ] )
48
49

50 # C r e a t e a DataFrame t o s t o r e t h e t r e e p r i c e s
51 p r i c e t r e e d f = pd . DataFrame ( p r i c e t r e e , columns =[ f ” P e r i o d { i } ” ...
f o r i i n r a n g e (N+1) ] )
52 p r i c e t r e e d f . i n d e x = pd . Index ( [ f ” {N- j } ” f o r j i n r a n g e (N+1) ] )
53
54 S t o c k t r e e = pd . DataFrame ( s t o c k t r e e , columns =[ f ” P e r i o d { i } ” f o r i ...
i n r a n g e (N+1) ] )
55 S t o c k t r e e . i n d e x = pd . Index ( [ f ” {N- j } ” f o r j i n r a n g e (N+1) ] )
56

57 r e t u r n p r i c e t r e e d f . round ( 2 ) , S t o c k t r e e . round ( 2 )

Table 7.1 shows the possible price movements and the corresponding prices for the European
174 Binomial Trees

call option, considering the binomial model. Furthermore, using the same scenario, Table
7.2 demonstrate the price dynamics of European put option prices.

Period 0 Period 1 Period 2 Period 3 Period 4 Period 5


Stock Price 5 89.09
4 79.37 70.71
3 70.71 63.0 56.12
2 63.0 56.12 50.0 44.55
1 56.12 50.0 44.55 39.69 35.36
0 50.0 44.55 39.69 35.36 31.5 28.06
Option Price 5 39.09
4 29.78 20.71
3 21.54 13.41 6.12
2 14.87 8.25 3.08 0.00
1 9.88 4.91 1.55 0.0 0.00
0 6.36 2.85 0.78 0.0 0.0 0.00

Table 7.1: The possible price dynamics and the European call prices

Period 0 Period 1 Period 2 Period 3 Period 4 Period 5


Stock Price 5 89.09
4 79.37 70.71
3 70.71 63.0 56.12
2 63.0 56.12 50.0 44.55
1 56.12 50.0 44.55 39.69 35.36
0 50.0 44.55 39.69 35.36 31.5 28.06
Option Price 5 0.00
4 0.0 0.00
3 0.0 0.0 0.00
2 0.64 1.3 2.67 5.45
1 2.11 3.67 6.18 9.9 14.64
0 4.32 6.66 9.86 13.82 18.09 21.94

Table 7.2: The price dynamics of European put option


Binomial Trees 175

American

Listing 7.2: Python functions for computing American options


1 d e f b i n o m i a l o p t i o n A M ( S , K, r , dv , T, sigma , N, o p t i o n t y p e = ' put ' ) :
2 ”””
3 S = underlying price
4 K = strike price
5 r = risk - free rate
6 dv = dividend y i e l d
7 T = time t o m a t u r i t y
8 sigma = v o l a t i l i t y
9 N = number o f time s t e p s
10 o p t i o n t y p e = c a l l by d e f a u l t
11 ”””
12 i f o p t i o n t y p e == ' put ' :
13 option type = 1
14 e l i f o p t i o n t y p e == ' c a l l ' :
15 o p t i o n t y p e = -1
16 dt = T / N # time s t e p s i z e
17 d f = np . exp ( - r ∗ dt ) # discount factor
18 u = np . exp ( sigma ∗ np . s q r t ( dt ) ) # up f a c t o r
19 d = 1 / u # down f a c t o r
20 p = ( np . exp ( ( r - dv ) ∗ dt ) - d ) / ( u - d ) # p r o b a b i l i t y o f up move
21 q = 1 - p # p r o b a b i l i t y o f down move
22

23 # I n i t i a l i z e the stock p r i c e t r e e
24 s t o c k t r e e = np . empty ( (N + 1 , N + 1 ) )
25 s t o c k t r e e [ : ] = np . nan
26 stock tree [ -1 , 0] = S
27

28 # Populate the stock p r i c e t r e e


29 f o r j in range (1 , N + 1) :
30 stock tree [ -1 , j ] = stock tree [ -1 , j -1]∗d
31
32 f o r i in range (1 , N + 1) :
33 f o r j i n r a n g e ( i , N+1) :
34 stock tree [ -1 - i , j ] = stock tree [ - i , j -1] ∗ u
35

36 # I n i t i a l i z e the option value t r e e


37 p r i c e t r e e = np . empty ( (N + 1 , N + 1 ) )
38 p r i c e t r e e [ : ] = np . nan
39
40 # f o r i n d i c a t i n g e x i s t e n c e o f e a r l y e x e r c i s e a t some node
41 e a r l y e x e r c i s e = np . empty ( (N+1 , N+1) )
42 e a r l y e x e r c i s e [ : ] = np . nan
43

44 # Populate the option value t r e e at maturity


45 f o r j i n r a n g e (N + 1 ) :
46 p r i c e t r e e [ j , - 1 ] = max ( 0 , o p t i o n t y p e ∗ (K - s t o c k t r e e [ j , -1]) )
47

48 # Work backwards t h r o u g h t h e t r e e t o compute o p t i o n v a l u e s


49 f o r i i n r a n g e (N+1) :
176 Binomial Trees

50 f o r j i n r a n g e ( i + 1 , N+1) :
51 e x e r c i s e v a l u e = max ( 0 , o p t i o n t y p e ∗ (K - s t o c k t r e e [ j , - 2 - i ] ) )
52 c o n t i n u e v a l u e = d f ∗ ( p ∗ p r i c e t r e e [ j - 1 , - 1 - i ] + q ∗ ...
p r i c e t r e e [ j , -1 - i ] )
53 p r i c e t r e e [ j , - 2 - i ] = max( e x e r c i s e v a l u e , c o n t i n u e v a l u e )
54 i f e x e r c i s e v a l u e >c o n t i n u e v a l u e :
55 e a r l y e x e r c i s e [ j , -2 - i ] = p r i c e t r e e [ j , -2 - i ]
56

57 # C r e a t e a DataFrame t o s t o r e t h e t r e e p r i c e s
58 S t o c k t r e e = pd . DataFrame ( s t o c k t r e e , columns =[ f ” P e r i o d { i } ” f o r i ...
i n r a n g e (N+1) ] )
59 S t o c k t r e e . i n d e x = pd . Index ( [ f ” {N- j } ” f o r j i n r a n g e (N+1) ] )
60

61 p r i c e t r e e d f = pd . DataFrame ( p r i c e t r e e , columns =[ f ” P e r i o d { i } ” ...


f o r i i n r a n g e (N+1) ] )
62 p r i c e t r e e d f . i n d e x = pd . Index ( [ f ” {N- j } ” f o r j i n r a n g e (N+1) ] )
63
64 e a r l y e x e r c i s e = pd . DataFrame ( e a r l y e x e r c i s e , columns =[ f ” P e r i o d ...
{ i } ” f o r i i n r a n g e (N+1) ] )
65 e a r l y e x e r c i s e . i n d e x = pd . Index ( [ f ” {N- j } ” f o r j i n r a n g e (N+1) ] )
66

67 r e t u r n p r i c e t r e e d f . round ( 2 ) , S t o c k t r e e . round ( 2 ) , ...


e a r l y e x e r c i s e . round ( 2 )

The calculation for American call option prices are indicated in Table 7.3.

Period 0 Period 1 Period 2 Period 3 Period 4 Period 5


5 39.09
4 29.78 20.71
3 21.54 13.41 6.12
2 14.87 8.25 3.08 0.00
1 9.88 4.91 1.55 0.0 0.00
0 6.36 2.85 0.78 0.0 0.0 0.00

Table 7.3: The price dynamics of American call

Table 7.4 demonstrate the price dynamics of American put option prices. The table also
indicates the early exercise.

Observe that the premiums for European and American calls for non-dividend-paying stocks
are equal, at 6.36 per share. Moreover, the premium for the American put option (4.49) is
slightly more expensive than its European counterpart (4.32) due to the former providing
an alternative for early exercise.

Calculation of Delta:
Delta is calculated form the nodes at time ∆t

2.16 − 6.96
Delta = = −0.41
56.12 − 44.55
Binomial Trees 177

Period 0 Period 1 Period 2 Period 3 Period 4 Period 5


Stock Price 5 89.09
4 79.37 70.71
3 70.71 63.0 56.12
2 63.0 56.12 50.0 44.55
1 56.12 50.0 44.55 39.69 35.36
0 50.0 44.55 39.69 35.36 31.5 28.06
Option Price 5 0.0
4 0.0 0.0
3 0.0 0.0 0.0
2 0.64 1.3 2.67 5.45
1 2.16 3.77 6.38 10.31 14.64
0 4.49 6.96 10.36 14.64 18.5 21.94
Early Exercise 5
4
3
2
1 10.31
0 14.64 18.5

Table 7.4: The price dynamics of American put option

Calculation of Gamma:
Gamma is calculated from the nodes at time 2∆t

0.64 − 3.77 3.77 − 10.36


∆1 = = −0.24; ∆2 = = −0.64
62.99 − 50 50 − 39.69

∆1 − ∆2
Gamma =
11.65
Calculation of Theta:

Theta is calculated form the central nodes at times 0 and 2∆t

3.77 − 4.49
Theta = = −4.3 per year
0.1667

or −0.012 per calendar day

Calculation of Vega:

• We can proceed as follows


• Construct a new tree with a volatility of 41% instead of 40%.
• Value of option is 4.62
178 Monte Carlo Simulation

• Vega is 4.62 − 4.49 = 0.13 per 1% changes in volatility

7.2 Monte Carlo Simulation


When used to value European stock options, Monte Carlo simulation involves the following
steps:

(1) Sample a random path for S in a risk-neutral world.


(2) Calculate the payoff form the derivative.
(3) Repeat steps 1 and 2 to get many sample values of the payoff form the derivative in a
risk-neutral world.
(4) Calculate the mean of the sample payoffs to get an estimate of the expected payoff in a
risk-neutral world.
(5) Discount this expected payoff at the risk-free rate to get an estimate of the value of the
derivative.

Sampling Stock Price Movements

In a risk neutral world the process for a stock price is

dS = µ̂Sdt + σSdW

where dW is a Wiener process, µ̂ is the risk-neutral expected return, and σ is the volatility.
We can simulate a path by choosing time steps of length ∆t and using the discrete version
of this

∆S = µ̂∆tS + σSε ∆t

S(t + ∆t) − S(t) = µ̂S(t)∆t + σS(t)ε ∆t, (7.1)

where ε is a random sample from ϕ(0, 1).

A more accurate approach using ln S rather than S. From Itô’s lemma,

d ln S = (µ̂ − σ 2 /2)dt + σdW (7.2)

The discrete version of this is



ln S(t + ∆t) − ln S(t) = (µ̂ − σ 2 /2)∆t + σε ∆t
Monte Carlo Simulation 179

or equivalently 
σ2
 √ 
S(t + ∆t) = S(t) exp µ̂ − ∆t + σε ∆t (7.3)
2
Equation 7.3 is used to construct a path for S. Working with ln S rather than S gives more
accuracy. Also, if µ̂ and σ are constant, then

σ2 √
 
ln S(T ) − ln S(0) = µ̂ − T + σε T
2

is true of all T . It follows that

2

/2)T +σε T
S(T ) = S(0)e(µ̂−σ (7.4)

When a derivative depends on several underlying variables we can simulate paths for each
of them in a risk-neutral world to calculate the values for the derivative .

The advantage of Monte Carlo simulation:

• it can be used when the payoff depends on the path followed by the underlying variable
S as well as when it depends only on the final value of S.
• the method can be extended to accommodate situations where the payoff from the
derivative depends on several underlying market variables.

The drawbacks of Monte Carlo simulation are:

• it is computationally very time consuming


• cannot easily handle situations where there are early exercise opportunities.

Derivatives Dependent on More than One Market Variable


To obtain two correlated samples ε1 and ε2 form standard normal distributions, obtain
independent normal samples x1 and x2 and set

ε1 = x1
p
ε2 = ρx1 + x2 1 − ρ2

where ρ is the coefficient of correlation.

More generally, if we need n correlated samples form normal distributions with correlation
between sample i and sample j being ρij , we firs sample n independent variables xi (i ≤ i ≤ n),
form univariate standardized normal distributions. The needed samples, εi (1 ≤ i ≤ n), are
180 Monte Carlo Simulation

then defined as follows:

ε1 = α11 x1
ε2 = α21 x1 + α22 x2
ε3 = α31 x3 + α32 x2 + α33 x3 (7.5)

and so on. We choose the coefficients αij so that the correlations and variance are correct.
This can be done step by step as follow. Set α11 = 1; choose α21 so that α21 α11 = ρ11 ;
2 2
choose α22 so that α21 + α22 = 1; choose α31 so that α31 α11 = ρ21 ; choose α32 so that
2 2 2
α31 α21 + α32 α22 = ρ32 ; choose α33 so that α31 + α32 + α33 = 1; and so on. This procedure
is known as the Cholesky’s decomposition.

Standard Errors in Monte Carlo Simulation


The standard error of the estimate of the option price is the standard deviation of the
discounted payoffs given by the simulation trials divided by the square root of the number
of observations.
ω

M
where M is the number of trails. A 95% confidence interval for price f of the derivative is
therefore given by
1.96ω 1.96ω
µ− √ <f <µ+ √
M M
Application of Monte Carlo Simulation

• Monte Carlo simulation can deal with path dependent options, options dependent on
several underlying state variables, and options with complex payoffs
• The drawbacks of Monte Carlo simulation are that it is computationally very time
consuming and cannot easily handle situations where there are early exercise opportunities

Determining Greek Letters For ∆ :

(1) Make a small change to asset price


(2) Carry out the simulation again using the same random number streams
(3) Estimate ∆ as the change in the option price

Proceed in a similar manner for other Greek letters

Example 7.2.1

Consider the same scenario as before: S0 = 50; K = 50; r = 10%; σ = 40%;


T = 5 months = 0.4167; ∆t = 1 month = 0.0833.
Monte Carlo Simulation 181

The following Python function in Listing 7.3 is for computing the European option using
the Black-Scholes analytic formula.

Listing 7.3: A function for computing the European options analytically


1 d e f b l a c k s c h o l e s a n a l y t i c a l ( S 0 , K, T, r , sigma , o p t i o n t y p e=” c a l l ” ) :
2 ”””
3 A f u n c t i o n f o r computing t h e European o p t i o n s a n a l y t i c a l l y ” ” ”
4 d1 = ( np . l o g ( S 0 / K) + ( r + 0 . 5 ∗ sigma ∗ ∗ 2 ) ∗ T) / ( sigma ∗np . s q r t (T) )
5 d2 = d1 - sigma ∗ np . s q r t (T)
6 i f o p t i o n t y p e == ” c a l l ” :
7 N d1 = norm . c d f ( d1 , 0 , 1 )
8 N d2 = norm . c d f ( d2 , 0 , 1 )
9 v a l = S 0 ∗ N d1 - K ∗ np . exp ( - r ∗ T) ∗ N d2
10 e l i f o p t i o n t y p e == ” put ” :
11 N d1 = norm . c d f ( - d1 , 0 , 1 )
12 N d2 = norm . c d f ( - d2 , 0 , 1 )
13 v a l = K ∗ np . exp ( - r ∗ T) ∗ N d2 - S 0 ∗ N d1
14 else :
15 r a i s e V a l u e E r r o r ( ”Wrong i n p u t f o r t y p e ! ” )
16 return val

1 S0 = 50
2 K = 50
3 r = 0.01
4 sigma = 0 . 4 0
5 T = 5/12
6 # European c a l l o p t i o n u s i n g t h e a n a l y t i c a l f o r m u l a
7 a n a l y t i c a l C a l l E u = f n . b l a c k s c h o l e s a n a l y t i c a l ( S0 , K, T, r , sigma )
8 print ( analytical CallEu )
9

10 5.23

For the implementation of Monte Carlo Simulation the first step is to generate or simulate
possible paths. The function in Listing 7.4 is for generating possible paths for the stock
price movement.

Listing 7.4: Python function for generating paths by geometric Bm


1 d e f s i m u l a t e g b m ( S 0 , mu, sigma , n s i m s , T, N, random seed =42) :
2 ”””
3 A f u n c t i o n f o r g e n e r a t i n g p a t h s model by g e o m e t r i c Bm
4

5 Inputs :
6 S 0 : the i n i t i a l p r i c e
7 mu : t h e e x p e c t e d r e t u r n
8 sigma : t h e v o l a t i l i t y
9 n s i m s : number o f s i m u l a t i o n s
10 T : time i n y e a r s
182 Monte Carlo Simulation

11 N : time s t e p s , o r p e r i o d s
12 Output :
13 S t : t h e s i m u l a t e d p r i c e a t time t ( 0 ≤ t ≤T)
14 ”””
15 np . random . s e e d ( random seed )
16 dt = T/N
17 dW = np . random . normal ( s c a l e=np . s q r t ( dt ) , s i z e =( n s i m s , N) )
18 W = np . cumsum (dW, a x i s =1)
19 t i m e s t e p = np . l i n s p a c e ( dt , T, N)
20 t i m e s t e p s = np . b r o a d c a s t t o ( t i m e s t e p , ( n s i m s , N) )
21 S t = ( S 0 ∗ np . exp ( (mu - 0 . 5 ∗ sigma ∗ ∗ 2 ) ∗ t i m e s t e p s + sigma ∗ W) )
22 S t = np . i n s e r t ( S t , 0 , S 0 , a x i s =1)
23 t i m e s t e p = np . i n s e r t ( t i m e s t e p , 0 , 0 )
24
25 return S t , time step

1 S0 = 50
2 K = 50
3 r = 0.01
4 sigma = 0 . 4 0
5 T = 5/12
6 N = 100
7 N sim = 5
8 # Call the f u n c t i o n simulate gbm
9 S t , t = f n . s i m u l a t e g b m ( S0 , r , sigma , N sim , T, N)
10

11 g b m s i m u l a t i o n s = pd . DataFrame ( np . t r a n s p o s e ( S t ) )
12 gbm simulations . index = t
13

14 # p l o t the r e s u l t of the simulation


15 ax = g b m s i m u l a t i o n s . p l o t ( l e g e n d=F a l s e , t i t l e =” S i m u l a t i o n s o f ...
stock price ” )
16 p l t . y l a b e l ( ' Stock p r i c e ' )
17 p l t . x l a b e l ( ' Time i n y e a r ( f r a c t i o n ) ' )
18 plt . grid () ;
19 p l t . show ( )

The outcome of the above code is indicated in Figure 7.3. The following peace of code is for
applying the Monte Carlo simulation for pricing the European call option.

1 S0 = 50
2 K = 50
3 r = 0.01
4 sigma = 0 . 4 0
5 T = 5/12
6 N = 5
7 N sim = 1000
8 # c a l c u l a t i n g t h e European c a l l o p t i o n u s i n g MC
9 d i s c o u n t f a c t o r = np . exp ( - r ∗T)
10 MC CallEu = ( d i s c o u n t f a c t o r ∗np . mean ( np . maximum ( 0 , S t [ : , - 1 ] -K) ) )
11 p r i n t ( MC CallEu )
Finite Difference Methods 183

Simulations of stock price


65

60

55
Stock price

50

45

40

35
0.0 0.1 0.2 0.3 0.4
Time in year(fraction)

Figure 7.3: Five possible price movement with 100 steps each.

12

13 5.28

7.3 Finite Difference Methods


Finite Difference Method aims to represent the differential equation in the form of a difference
equation. We form a grid by considering equally space time values and stock prices values.
Consider an American put option on a stock paying a dividend yield of q. The differential
equation that the option must satisfy is

∂f ∂f 1 ∂2f
+ (r − q)S + σ 2 S 2 2 = rf (7.6)
∂t ∂S 2 ∂S
T
Let the life of the option is T . Divide this into N equally spaced intervals of length ∆t = N.
A total of N + 1 times are therefore considered

0, ∆t, 2∆t, . . . , T

Suppose that Smax is a stock price sufficiently high that, when it reached, the put has
Smax
virtually no value. We define ∆S = M and consider a total of M + 1 equally spaced stock
prices:
0, ∆S, 2∆S, . . . , Smax
184 Finite Difference Methods

The time points and stock price points define a grid consisting of a total of (M + 1)(N + 1)
points, as shown in Figure 7.4. Define fi,j as the value of f at time i∆t when the stock
price is j∆S.

2D Spatial Grid for Finite Difference


Stock Price S

2ΔS

ΔS

0 Δt 2Δt
Time, t

Figure 7.4: Grid for finite difference approach

Implicit Finite Difference Method


∂f
For an interior point (i, j) on the grid, ∂S can be approximated as

∂f fi,j+1 − fi,j
= (7.7)
∂S ∆S

or as
∂f fi,j − fi,j−1
= (7.8)
∂S ∆S
Equation (7.7) is known as the forward difference approximation; equation (7.8) is known
Finite Difference Methods 185

as the backward difference approximation. By averaging the two:

∂f fi,j+1 − fi,j−1
= (7.9)
∂S 2∆S
∂f
For ∂t , we will use a forward difference approximation so that the value at time i∆t is
related to the value at time (i + 1)∆t:

∂f fi+1,j − fi,j
= (7.10)
∂t ∆t
∂2f ∂f
Consider next ∂S 2 . The backward difference approximation for ∂S at the (i, j) point is
given by equation (7.8). The backward difference at the (i, j + 1) point is

fi,j+1 − fi,j
∆S
∂2f
Hence a finite difference approximation for ∂S 2 and the (i, j) point is

∂2f
 
fi,j+1 − fi,j fi,j − fi,j−1
= − /∆S or
∂S 2 ∆S ∆S
∂2f fi,j+1 + fi,j−1 − 2fi,j
= (7.11)
∂S 2 ∆S 2

Substituting equation (7.9), (7.10), and (7.11) into the differential equation (7.6) and noting
that S = j∆S gives

fi,j+1 − fi,j fi,j+1 − fi,j−1 1 2 2 fi,j+1 + fi,j−1 − 2fi,j


+(r−q)j∆S+ + σ j ∆S 2 = rfi,j (7.12)
∆t 2∆S 2 ∆S 2

for j = 1, 2, . . . , M − 1 and i = 0, 1, . . . , N − 1. Rearranging terms, we obtain

aj fi,j−1 + bj fi,j + cj fi,j+1 = fi+1,j (7.13)

where,

1 1
aj = (r − q)j∆t − σ 2 j 2 ∆t
2 2
bj = 1 + σ 2 j 2 ∆t + r∆t
1 1
cj = − (r − q)j∆t − σ 2 j 2 ∆t
2 2

The value of the put at time T is max(K − ST , 0). Hence,

fN,j = max(K − j∆S, 0), j = 0, 1, . . . , M (7.14)


186 Finite Difference Methods

The value of the put option when the stock price is zero is K. Hence

fi,0 = K, i = 0, 1, . . . , N (7.15)

We assume that the put option is worth zero when S = Smax , so that

fi,M = 0, i = 0, 1, . . . , N (7.16)

For the points corresponding to time T − ∆t, equation (7.12) with i = N − 1 gives

aj fN −1,j−1 + bj fN −1,j + cj fN −1,j+1 = fN,j (7.17)

for j = 1, 2, . . . , M − 1. The right-sides of these equations are known from equation (7.14).
Furthermore, from equations (7.15) and (7.16),

fN −1,0 = K (7.18)
fN −1,M = 0 (7.19)

Equation (7.17) are therefore M − 1 simultaneous equations that can be solved for the M − 1
unknowns: fN −1,1 , fN −1,2 , . . . , fN −1,M −1 . After this has been done, each value of fN −1,j is
computed with K − j∆S. If fN −1,j < K − j∆S, early exercise at time T − ∆t is optimal
and fN −1,j is equal to K − j∆S. The node corresponding to time T − 2∆t are handled in
similar way, and so on.

The Listing in 7.5 is a function for the implementation of European put option using the
implicit finite difference method

Listing 7.5: A function for computing the European options analytically


1 d e f EuPutImpl ( S0 , K, r , T, sigma , Smax , dS , dt ) :
2

3 ”””
4 A f u n c t i o n f o r i m p l i m e n t i n g I m p l i c i t F i n i t e D i f f e r e n c e Method f o r ...
S o l v i n g European Put o p t i o n
5 Imputs :
6 S0 : t h e i n i t i a l p r i c e
7 K : the s t r i k e p r i c e
8 r : the r i s k - f r e e r a t e
9 sigma : t h e v o l a t i l i t y
10 Smax : t h e maximum s t o c k p r i c e
11 dS : change i n S
12 dt : change i n t
13

14 ”””
15 # S e t up g r i d and a d j u s t i n c r e m e n t s i f n e c e s s a r y
Finite Difference Methods 187

16 M = round ( Smax / dS )
17 dS = Smax / M
18 N = round (T / dt )
19 dt = T / N
20

21 matVal = np . z e r o s ( (M+1 , N+1) )


22 vetS = np . l i n s p a c e ( 0 , Smax , M+1)
23 veti = np . a r a n g e (M+1)
24 vetj = np . a r a n g e (N+1)
25

26 # S e t up boundary c o n d i t i o n s
27 matVal [ : , N] = np . maximum(K - vetS , 0 )
28 matVal [ 0 , : ] = K #∗ np . exp ( - r ∗ dt ∗ (N - v e t j ) )
29 matVal [ - 1 , : ] = 0
30

31 # S e t up t h e t r i d i a g o n a l c o e f f i c i e n t s m a t r i x
32 a = 0 . 5 ∗ ( r ∗ dt ∗ v e t i - sigma ∗∗2 ∗ dt ∗ ( v e t i ∗∗ 2 ) )
33 b = 1 + sigma ∗∗ 2 ∗ dt ∗ ( v e t i ∗∗ 2 ) + r ∗ dt
34 c = - 0 . 5 ∗ ( r ∗ dt ∗ v e t i + sigma ∗∗2 ∗ dt ∗ ( v e t i ∗∗ 2 ) )
35 c o e f f = np . d i a g ( a [ 2 :M] , - 1 ) + np . d i a g ( b [ 1 :M] ) + np . d i a g ( c [ 1 :M- 1 ] , 1 )
36 P, L , U = lu ( c o e f f )
37

38 # Solve the sequence of l i n e a r systems


39 aux = np . z e r o s (M- 1 )
40 f o r j i n r a n g e (N, 0 , - 1 ) :
41 aux [ 0 ] = - a [ 1 ] ∗ matVal [ 0 , j ] # Other term from BC i s z e r o
42 y = np . l i n a l g . s o l v e (P , matVal [ 1 :M, j ] + aux )
43 matVal [ 1 :M, j - 1 ] = np . l i n a l g . s o l v e (U, np . l i n a l g . s o l v e ( L , y ) )
44
45 # Return p r i c e , p o s s i b l y by l i n e a r i n t e r p o l a t i o n o u t s i d e t h e g r i d
46 p r i c e = np . i n t e r p ( S0 , vetS , matVal [ : , 0 ] )
47 d f = pd . DataFrame ( matVal [ : : - 1 ] , i n d e x= v e t S [ : : - 1 ] , ...
columns=v e t j [ : : - 1 ] ∗ 0 . 5 )
48
49 r e t u r n p r i c e . round ( 2 ) , d f . round ( 2 )

The Listing in 7.6 is a function for the implementation of American put option using the
implicit finite difference method

Listing 7.6: A function for computing the European options analytically


1 d e f AmPutImpl ( S0 , K, r , T, sigma , Smax , dS , dt ) :
2 ”””
3 A f u n c t i o n f o r i m p l i m e n t i n g I m p l i c i t F i n i t e D i f f e r e n c e Method f o r ...
S o l v i n g American Put o p t i o n
4 Imputs :
5 S0 : t h e i n i t i a l p r i c e
6 K : the s t r i k e p r i c e
7 r : the r i s k - f r e e r a t e
8 sigma : t h e v o l a t i l i t y
9 Smax : t h e maximum s t o c k p r i c e
10 dS : change i n S
11 dt : change i n t
188 Finite Difference Methods

12

13 ”””
14 # S e t up g r i d and a d j u s t i n c r e m e n t s i f n e c e s s a r y
15 M = round ( Smax / dS )
16 dS = Smax / M
17 N = round (T / dt )
18 dt = T / N
19

20 matVal = np . z e r o s ( (M + 1 , N + 1 ) )
21 vetS = np . l i n s p a c e ( 0 , Smax , M + 1 )
22 veti = np . a r a n g e (M + 1 )
23 vetj = np . a r a n g e (N + 1 )
24

25 # S e t up boundary c o n d i t i o n s
26 matVal [ : , N] = np . maximum(K - vetS , 0 )
27 matVal [ 0 , : ] = K #∗ np . exp ( - r ∗ dt ∗ (N - v e t j ) )
28 matVal [ - 1 , : ] = 0
29

30 # S e t up t h e t r i d i a g o n a l c o e f f i c i e n t s m a t r i x
31 a = 0 . 5 ∗ ( r ∗ dt ∗ v e t i - sigma ∗∗ 2 ∗ dt ∗ ( v e t i ∗∗ 2 ) )
32 b = 1 + sigma ∗∗ 2 ∗ dt ∗ ( v e t i ∗∗ 2 ) + r ∗ dt
33 c = - 0 . 5 ∗ ( r ∗ dt ∗ v e t i + sigma ∗∗ 2 ∗ dt ∗ ( v e t i ∗∗ 2 ) )
34 c o e f f = np . d i a g ( a [ 2 :M] , - 1 ) + np . d i a g ( b [ 1 :M] ) + np . d i a g ( c [ 1 :M - ...
1 ] , 1)
35

36 # I n i t i a l i z e t h e LU d e c o m p o s i t i o n
37 P, L , U = lu ( c o e f f )
38

39 # Solve the sequence of l i n e a r systems


40 aux = np . z e r o s (M - 1 )
41 f o r j i n r a n g e (N, 0 , - 1 ) :
42 aux [ 0 ] = - a [ 1 ] ∗ matVal [ 0 , j ] # Other term from BC i s z e r o
43 y = np . l i n a l g . s o l v e (P , matVal [ 1 :M, j ] + aux )
44 matVal [ 1 :M, j - 1 ] = np . l i n a l g . s o l v e (U, np . l i n a l g . s o l v e ( L , y ) )
45

46 # Implement e a r l y e x e r c i s e
47 f o r i i n r a n g e ( 1 , M) :
48 matVal [ i , j - 1 ] = max( matVal [ i , j - 1 ] , K - v e t S [ i ] )
49

50 # Return t h e p r i c e
51 p r i c e = np . i n t e r p ( S0 , vetS , matVal [ : , 0 ] )
52 d f = pd . DataFrame ( matVal [ : : - 1 ] , i n d e x= v e t S [ : : - 1 ] , ...
columns=v e t j [ : : - 1 ] ∗ 0 . 5 )
53

54 r e t u r n p r i c e . round ( 2 ) , d f . round ( 2 )

Example 7.3.1
Consider a 5-month American put option on a non-dividend-paying stock when the
stock price is $50, the strike price is $50, the risk-free interest rate is 10% per annum,
and the volatility is 40% per annum.
Finite Difference Methods 189

1 im po rt F u n c t i o n s a s f n
2

3 # Example u s a g e
4 # Example u s a g e
5 S0 = 5 0 . 0
6 K = 50.0
7 r = 0.1
8 T = 5/12
9 sigma = 0 . 4
10 Smax = 1 0 0 . 0
11 dS = 5
12 dt = 5/120
13 Euput , d f = f n . EuPutImpl ( S0 , K, r , T, sigma , Smax , dS , dt )
14
15 p r i n t ( f ” European Put Option P r i c e : {Euput : . 2 f } ” )
16

17
18 Amput , d f = f n . AmPutImpl ( S0 , K, r , T, sigma , Smax , dS , dt )
19 p r i n t ( f ” American Put Option P r i c e : {Amput : . 2 f } ” )
20
21 European Put Option P r i c e : 3 . 9 1
22 American Put Option P r i c e : 4 . 0 7

Table 7.5: Grid value European put option in Example 7.3 using implicit finite difference
methods.
S 5 4.5 4 3.5 3 2.5 2 1.5 1 0.5 0
100.0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.0
95.0 0.02 0.02 0.01 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.0
90.0 0.05 0.04 0.03 0.02 0.01 0.01 0.00 0.00 0.00 0.00 0.0
85.0 0.09 0.07 0.05 0.03 0.02 0.01 0.01 0.00 0.00 0.00 0.0
80.0 0.15 0.12 0.09 0.07 0.04 0.03 0.02 0.01 0.00 0.00 0.0
75.0 0.27 0.22 0.17 0.13 0.09 0.06 0.03 0.02 0.01 0.00 0.0
70.0 0.46 0.39 0.31 0.25 0.18 0.13 0.08 0.04 0.02 0.00 0.0
65.0 0.80 0.69 0.59 0.48 0.37 0.28 0.19 0.11 0.05 0.02 0.0
60.0 1.38 1.24 1.09 0.93 0.77 0.61 0.45 0.30 0.16 0.05 0.0
55.0 2.35 2.18 2.00 1.80 1.58 1.34 1.08 0.80 0.51 0.22 0.0
50.0 3.91 3.74 3.56 3.35 3.12 2.86 2.54 2.15 1.66 0.99 0.0
45.0 6.27 6.16 6.04 5.91 5.77 5.62 5.46 5.30 5.14 5.02 5.0
40.0 9.51 9.50 9.50 9.50 9.51 9.52 9.56 9.62 9.70 9.83 10.0
35.0 13.55 13.64 13.75 13.86 13.98 14.11 14.26 14.43 14.61 14.80 15.0
30.0 18.14 18.30 18.46 18.63 18.81 19.00 19.19 19.39 19.59 19.79 20.0
25.0 23.00 23.19 23.38 23.58 23.78 23.98 24.18 24.38 24.59 24.79 25.0
20.0 27.97 28.17 28.37 28.57 28.77 28.97 29.18 29.38 29.59 29.79 30.0
15.0 32.96 33.16 33.36 33.57 33.77 33.97 34.18 34.38 34.59 34.79 35.0
10.0 37.96 38.16 38.36 38.57 38.77 38.97 39.18 39.38 39.59 39.79 40.0
5.0 42.98 43.17 43.37 43.57 43.77 43.98 44.18 44.38 44.59 44.79 45.0
0.0 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.0
190 Finite Difference Methods

Explicit Finite Difference Method


Chapter 8

Modeling Volatility

Learning Outcomes
By the end of this chapter, you will be able to:
• Explain the meanings of volatility smile, volatility surface and implied volatility.
• Compute the implied volatility for an option.
• Explain the different stochastic volatility models.

8.1 Local Volatility


The Black-Scholes model made a simplifying assumption by considering assets to have a
constant volatility represented as σ. In reality, volatility can vary based on factors like the
strike price or time to maturity of an option. Implied volatility is the fixed volatility level
that, when used in the Black-Scholes model, would result in the model’s calculated option
price matching the actual market price.

Here are two related concepts:

(1) Volatility Smile: This term describes a graphical representation of implied volatility
for options with the same time to maturity but different strike prices. The graph can
exhibit a smile-like shape due to varying implied volatilities at different strikes.
(2) Volatility Surface: This concept extends the idea of implied volatility into a three-
dimensional plot. It illustrates implied volatility as a function of both strike price and

191
192 Local Volatility

time to maturity, providing a comprehensive view of how implied volatility changes


across different options.

These concepts are vital in understanding and managing options in the financial world, as
they reflect the market’s expectations about future volatility and play a key role in options
pricing and trading.

In an ideal scenario where the Black-Scholes model precisely represents the market, the
implied volatility surface would appear flat. This means that implied volatility would remain
constant across all strike prices and maturities.

8.1.1 Implied Volatilities of Calls and Puts


The implied volatility of a European call option is the same as that of a European put
option when they have the same strike price and time to maturity. Therefore, when talking
about a volatility smile of volatility surface we do not have to worry about whether the
options are calls or puts.The same is at least approximately true for American options.

From the put-call parity relation,

p + S0 e−qT = c + Ke−rT , (8.1)

where q is a dividend yield on the underlying asset. The relation (8.1) holds for market
prices (pmkt and cmkt ) and for Black-Scholes-Merton prices (pBS and cBS ). Thus,

pmkt + S0 e−qT = cmkt + Ke−rT

and
pBS + S0 e−qT = cBS + Ke−rT

Subtracting these two equations, we get

pBS − pmkt = cBS − cmkt (8.2)

This shows that the dollar pricing error when the Black-Scholes-Merton model is used to
price a European put option should be exactly the same as the corresponding call option. It
follows that, when pBS = pmkt , it must be true that cBS = cmkt .

Now suppose that the assumed volatility is adjusted to make the Black-Scholes call price
equal to the market call price, forcing the left side of equation (8.2) to zero. The right side
must also go to zero, which means that the implied volatility of the put must equal that of
the call. In other words, the implied volatility curve (the smile) of the put must be identical
Local Volatility 193

to that of the call.

Example 8.1.1
Suppose that the market price of a European call option on a non-dividend-paying
stock is 1.875 when S0 = 21, K = 20, r = 0.1, and T = 0.25. The implied volatility
is the value σ that, when substituted into the Black-Scholes formula for call option,
gives c = 1.875. An iterative search procedure can be used to find the implied σ.

Listing 8.1: Python functions for Monte Carlo simulation of two stocks
1 im po rt numpy a s np
2 im po rt m a t p l o t l i b . p y p l o t a s p l t
3 from s c i p y . o p t i m i z e im por t newton
4 from s c i p y . s t a t s i mpo rt norm
5

6
7 d e f b s m o p t i o n p r i c e ( S , K, T, r , sigma , o p t i o n t y p e= ' c a l l ' ) :
8 d1 = ( np . l o g ( S / K) + ( r + 0 . 5 ∗ sigma ∗ ∗ 2 ) ∗ T) / ( sigma ∗ np . s q r t (T) )
9 d2 = d1 - sigma ∗ np . s q r t (T)
10 i f o p t i o n t y p e == ' c a l l ' :
11 r e t u r n S ∗ norm . c d f ( d1 ) - K ∗ np . exp ( - r ∗ T) ∗ norm . c d f ( d2 )
12 else :
13 r e t u r n K ∗ np . exp ( - r ∗ T) ∗ norm . c d f ( - d2 ) - S ∗ norm . c d f ( - d1 )
14
15 d e f i m p l i e d v o l a t i l i t y ( o p t i o n p r i c e , S , K, T, r , o p t i o n t y p e= ' c a l l ' ) :
16 d e f f ( sigma ) :
17 r e t u r n b s m o p t i o n p r i c e ( S , K, T, r , sigma , o p t i o n t y p e ) - ...
option price
18

19 r e t u r n newton ( f , 0 . 2 ) # I n i t i a l guess for implied v o l a t i l i t y


20

21 # Example u s a g e :
22 S0 = 21 # Current s t o c k p r i c e
23 K = 20 # Strike price
24 T = 0.25 # Time t o e x p i r a t i o n ( i n y e a r s )
25 r = 0.1 # Risk - f r e e i n t e r e s t r a t e
26 option price = 1.875 # Market o p t i o n p r i c e
27
28 # Calculate implied v o l a t i l i t y
29 i m p l i e d v o l = i m p l i e d v o l a t i l i t y ( o p t i o n p r i c e , S0 , K, T, r )
30
31 print ( f ” Implied V o l a t i l i t y : { implied vol : . 4 f }” )
32

33 #I m p l i e d V o l a t i l i t y : 0 . 2 3 4 5
34

35 # Ks = np . l i n s p a c e ( 5 , 3 0 , 1 0 )
36 # imp vols = [ ]
37 # f o r k i n Ks :
38 # v o l = i m p l i e d v o l a t i l i t y ( o p t i o n p r i c e , S0 , k , T, r )
39 # i m p v o l s . append ( v o l )
40 # p l t . p l o t ( Ks , i m p v o l s )
194 Local Volatility

Note that implied volatilities are used to monitor the market’s opinion about the volatility of
a particular stock. Whereas historical volatilities are backward looking, implied volatilities
are forward looking.

8.1.2 The Constant Elasticity of Variance Model(CEV)


One alternative to Black-Scholes-Merton is the constant elasticity of variance (CEV) model.
This is a diffusion model where the risk-neutral process for a stock price S is

dS = (r − q)Sdt + σS β dW

where r is the risk-free rate, q is the dividend yield, dW is a Wiener process, σ is volatility
parameter, and β is a positive constant. The parameter σ is roughly equivalent to the
volatility in the usual lognormal model multiplied by S 1−β .

• When β = 1, the CEV model is the geometric Brownian motion model .


• When β < 1, the volatility increases as the stock price decreases.
• When β > 1, the volatility increases as the stock prices increases.

The valuation formulas for European call and put options under the CEV model are

c = S0 e−qT [1 − χ2 (a, b + 2, c)] − Ke−rT χ2 (c, b, a)


p = Ke−qT [1 − χ2 (c, b, a)] − S0 e−qT χ2 (a, b + 2, c)

when 0 < β < 1, and

c = S0 e−qT [1 − χ2 (a, −b, a)] − Ke−rT χ2 (a, 2 − b, c)


p = Ke−rT [1 − χ2 (a, 2 − b, c)] − S0 e−qT χ2 (c, −b, a)

when β > 1, with

[Ke−(r−q)T ]2(1−β) 1 S 2(1−β)


a= , b = , c =
(1 − β)2 v 1−β (1 − β)2 v

where
σ2
v= [e2(r−q)(β−1)T − 1]
2(r − q)(β − 1)
and χ2 (z, k, v) is the cumulative probability that a variable with a non-central χ2 distribution
with non-centrality parameter v and k degree of freedom is less than z.
Stochastic Volatility Models 195

8.2 Stochastic Volatility Models


The BSM model assumes that volatility is constant. In practice volatility varies through time.
Suppose that the volatility parameter in gBm is known function of time. The risk-neutral
process followed by the asset price is then

dS = (r − q)Sdt + σ(t)SdW (8.3)

The BSM formulas are then correct provided that the variance rate is set equal to the
average variance rate during the life of the option.

8.2.1 The Heston Model


Equation (8.3) assumes that the instantaneous volatility of an asset is perfectly predictable.
In practice, volatility varies stochastically. This has led to the development of more complex
models with two stochastic variables: the stock price and its volatility. One model that has
been used by researchers is

dS √
= (r − q)dt + V dWS (8.4)
S
dV = a(VL − V )dt + ξV α dWV (8.5)

where a, VL , ξ, and α are constants, and dWS and dWV are Wiener processes. The variable
V in this model is the asset’s variance rate. The variance rate has a drift that pulls it back
to a level VL at a rate a.

When volatility is stochastic but uncorrelated with the asset price, the price of a European
option is the Black-Scholes-Merton price integrated over the probability distribution of the
average variance rate during the life of the option. Thus, a European call price is
Z ∞
c(V̄ )g(V̄ )dV̄
0

where V̄ is the average value of the variance rate, c is the Black-Scholes-Merton price
expressed as a function of V̄ , and g is the probability density function of V̄ in a risk-neutral
world.

8.2.2 The SABR Model


The SABR model is a widely used mathematical model in quantitative finance to describe
the dynamics of asset prices and their associated volatility. SABR stands for “Stochastic
196 Stochastic Volatility Models

Alpha, Beta, Rho,” which are the key parameters of the model. The primary application
of the SABR Model is in the pricing and risk management of over-the-counter (OTC)
derivatives, particularly interest rate derivatives, but can also be used for other asset classes
such as foreign exchange and commodities. The advantage of the model is that it can fit
the volatility smiles observed in practice reasonably well and is useful for managing risks
associated with movements in the smile through time.

The model is

dF = σF β dW1

= vdW2
σ

where F is a forward interest rate or the forward price of an asset, dW1 and dW2 are Wiener
processes, σ is the stochastic volatility, and β and v are constants. Three other parameters
are ρ, the correlation between dW1 and dW2 , σ0 , the initial value of σ, and F0 , the initial
value of F .

The approximate formula for the Black-model implied volatility given by SABR for a
European option with strike price K given as follows: Define

(1−β)/2
x = (F0 K) , y = (1 − β) ln(F0 /K)

σ0
A= ,
x(1 + y 2 /24 + y 4 /1920)
(1 − β)2 σ02 2 − 3ρ2 2
 
ρβvσ0
B =1+ + + v T
24x2 4x 24
  p !
vx F0 1 − 2ρϕ + ϕ2 + ϕ − ρ
ϕ= ln , χ = ln
σ0 K 1−ρ

The implied volatility is ABϕ/χ. If F0 = K, this becomes σ0 B/(F01−β )

8.2.3 The IVF Model


The implied volatility function(IVF) model or the local volatility model, provides and exact
fit to the European option prices observed on any given day, regardless of the shape of the
volatility surface. The risk-neutral process for the asset price in the model has the form

dS = [r(t) − q(t)]Sdt + σ(S, t)SdW


Stochastic Volatility Models 197

where r(t) is the instantaneous forward interest rate for a contract maturing at time t and
q(t) is the dividend yield as a function of time. The volatility σ(S, t) is a function of both
S and t and is chosen so that the model price all European options consistently with the
market. It is shown both by Dupire and by Andersen and Brotherton-Ratcliffe that σ(S, t)
can be calculated analytically:

∂cmkt
+ q(T )cmkt + K[r(T ) − q(T )] ∂c∂K
mkt

[σ(K, T )]2 = 2 ∂T
2 (8.6)
K 2 ( ∂ ∂K
cmkt
2 )

where cmkt (K, T ) is the market price of a European call option with strike price K and
maturity T .
198 Stochastic Volatility Models
Chapter 9

Introduction to Fixed Income


Derivatives

Fixed income derivatives are financial instruments whose value is derived from underlying
fixed income securities such as bonds. These derivatives are widely used in financial markets
for various purposes, including risk management, speculation, and hedging strategies. They
offer investors and institutions a way to manage interest rate risk, credit risk, and overall
portfolio exposure.

Learning Outcomes
By the end of this chapter, you will be able to:
• Define basic concepts related to interest.
• Use internal rate of return to rank alternative cash flow streams.
• Explain features of bonds, such as face value, coupon payments, maturity, price,
quality rating etc.
• Calculate the spot rates, forward rates, and short rates.
• Price forward and future contracts.

199
200 Interest

9.1 Interest

Definition 9.1. An amount A invested for n period at a simple interest rate of r per
period is worth A(1 + nr) at maturity .

Definition 9.2. An amount A invested for n periods at a compound interest rate of


r per period is worth A(1 + r)n at maturity.

Interest rates are typically quoted on annual basis, even if the compounding period is less
than 1 year.

• n compounding periods in each year


• rate of interest r
• A invested for y years yields A(1 + nr )yn

Listing 9.1: Python functions for calculating interest rate


1 d e f i n t e r s t (A, r , y , n=1 , comp = True ) :
2 ”””
3 A f u n c t i o n f o r computing i n t e r s t , by d e f a u l t i t c a l c u l a t e s t h e ...
compund i n t e r s t r a t e .
4 I f we a s s i n g comp = F a l s e , I t c a l c u l a t e s the simple i n t e r s t r a t e
5 ”””
6 i f comp :
7 r e t u r n A∗(1+ r /n ) ∗ ∗ ( y∗n )
8 else :
9 r e t u r n A∗(1+ r ∗y/n )

Definition 9.3. Continuous compounding corresponds to the situation where the


length of the compounding period goes to zero. Therefore, an amount A invested for y
years is worth
r yn
lim A(1 + ) = Aery
n→∞ n
at maturity.

Future value of a stream


Given a cash flow stream (c0 , c1 , . . . , cn ) and interest rate r each period, the future value of
Interest 201

the stream is

F V = c0 (1 + r)n + c1 (1 + r)n−1 + · · · + cn
n
X
= ck (1 + r)n−k .
k=0

Example 9.1.1

Consider a cash flow stream (−2, 1, 1, 1, 1) when the periods are years and the interest
rate is 10%. The future value is

F V = −2 × (1.1)4 + 1 × (1.1)3 + 1 × (1.1)2 + 1 × 1.1 + 1 = 1.713

Listing 9.2: Python functions for calculating future value of cash flows
1 d e f FV( c , r , m = 1 ) :
2 ”””
3 A f u n c t i o n f o r computing t h e f u t u r e value of cash folows .
4 Inputs :
5 =======
6 c : c a s h f l o w s o c c u r i n i t i a l l y , o f r t h e form c = [ c0 , c1 , . . . , cn ]
7 r : t h e nominal a nn ua l i n t e r s t e r a t e
8 m : t h e i n t e r s e t r a t e i s compunded a t m e q u a l l y s p a c e p e r i o d p e r ...
y e a r . D e f a l u t i s one .
9

10 Output :
11 =======
12 pv : t h e f u t u r e v a l u e
13 ”””
14 fv = 0
15 f o r k in range ( len ( c ) ) :
16 f v += c [ k ] ∗ ( 1 + ( r /m) ) ∗ ∗ ( l e n ( c ) - k - 1 )
17 return fv

Present value of a stream


Given a cash flow stream c = (c0 , c1 , c2 , . . . , cN ) and an interest rate r per period, the
present value of this cash flow stream is

N
X ck
P V (c; r) = .
(1 + r)k
k=0
202 Interest

Example 9.1.2

Consider a cash flow stream (−2, 1, 1, 1) when the periods are years and the interest
rate is 10%. The future value is

1 1 1 1
P V = −2 + + + + = 1.17
1.1 1.12 1.13 1.14

The present value and the future value are related by

FV
PV = .
(1 + r)n

Frequent and Continuous Compounding


Suppose that r is the nominal annual interest rate and interest is compounded at m equally
spaced periods per year. Consider a stream (c0 , c1 , . . . , cn ).

n
X ck
PV = .
[1 + (r/m)]k
k=0

Suppose now that the nominal interest rate r is compounded continuously and cash flows
occur at times t0 , t1 , . . . , tn . We denote the cash flow at time tk by c(tk ). In this case

n
X
PV = c(tk )e−rtk .
k=0

Listing 9.3: Python functions for calculating the present value of cash flows
1 d e f PV( c , r , m = 1 ) :
2 ”””
3 A f u n c t i o n f o r computing t h e p r e s e n t v a l u e o f c a s h f o l o w s .
4 Inputs :
5 =======
6 c : c a s h f l o w s o c c u r i n i t i a l l y , o f r t h e form c = [ c0 , c1 , . . . , cn ]
7 r : t h e nominal a nn ua l i n t e r s t e r a t e
8 m : t h e i n t e r s e t r a t e i s compunded a t m e q u a l l y s p a c e p e r i o d p e r ...
y e a r . D e f a l u t i s one .
9

10 Output :
11 =======
12 pv : t h e p r e s e n t v a l u e
13 ”””
14 pv = 0
15 f o r k in range ( len ( c ) ) :
16 pv += c [ k ] / ( 1 + ( r /m) ) ∗∗ k
17 r e t u r n pv
Interest 203

18

19 de f PV continous ( c , r ) :
20 ”””
21 A f u n c t i o n f o r computing t h e p r e s e n t v a l u e o f c a s h f o l o w s .
22 The i n t e r s e t r a t e i s c o n t i n u o u s l l y compunded
23 Inputs :
24 =======
25 c : c a s h f l o w s o c c u r i n i t i a l l y , o f r t h e form c = [ c0 , c1 , . . . , cn ]
26 r : t h e nominal a nn ua l i n t e r s t e r a t e
27 Output :
28 =======
29 pv : t h e p r e s e n t v a l u e
30 ”””
31 pv = 0
32 f o r k in range ( len ( c ) ) :
33 pv += c [ k ] ∗ np . exp ( - r ∗k )
34 r e t u r n pv

Effective Rate
The simple interest rate that produces the same yield in one year as compounded interest.
Thus, if interest is compounded m times a year, the effective rate must satisfy the equation:

r m
re = (1 + ) − 1.
m

Internal Rate of Return

Let (c0 , c1 , c2 , . . . , cn ) be a cash flow stream. Then the internal rate of return of this stream
is a number r satisfying the equation

c1 c2 cn
0 = c0 + + + ··· + . (9.1)
1 + r (1 + r)2 (1 + r)n

The internal rate of return is defined without reference to prevailing interest rate. It is
determined entirely by the cash flows of the stream.

The internal rate of return can be used to rank alternative cash flow streams. The higher the
internal rate of return, the more desirable the investment. However, a potential investment,
or project, is presumably not worth considering unless its internal rate of return is greater
than the prevailing interest rate. If the internal rate of return is greater than the prevailing
interest rate, the investment is considered better than what is available externally in the
financial market.

Inflation

An increase over time of the general level of prices of goods and services, resulting in a
decrease of purchasing power. Governed by a compound interest formula. If rf is the
204 Interest

inflation at annual rate and the price of an item is A0 at current time, then the price after
one year is A0 (1 + rf ), after two years A0 (1 + rf )2 , and so on.

Example 9.1.3

If rf = 25% per year. A 100 Birr price now will be 100(1 + 0.25)2 = 156.25 Birr after
two years.

Inflation-adjusted rate of return


The combined effect of inflation and interest. Let r be a yearly compounded rate of return
on an investment. The actual annual rate of return ra with inflation taken into account is

1+r r − rf
ra = −1= .
1 + rf r + rf

For small rf , ra ≈ r − rf .

Let r be the annual interest rate for an investment paying Q dollars in one months.
Considering the inflation rate rf , the current value of this payment is

1
A0 = Q,
1 + i − if

r rf
where i = 12 , if = 12 .

If a payment of Q two months form now would have time-1 value,

(1 + i − if )−1 Q

and hence time-0 value of


A0 = (1 + i − if )−2 Q.

In general if you are to receive a payment of Q in n months, then the present value of this
payment, taking monthly inflation into account, is

A0 = (1 + i − if )−n Q.

Listing 9.4: Python functions for calculation of inflation adjusted rate of return
1 d e f i n f l a t i o n a d j u s t e d (Q, r , r f , n , m=1) :
2 ”””
3 A f u n c t i o n f o r computing i n f l a t i o n a d j u s t e d r a t e o f r e t e r n
4 Input :
Fixed income securities 205

5 =====
6 Q : t h e amount an i n v e s t m e n t pays a f t e r n p e r i o d s
7 r : nominal r a t e o f i n t e r e s t
8 rf : rate of i n f a l t i o n
9 m : t h e compunding i s p e r f o r m e d m t i m e s a y e a r
10 Output :
11 ======
12 A0 : t h e p r e s e n t v a l u e d i s c o u n t i n g v i a i n f l a t i o n a d j u s t e d r a t e o f ...
return
13 ”””
14 i = r /m
15 i f = r f /m
16 r a = ( i - i f ) /(1+ i f ) # inflation adjusted rate
17
18 A0 = (1+ r a ) ∗ ∗ ( - n ) ∗Q # discounting
19 r e t u r n A0

9.2 Fixed income securities


A diverse array of financial instruments, including bills, notes, bonds, annuities, futures
contracts, and mortgages, thrives within the well-established realm of money markets. These
instruments hold intrinsic value, yet they are not tangible goods; instead, they exist as
paper assets or digital entries in databases. Collectively known as financial instruments,
they encompass a wide spectrum of market items. When an instrument boasts a highly
developed market, characterized by fluid and unrestricted trading, it earns the distinction of
being termed a security. Within this category, fixed-income securities stand out, as they
promise a predetermined income stream to the holder over a specified period.

Fixed-income securities hold significant importance for investors. Firstly, they establish
the foundation of the money market, a cornerstone of investment activity that attracts
participation from a vast array of investors. Secondly, fixed-income securities serve as
valuable benchmarks when evaluating potential investments that may not be actively traded
in conventional markets. This extends beyond traditional assets, encompassing considerations
for diverse opportunities such as firms, research projects, oil leases, and royalty rights. In this
way, fixed-income securities provide essential reference points and guidance in investment
analyses.

Fixed invome securities “guarantee” a fixed cash flow. Are these really risk-free?

• Default risk
• Inflation risk
• Market risk
206 Fixed income securities

9.2.1 Annuities
An annuity is a contract that pays the holder (the annuitant) money periodically, according
to a predetermined schedule or formula, over period of time.

Perpetual Annuities or Perpetuity


Pays a fixed sum periodically forever. Suppose an amount ck = A for all k ≥ 1 paid at the
end of each period and let r be the interest rate. The present value is given by

X A A
p= k
= .
(1 + r) r
k=1

Finite-Life Streams
Suppose that a stream consists of n period of amount A , i.e, ck = A for all k = 1, . . . , n.
The present value of the finite stream relative to the interest rate r per period is

Present value = Perpetuity - Perpetuity starting in year n + 1


 
A 1 A A 1
p= − · = 1−
r (1 + r)n r r (1 + r)n
or, equivalently,
r(1 + r)n p
A=
(1 + r)n − 1

Example 9.2.1
The payment sequences of:
• Social Security funds
• pensions
• car loans,
• credit card dept, and
• mortgages

Assume interest at an annual rate r compounded m times per year and that a deposit
(withdrawal) is made at the end of each compounding interval. The value An (the value
immediately after the nth deposit( withdrawal)) of the account at time n will be computed
as follows:

Deposits (sinking fund)

At the end of n periods, the future value of the simple ordinary annuity (payments occur at
Fixed income securities 207

the end of each period) with payment P and m− periodic compounding at r per annum is:

(1 + i)n − 1 r
An = P , i := . (9.2)
i m

More generally, if a deposit of A0 is made at time 0, then the time-n value of the account is

(1 + i)n − 1
An = A0 (1 + i)n + P ,
i

Withdrawals
Let A0 be the initial value of the account and let An denote the value of the account
immediately after the nth withdrawal. The value just before withdrawal is An−1 plus the
interest over that period. One can show that,

1 − (1 + i)n
An = (1 + i)n A0 + P . (9.3)
i

The initial deposit required to support exactly N withdrawals of size P form say, a retirement
account or trust fund is given by

1 − (1 + i)−N
A0 = P (9.4)
i

or solving for P ,
i
P = A0 (9.5)
1 − (1 + i)−N
which may be used, for example to calculate the mortgage payment for a mortgage of size
A0 .

Substitute (9.5) into (9.3) we get

1 − (1 + i)n−N
An = A0 (9.6)
1 − (1 + i)−N

the time-n value of an annuity supporting exactly N withdrawals.

Listing 9.5: Python functions for calculation of annuty


1 d e f a n n u i t y (A0 , P , r , n , m, typ =1) :
2 ” ” ”A f u n c t i o n f o r c a l c u l a t i n g annuty
3 Inputes :
4 =======
5 A0 : t h e i n i t i a l d e p o s i t e
6 P : t h e payments
7 r : nominal i n t e r e s t r a t e
208 Fixed income securities

8 n : t h e p e r i o d upto which w i t h d r w a l o r d e p o s i t e i s done


9 m : t h e number o f compounding t h e i n t e r e s t r a t e eg . m = 12 i f ...
compouning o c c u r e s monthly
10 typ : 1 i f d e p o s i t s and -1 i f w i t h d r w a l
11 Output
12 ======
13 An : t h e sum o f t h e time - n v a l u e s
14 ”””
15 i = r /m
16 An = A0∗(1+ i ) ∗∗n + typ ∗P∗((1+ i ) ∗∗n - 1 ) / i
17

18 r e t u r n An

Application: Amortization

Suppose a home buyer takes out a mortgage in the amount A0 for t years at annual rate
r, compounded monthly. From the point of view of the mortgage company, the monthly
mortgage payments P constitute a withdrawal annuity with “initial deposit” A0 and is given
by
i r
P = A0 , i= , N = 12t.
1 − (1 + i)−N 12
The amount An still owed by the homeowner at the end of month n is given by

1 − (1 + i)n−N
An = A0 .
1 − (1 + i)−N

Let In (Interest) and Pn (Principal) be portions of nth payment

In = iAn−1 and Pn = P − In ,

which implies,

1 − (1 + i)n−1−N (1 + i)n−1−N
In = iA0 and Pn = iA0 .
1 − (1 + i)−N 1 − (1 + i)−N

The sequences (An ), (Pn ), and (In ) for what is called an amortization schedule. Note that,

In 1 − (1 + i)n−1−N (1 + i)N +1
= = −1
Pn (1 + i)n−1−N (1 + i)n

The ratio decreases as n increases. The maximum and minimum ration are given by

I1 IN
= (1 + i)N and =i
P1 PN
Fixed income securities 209

respectively.

Listing 9.6: Python functions for Amortization Schedule


1 d e f A m o r t i z a t i o n S h e d u l e (A0 , t , r , E) :
2 ””” Amortization Shedule
3 Inputes :
4 =======
5 A0 : t h e i n i t i a l d e p o s i t e
6 t : t h e term
7 r : t h e a nn ua l r a t e
8 E : e x t r a payement
9 ”””
10 i = r /12.
11 N = 12∗ t
12 P = i ∗A0/(1 -(1+ i ) ∗ ∗ ( -N) ) + E
13 An = [ A0 ]
14 I n = [ i ∗A0 ]
15 Pn = [ P- i ∗A0 ]
16 f o r n i n r a n g e ( 1 , N) :
17 an = (1+ i ) ∗An [ - 1 ] - P
18 i n = i ∗An [ - 1 ]
19 An . append ( an )
20 I n . append ( i n )
21 Pn . append (P- I n [ - 1 ] )
22 columns = [ ' Payment ' , ' P r i n c i p a l ' , ' I n t e r e s t ' , ' Balance ' ]
23 data = pd . DataFrame ( np . t r a n s p o s e ( [ N∗ [ P ] , Pn , In , An ] ) , ...
columns=columns )
24 r e t u r n data [ 1 : ]

Example 9.2.2
Suppose you have borrowed 1000, 000 Birr form a credit union. The terms of the loan
are that the yearly interest is 13.5% compounded monthly. You are to make equal
monthly payments of such magnitude as to repay (amortize) this loan over 8 years.
How much are the monthly payments?

Application: Retirement
Retirement account:

• You make monthly deposits of size P .


• The account offers an annual rate r, compounded monthly.
• After t years, you transfer the account to one that pays annual rate of r′ compounded
monthly.
• During retirement, you make monthly withdrawals of size Q for s years, drawing down
the account to zero.
210 Fixed income securities

Final value of the first account should match the initial value of the second account. This
relationship can pe expressed as:

(1 + i)12t − 1 1 − (1 + i′ )−12s r ′ r′
P =Q , i= , i := (9.7)
i i′ 12 12

Solving for P we obtain the formula

i 1 − (1 + i′ )−12s
P = Q (9.8)
i′ (1 + i)12t − 1

Taking into account that yearly inflation rf × 100%, one can get

i(1 + if )12t 1 − (1 + if )12s (1 + i′ )−12s


  
P
= .
Q (1 + i)12t − 1 i′ − i − f

9.2.2 Bonds
A bond is an obligation by the bond issuer to pay money to the bond holder according to
rules specified at time the bond is issued.

Features of bonds

• Pays a specific amount, its face value F or equivalently its par value: usually 100 or
1000.
• In addition most bonds pay periodic coupon payments α: pays c = αF/2 every six
months
• Maturity T : Date of the payment of the face value and the last coupon
• Price P
• Quality rating : to characterize the nature of the risk, bonds are rated by rating
organizations.

9.2.3 Yield to maturity


A bond’s yield is the interest rate implied by the payment structure. Specifically, it is the
interest rate at which the present value of the stream of payment is exactly equal the current
price. It is just the internal rate of return of the bond at the current price.

Suppose that a bond with face value F makes m coupon payments of C/m each year and
there are n periods remaining. The coupon payments sum to C within a year. Suppose also
that the current price of the bond is P . Then the yield to maturity is the value of λ such
that
Term structure of interest rates 211

n
X C/m F
P = λ k
+ λ n
k=1
(1 + m ) (1 + m )
or  
F C 1
P = λ n
+ 1− , (9.9)
(1 + m ) λ [1 + (λ/m)]n
This value of λ, the yield to maturity, is the interest rate implied by the bond when interest
is compounded m times per year.

Why do we rely on yields? Firstly, they serve as a concise summary of essential bond
attributes, including face value, coupon rate, maturity date, and credit quality. Moreover,
yields offer insights into bond quality; lower-quality bonds typically command lower prices,
resulting in higher yield to maturity. Additionally, yields are intimately connected to
interest rate movements, reflecting how bond prices respond to shifts in the broader financial
landscape. However, it’s important to note that while yields provide valuable information,
they are not exhaustive measures and may not capture every aspect of a bond’s complexity.

9.3 Term structure of interest rates

9.3.1 The Yield Curve


Yield curve is a plot of yield versus maturity for bonds of similar quality. The slop of the
yield curve can predict future interest rate changes and economic activity.

There are three main yield curve shapes:

(1) normal upward-sloping curve,


(2) inverted downward-sloping curve, and
(3) flat.

The “normally shaped” yield curve increases monotonically with maturity. It reflects the
that long-term bonds are usually less desirable than short-term bonds. For the inverted
case, the yield curve decreases as maturity increases. This tend to occur when short-term
rates remain near their previous levels.

A flat yield curve reflects similar yields across all maturities, implying and uncertain economic
situation

9.3.2 The Term Structure


Interest rates depend on the term or duration of the loan. Why?
212 Term structure of interest rates

• Investors prefer their funds to be liquid rather than tied up.


• Investors have to be offered a higher rate to lock in funds for a longer period.
• Other explanations: expectation of future rates, market segmentation.

Spot Rates
Spot rates are the basic interest rates defining the term structure. Spot rates st = interest
rate for a loan maturing in t years.

A
A in year t =⇒ P V =
(1 + st )t

(a) Yearly Under the yearly compounding convention, the spot rate st is defined such that

(1 + st )t

is the factor by which a deposit held t years will grow.


(b) m periods per year Under a convention of compounding m periods per year, the spot
rate st is defined so that
(1 + st /m)mt

is the corresponding factor.


(c) Continuous Under a continuous compounding convention, the spot rate st is defined so
that
est t

is the corresponding growth factor.

Spot rates can, in theory, be measured by recording the yields of zero-coupon bonds.

Discount Factors and Present Value

Discount factors dt are factors by which future cash flows must be multiplied to obtain an
equivalent present value.

(a) Yearly For yearly compounding,

1
dk = .
(1 + sk )k

(b) m periods per year For compounding m periods per year,

1
dk = .
(1 + sk /m)mk
Term structure of interest rates 213

(c) Continuous For continuous compounding,

dt = e−st t .

The discount factors transform future cash flows directly into an equivalent present value.
Hence given any cash flow stream (c0 , c1 , . . . , cn ), the present value, relative to the prevailing
spot rates, is
P V = c0 + d1 c1 + d2 c2 + · · · + dn cn .

Forward rates
The forward rate between times u and v with u < v is denoted by fuv . It is the interest
rate quoted today for lending form year u to v.

(a) Yearly For yearly compounding, the forward rates satisfy,


1
(1 + sv )v
  v−u
v u (v−u)
(1 + sv ) = (1 + su ) (1 + fuv ) =⇒ fuv = −1
(1 + su )u
Hence,
1
(1 + sv )v
  v−u
fuv = −1
(1 + su )u
(b) m periods per year For m period-per-year compounding, the forward rates satisfy, for
u < v,
(1 + sv /m)v = (1 + su /m)u (1 + fuv /m)(v−u) .

Hence,
1/(v−v)
(1 + sv /m)v

fuv =m −m
(1 + su /m)u
(c) Continuous For continuous compounding, the forward rates fuv are derived for all u
and v, with v > u, and
esv v = esu u efuv (v−u) .

Hence,
sv v − su u
fuv = .
v−u
Discount Factors
The symbol dj,k or d(j, k) denotes the discount factor used to discount cash received at time
k back to an equivalent amount of cash at time j.

1
The normal, time zero, discount factors are d1 = d0,1 , d2 = d0,2 , . . . , dn = d0,n = (1+sn )n .
214 Term structure of interest rates

The discount factors can be expressed in terms of the forward rates as


 v−u
1
du,v =
1 + fu,v

These factors satisfy the compounding rule

du,w = du,v dv,w

for u < v < w.

Short Rates
Short rates are the forward rates spanning a single time period. The short rate at time k is
accordingly
rk = fk,k+1 .

Relation between spot and forward rates

t−1
Y t−1
Y
(1 + st )t = (1 + fk,k+1 ) = (1 + rk ).
k=0 k=0

Floating interest rates


In this case, interest rates are random quantities. They fluctuate with time. Let rk denotes
the per period interest rate over period [k, k + 1). The exact value of rk becomes known only
at time k. One-period loans issued in period k to be repaid in period k + 1 are charged rk .

Floating-Rate Bonds
A floating-rate note or bond has a fixed face value and fixed maturity, but its coupon
payments are tied to current (short) rates of interest.

• coupon payment at time k : rk−1 F


• face value at time n : F

The value of a floating-rate bond is equal to par at any reset point. Compute the arbitrage-
free price Pf of th floating rate bond

Split up the cash flows of floating rate bond into simpler cash flow

• pk = Price of contract paying rk−1 F at time k


F
• P = price of Principal F at time n = (1+r)n
Pn
Price of floating rate bond Pf = P + k=1 pk
Term structure of interest rates 215

Price of contract that pays rk−1 F at time k. Construct a portfolio that has a deterministic
cash flow.

The price of a deterministic cash flow at time t = 0 is given by the NPV

t=0 t=k−1 t=k


Buy contract −pk rk−1 F
Borrow α over [0, k − 1] α −α(1 + r0 )k−1
Borrow α(1 + r0 )k−1 over [k − 1, k] α(1 + r0 )k−1 −α(1 + r0 )k−1 (1 + rk−1 )
Lend α from [0, k] −α α(1 + r0 )k

Table 9.1:

Cash flow at time k

ck = rk−1 F − α(1 + r0 )k−1 (1 + rk−1 ) + α(1 + r0 )k


= (F − α(1 + r0 )k−1 )rk−1 + αr0 (1 + r0 )k−1

In the last line the first part is random and the second part is deterministic. Thus the
random term becomes 0 if we set

F
α=
(1 + r0 )(k−1)

Net cash flow is now deterministic . . . ck = αr0 (1 + r0 )(k−1) = F r0

ck F r0
Price of floating rate bond Price of the portfolio = pk − α + α = pk = (1+r)k
= (1+r)k
Recall that
n
F X
Pf = + pk
(1 + r0 )n t=1
n
F X F r0
= n
+
(1 + r0 ) t=1
(1 + r0 )k
n
F F r0 X 1
= n
+
(1 + r0 ) (1 + r0 ) t=1 (1 + r0 )k−1

F F r0 1 − (1+r1 0 )n
= + · 1
(1 + r0 )n (1 + r0 ) 1 − 1+r 0

=F

The price Pf of a floating rate bond is equal to its face value F .


216 Forward contract

9.4 Forward contract

Definition 9.4. A forward contract gives the buyer the right, and also the obligation,
to purchase
• a specified amount of an asset
• at a specified time T
• at a specified price F (called the forward price set at time t = 0)

Example 9.4.1
• Forward contract for delivery of a stock with maturity 6 months
• Forward contract for sale of gold with maturity 1 year
• Forward contract to buy $10m worth of Euros with maturity 3 months.
• Forward contract for delivery of 9− month T −Bill with maturity 3 months.

Setting the forward price F

Set the forward price F for a forward contract at time t = 0 for 1 unit of an asset with

• asset price St at time t


• and maturity T

ft = value/price at time t of a long position in the forward contract


Value at time T : fT = (ST − F )

• long position in forward: must purchase the asset at price F


• spot price of asset: ST

Forward price F is set so that time t = 0 value/price f0 is 0, i.e., no money need be


exchanged when completing the contract agreement.

Use no-arbitrage principle to set F .

Forward price formula : Suppose an asset be stored at zero cost and also sold short.
Suppose the current spot price ( at t = 0) of the asset is S0 . The theoretical forward price
F (for delivery at t = T ) is

S0
F =
d(0, T )
Forward contract 217

where d(0, T ) is the discount factor between 0 and T .

No-arbitrage argument to set F

At t = 0 Initial cost Final receipt


Short 1 unit −S0 0
S0
Lend $S0 S0 d(0,T )
Go long 1 forward 0 −F
S0
Total 0 d(0,T ) −F

The portfolio has a deterministic cash flow at time T and the cost= 0. Therefore,
 
S0 S0
0= −F d(0, T ) =⇒ F =
d(0, T ) d(0, T )

If there is a constant interest rate r compounded continuously, the forward rate formula
becomes
F = S0 erT .

Costs of Carry
Holding a physical asset such as gold entails storage costs, such as vault rental and insurance
fees. Holding a security may, alternatively, entail negative costs, representing dividend or
coupon payments. These costs (or incomes) affect the theoretical forward price.

Suppose an asset has a holding cost of c(k) per unit in period k, and the asset can be sold
short. Suppose the initial spot price is S. Then the theoretical forward price is

M −1
S X c(k)
F = + , (9.10)
d(0, M ) d(k, M )
k=0

Example 9.4.2
Sugar with storage cost: The current price of sugar is 100 Birr per Kg. We wish
to find the forward price of sugar to be delivered in 5 months. The carrying cost of
sugar is 1 Birr per Kg per month, to be paid at the beginning of the month, and the
interest rate is constant at 9% per annum.

The interest rate is 0.09/12 = 0.0075 per month. The reciprocal of the 1-month discount
218 Swaps

rate (for any month) is 1.0075. Therefore

F = (1.0075)5 (100) + [(1.0075)5 + (1.0075)4


+ (1.0075)3 + (1.0075)2 + 1.0075](1) = 108.92 Birr

The value of a forward

Suppose a forward contract for delivery at time T in the future has delivery price F0 and a
current forward price Ft . The value of the contract is

ft = (Ft − F0 )d(t, T ),

where d(t, T ) is the risk-free discount factor over the period from t to T .

Forward value ft for t > 0 Recall the value of a long forward position

• at time 0: f0 = 0
• at time T : fT = ST − F

Pricing via the no-arbitrage arguments

At t Initial cost Final receipt


Long 1, Ft contract 0 ST − Ft
Short F0 contract ft F0 − ST
Total ft F0 − Ft

The present value of this portfolio is ft + (F0 − Ft )d(t, T ), and this must be zero. Therefore

ft = (Ft − F0 )d(t, T )

9.5 Swaps

Definition 9.5. Swaps are contracts that transform one kind of cash flow into
another.

Example 9.5.1
• Plain vanilla swap: one party swaps a series of variable payments for a series of
fixed-level payments.
Swaps 219

• Commodity swaps : exchange floating price for a fixed price. e.g. gold swaps, oil
swaps- is an agreement to exchange one cash flow stream for another.
• Currency swaps

Why swaps? : Change the nature of cash flows

• Example: swap might be motivated by the fact that party B has loaned money to a third
part C under floating rate terms; but party B would rather have fixed payments. The
swap with A effectively transforms the floating rate stream to one with fixed payments.
• Example of a commodity swap, consider an electric power company that must purchase
oil every month for its power generation facility.

Figure 9.1: The power company buys oil on the spot market every month. The company
arranges a swap with a counter-party(or swap dealer) to exchange fixed payments for spot
price payments. The net effect is that the power company has eliminated the variability of
its payments

Value of a Commodity Swap


Consider an agreement where:

• party A receives spot price for N units of commodity each period while paying a fixed
amount X per unit for N units
• the agreement is made for M periods,

The net cash flow stream received by A is

N × (S1 − X, S2 − X, . . . , SM − X)

where Si denotes the spot price of the commodity at time i.

Value of a commodity swap uses the concept of forward market:

• At t = 0, the forward price of one unit of the commodity to be received at time i is


Fi =⇒ by discounting back to time 0 the current value of receiving Si at time i =
220 Swaps

d(0, i)Fi
• Applying this argument each period, we find that the total value of the stream is

M
X
V = d(0, i)(Fi − X)N. (9.11)
i=1

• The value of the swap can be determined form the series of forward price.
• Usually X is choosen to make the V = 0, so that the swap represents an equal exchange.

Value of an Interest Rate Swap


Consider a plain vanilla interest rate swap in which party A agrees to make payments of a
fixed r of interest on a notional principal N while receiving floating-rate payments on the
same notional principal for M periods

• rt = floating (unknown) interest rate at time t

• Cash flows at time t = 1, . . . , M

– Company A (long) : receives N rt−1 and pays N r


– Company B (short) : receives N r and pays N rt−1
• The cash flow stream received by A

N × (r1 − r, r2 − r, . . . , rM − r)

(N r1 − N r, N r2 − N r, . . . , N rM − N r)

Recall how we prove the valuation for floating rate bond. We apply the concept here,

• The floating rate cash flow stream is exactly the same as that generated by a floating-rate
bond of principal N and maturity M , except that no final principal payment is made.
Hence
M
X
VA = N − d(0, M )N − N r d(0, i)
i=1
" M
#
X
= 1 − d(0, M ) − r d(0, i) N
i=1

• Set r so that VA = 0, i.e.


1 − d(0, M )
r = PM
i=1 d(0, i)
Basics of Futures Contracts 221

9.6 Basics of Futures Contracts

A futures contract is similar with forward contract with two differences.

(1) Future contracts are traded at an exchange rather than over-the-counter(directly by the
parties).
• An exchange helps define universal prices
• provides convenience and security because individuals do not themselves need to find
an appropriate coounterparty and need not face the risk of counter-party default.
• Individual contracts are made with the exchange, the exchange itself being the
counter-party for both long and short traders.
(2) Daily futures prices, denoted below by a sequence F0 , F1 , . . . , FT , are determined daily
in a process called “daily settlement” or “marking to market.”

Margin account- initial amount of cash (10% ot 20%) of the price required form both
buyer and the seller.

• If the nth daily difference Fn −Fn−1 is positive, this amount is transferred from the seller’s
to the buyer’s margin account. If negative, then the amount Fn−1 − Fn is transferred
form the buyer’s to the seller’s account.
• Thus, throughout the life of the contract, the buyer receives

T
X
(Fn − Fn−1 ) = FT − F0 .
n=1

• If an account dips below a certain pre-established level, called the maintenance level,
then a margin call is made and the owner must restore the value of the account.

Table 9.2: Example: The maintenance level is assumed to be $700. A margin call is made
on day 2, resulting in a $400 increase in the long account.
Day Futures Long Margin Short Margin
Prices Account Account
0 5500 1000 100
1 5300 800 1200
2 5100 600+400 1400
3 5200 1100 1300
4 5400 1300 1100
5 5500 1400 1000
222 Futures Prices

9.7 Futures Prices


In the futures contracts, there’s always one price linked to a contract—the delivery price.
This price is usually not the same as the spot price of the actual asset, but there’s a
connection between them. As the contract nears its maturity date, these prices get closer
and closer, finally ending up at the same value.

Futures-forward equivalence
Suppose that interest rates are known to follow expectations dynamics. Then the theoretical
futures and forward prices of corresponding contracts are identical.

Relation to Expected Spot Price


One may ask whether the current futures price for delivery at time T is a good estimate of
the future spot price, i.e., whether F = E(ST )? If either of the following conditions were
true:

(1) F < E(ST )


(2) F < E(ST )

From a speculator’s perspective, if the first condition is true, they might take a long position
in futures and then, at time T , purchase the commodity at F according to the contract
and sell the commodity at ST for an expected profit of E(ST ) − F . If the second condition
were true, the investor could carry out the reverse plan by taking a short position in futures.
Therefore, speculators are likely to respond to any such inequality.

From a hedger’s perspective, hedgers participate in futures primarily to reduce the risks
associated with commercial operations, not to speculate on commodity prices. Hence,
hedgers are unlikely to be significantly influenced by minor discrepancies between F and
E(ST ).

Normal backwardation is the term used to describe a situation where there are many more
hedgers who are short in futures than those who are long. In this scenario, to achieve market
balance, speculators must enter the market and take long positions. They will do so only if
they believe that F < E(ST ).

Contango is the term used when there are more hedgers who are long in futures than those
who are short. In this case, speculators will take the corresponding short position only if
they believe that F > E(ST ).
Chapter 10

Interest Rate Derivatives

Interest rate derivatives are financial securities whose payoffs are contingent upon fluctuations
in interest rates. They serve a crucial purpose in the world of finance for several reasons.
Firstly, given that virtually every financial transaction carries some degree of interest rate
risk, interest rate derivatives offer a vital mechanism for managing and mitigating this
risk. Secondly, these derivatives can be employed creatively to optimize and enhance the
overall performance of investment portfolios. Thus, they play a pivotal role in both risk
management and investment strategy within the financial landscape.

Learning Outcomes
By the end of this chapter, you will be able to:
• List some of the existing interest rate derivatives
• Determine the price of a zero-coupon bond.
• Use the price of zero-coupon bond to determine the implied term structure.
• Price options on Bond

10.1 Examples of Interest Rate Derivatives


(1) Bonds : Fixed-income investment securities issued by governments or corporations.
(2) Bond futures : Contracts to buy or sell bonds at a future date.
(3) Bond options : Contracts giving the right to buy or sell bonds.
(4) Bond futures options : Contracts allowing the purchase or sale of bond futures.

223
224 The Binomial Approach

(5) Embedded bond options : Bonds with built-in options for buying or selling.
(6) Mortgages : Loans for purchasing property, secured by real estate
(7) Mortgage-backed securities : Investments backed by pools of mortgages
(8) Interest rate caps and floors : Limits on interest rate fluctuations
(9) Swaps : Agreements to exchange financial instruments or cash flows.
(10) Swaptions : Options to enter into interest rate swap contracts.

10.2 The Binomial Approach


Fixed-income models are inherently more complex than security models. Need to model
evolution of entire term-structure of interest rates.

The short-rate rt , is the variable of interest in many fixed income models, including binomial
lattice models. The short rate rt is the risk-free rate that applies between periods t and
t + 1. It is a random process(stochastic process) but rt is known by time t.

We may assign probabilities to the various node transitions so that we have full probabilistic
process for the short rate. However, real probabilities for node transitions are not relevant
for the pricing theory that follows. Instead we will also assign a set of risk-neutral node
transition probabilities. Note that risk-neutral probabilities are assigned in this case rather
than derived from a replication argument. It is convenient to set them all equal to one-half.

Indexing convention for the nodes of the lattice. The lattice is drown in the right-triangle
form shown in Figure 10.1. At time t there are a total of t + 1 nodes, indexed by i form 0 to
t. The two branches leading form any node are considered to be “up” and “flat”. The index
i at time t denotes how many ups it has taken to reach the nodes.

A specific node in the lattice is indexed by the pair (t, i), with t being time and i being the
node index at that time. At node (t, i) there is specified a short rate rti ≥ 0, which is the
one-period rate at that point, see Figure 10.2.

Consider a given node (t, i) somewhere in the model of the lattice, and any interest rate
security, see, Figure 10.3. Suppose the value of this security at node (t, i) is Vti . According
to the rules of the lattice, this value is related to the value of the security at the next two
possible successor nodes according to the risk-neutral pricing formula

1
Vti = (qu Vt+1,i+1 + qd Vt+1,i ) + Dti , (10.1)
1 + rti

where Dti is the divided payment at node (t, i), qu and qd are the risk-neutral probabilities
of an up-and down-move so qu + qe = 1 and must have qd > 0 and qu > 0. As it is discussed
The Binomial Approach 225

(5, 5)

(4, 4) (5, 4)

(3, 3) (4, 3) (5, 3)

(2, 2) (3, 2) (4, 2) (5, 2)

(1, 1) (2, 1) (3, 1) (4, 1) (5, 1)

(0, 0) (1, 0) (2, 0) (3, 0) (4, 0) (5, 0)

Figure 10.1: Nodes are double indexed in the form (t, i) . The t refers to time, and i refers
to the state.

above, very common to simply set qu = qd = 12 . One can proof that arbitrage is not possible.

Zero-coupon bond(ZCB)
k
Take zero-coupon bond(ZCB) prices to be our basic securities. We will use Zti for time t,
state i price of a ZCB that matures at time k . We specify binomial model by specifying
k
all Zti ’s at all nodes. Possible but complex if we want to ensure no-arbitrage. Instead will
specify the short-rate, rti at each node Nt,i . The risk-free rate that applies to the next
period.

Implied Term Structure


Suppose that we are at the initial time, at node (0, 0). The one-period spot rate is simply
r00 , as defined at the node. To find the two-period spot rate, we consider a bond that
pays $1 at time 2. We find its value in two steps, working backwards using the risk-neutral
pricing formula. Here, let the period length be a full year. Denote the price at node (t, i) of
2
the bond that matures at year 2 by Zti . Then,
 
2 1 1 1 1
Z10 = ×1+ ×1 =
1 + r10 2 2 1 + r10
 
2 1 1 1 1
Z11 = ×1+ ×1 =
1 + r11 2 2 1 + r11
226 The Binomial Approach

r55

r44 r54

r33 r43 r53

r22 r32 r42 r52

r11 r21 r31 r41 r51

r00 r10 r20 r30 r40 r50

Figure 10.2: The short rate rti specified at each nodes (t, i).

and, next,
2 1 1 1
Z00 = [ Z 2 + Z 2 ].
1 + r00 2 10 2 11

This process can be applied to evaluate the price P00 (k) for any k. The corresponding spot
rate for period k is then the rate sk that satisfies

1 k
= Z00
(1 + sk )k

The Cash-Account
The cash-account is a particular security that in each period earns interest at the short-rate.
We use Bt to denote its value at time t and assume that B0 = 1. The cash-account is not
risk-free since Bt+s is not known at time t for any s > 1. It is locally risk-free since Bt+1 is
known at time t. Note that Bt satisfies

Bt = (1 + r0,0 )(1 + r1 ) . . . (1 + rt−1 ).

Hence,
Bt 1
= .
Bt+1 1 + rt
The Binomial Approach 227

Vt + 2, i + 2

Dt + 1, i + 1 Vt + 2, i + 1

Pti Dt + 1, i Vt + 2, i

Figure 10.3: The initial price Pti , is determined by discounted risk-neutral valuation. If all
payoffs are non-negative, then the initial price must aslo be nonnegative.

Risk-Neutral Pricing with the Cash-Account


Risk-neutral pricing for a “non-coupon” paying security takes the form

1
Vti = (qu Vt+1,i+1 + qd Vt+1,i )
1 + rti
   
Q Vt+1 Q Bt
= Et = Et Vt+1
1 + rt,i Bt+1

Therefore a non-coupon paying security, is equivalent to


 
Vt Q Vt+1
= Et . (10.2)
Bt Bt+1

By iteration,  
Vt Q Vt+s
= Et (10.3)
Bt Bt+s
for any non-coupon paying security and any s > 0.

Risk-neutral pricing for a “coupon” paying security takes the form:

1
Vti = [qu (Vt+1,i+1 + Ct+1,i+1 ) + qd (Vt+1,i + Ct+1,i )]
1 + rti
 
Q Vt+1 + Ct+1
= Et
1 + rt,i

We can rewrite as  
Vt Ct+1 Vt+1
= EtQ + (10.4)
Bt Bt+1 Bt+1
228 The Binomial Approach

More generally, we can iterate (10.4) we obtain


" t+s
#
Vt X Ci Vt+s
= EtQ + (10.5)
Bt B
i=t+1 i
B t+s

Pricing using (10.5) ensure no-arbitrage. And (10.3) is the special case of (10.5).
Example 10.1. Sample short-rate lattice. Let short-rate r grows by factor of u = 1.25 or
d = 0.9 in each period,

Listing 10.1: Python functions for computing the short rate latice
1 d e f s h o r t r a t e l a t i c e ( r00 , u , d , n ) :
2 ”””
3 A f u n c t i o n f o r c o n s t r a c t i n g the short r a t e f o r n period :
4 Inputs
5 ======
6 r00 : the i n t e r e s t r a t e at t = 0
7 u : t h e f a c t o r a t which t h e i n t e r e s t r a t e move up
8 d : t h e f a c t o r by which t h e i n t e r e s t r a t e move down
9 n : the period
10 Output :
11 l a t i c e : the binomial l a t i c e f o r the short r a t e s
12 ”””
13 l a t i c e = np . z e r o s ( ( n+1 , n+1) ) # i n i t i a l i z e a matirix
14 l a t i c e [ : ] = np . nan
15 l a t i c e [ - 1 , 0 ] = r00 # a s s i n i n g t h e s h o r t r a t e ...
a t t =0 and s t a t e 0
16 f o r j i n r a n g e ( 1 , n+1) :
17 l a t i c e [ - 1 , j ] = d∗ l a t i c e [ - 1 , j - 1 ] # c a l c u l a t i n g t h e r a t e ...
movement
18
19 f o r i i n r a n g e ( 1 , n+1) :
20 f o r j i n r a n g e ( i , n+1) :
21 l a t i c e [ - 1 - i , j ] = u∗ l a t i c e [ - i , j - 1 ]
22 r e t u r n l a t i c e . round ( 4 )

Using the following inputs and calling the function in Listing 10.1, we obtain the short rate
lattice shown in Table 10.1.

1 r00 = 0.06
2 u = 1.3
3 d = 0.9
4 k = 5
5 # short rate l a t t i c e
6 s r t s = s h o r t r a t e l a t i c e ( r00 , u , d , k )
7 s h o r t r a t e = pd . DataFrame ( s r t s , i n d e x =[k - i f o r i i n r a n g e ( k+1) ] )
8 s h o r t r a t e . r e p l a c e ( np . nan , ' ' , i n p l a c e = True )
9 short rate
Pricing Applications 229

Table 10.1: A short rate lattice


t=0 1 2 3 4 5
5 18.31
4 14.65 13.18
3 11.72 10.55 9.49
2 9.38 8.44 7.59 6.83
1 7.5 6.75 6.08 5.47 4.92
i=0 6.0 5.4 4.86 4.37 3.94 3.54

10.3 Pricing Applications

Example 10.3.1
A bond option : Consider a zero-coupon bond that has 4 years remaining to
maturity and is selling at a current price of 73.34. Suppose that we are granted a
European option to purchase this bond in 2 years at a strike price of 84.00. What is
the value of this option? Assume that the term structure is governed by the short
rate lattice in Table 10.1.

Listing 10.2: Python functions for pricing zero-coupon bond


1 d e f ZCB( s r t s , t e r m i n a l v a l u e , k , cupon = 0 ) :
2 ”””
3 A f u n c t i o n o f p r i c i n g z e r o - copon bond , and computing t h e s p o t r a t e
4 Inputs
5 ======
6 srts : t h e s h o r t r a t e l a t i c e o b t a i n e d form b i n o m i a l ...
model h a v i n g t h e same p e r i o d
7 t e r m i n a l v a l u e : the terminal value
8 k : t h e time p e r i o d
9
10 Output
11 ======
12 p r i c e : Z n j ˆk
13 zcb : t h e p r i c e o f t h e z e r o - cupon bond
14 sk : t h e s pot - r a t e
15 ”””
16 p r i c e = np . z e r o s ( ( k+1 , k+1) ) # i n i t i a l i z i n g t h e ...
matrix
17 p r i c e [ : ] = np . nan
18 p r i c e [ : , - 1 ] = ( k+1) ∗ [ t e r m i n a l v a l u e + cupon ] # s e t t i n g t h e ...
terminal vlaues at t = k
19 f o r i i n r a n g e ( k+1) :
20 f o r j i n r a n g e ( i +1 ,k+1) :
21 p r i c e [ j , - 2 - i ] = ( 1 . / ( 1 + s r t s [ j , - 2 - i ] ) ) ∗ ( 0 . 5 ∗ p r i c e [ j - 1 , ...
- 1 - i ]+ 0 . 5 ∗ p r i c e [ j , - 1 - i ] ) + cupon # c a l c u l a t i n g backward
230 Pricing Applications

22 zcb = p r i c e [ - 1 , 0 ] # t h e p r i c e o f t h e ...
z e r o - cupon bond
23 sk = ( t e r m i n a l v a l u e / zcb ) ∗ ∗ ( 1 . / k ) - 1 # t h e spo t - r a t e
24 return price , zcb , sk

Using the following inputs and calling the function in Listing 10.2, we obtain the prices of
the zero-coupon bond in Table 10.2.

1 # Example :
2 terminal value = 1
3 k = 4 # time t o m a t u r i t y
4 ( k+1) ∗ [ t e r m i n a l v a l u e ]
5 srts = s h o r t r a t e l a t i c e (0.06 , 1.25 , 0.9 , k)
6 z e r o c u p o n s , zcb , sk = ZCB( s r t s , t e r m i n a l v a l u e , k )
7 dt = pd . DataFrame ( z e r o c u p o n s , i n d e x =[k - i f o r i i n ...
r a n g e ( k+1) ] ) . round ( 4 )
8 dt . r e p l a c e ( np . nan , ' ' , i n p l a c e = True )
9 dt

Table 10.2: The valuation of a 4-year bond. The bond is valued by working backward
starting form the terminal value of 100 and discounting with the corresponding short rates.
t=0 1 2 3 4
4 100.0
3 89.51 100.0
2 83.07 92.22 100.0
1 79.26 87.35 94.27 100.0
i=0 77.22 84.43 90.64 95.81 100.0

1
1 1

In the above table, for instance, 83.07 = 1+0.0938 2 × 89.51 + 2 × 92.22 .

We can compute the term-structure by pricing ZCB’s of every maturity and then backing
out the spot-rates for those maturities. So s4 = 6.68% assuming per-period compounding,
i.e., 72.22(1 + s4 )4 = 100. Therefore one can compute Z01 , Z02 , Z03 and Z04 and then compute
s1 .s2 , s3 and s4 to obtain the term-structure of interest rates at time t = 0

At time t, we will compute new ZCB prices and obtain a new term-structure model for the
short-rate, rt , therefore define a model for the term-structure! Consider the following set of
maturities 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50. The following code computes the spot rates
for these maturities. The resulting term-structure is indicated in Figure 10.4.

1 Ts = [ 1 , 5 , 1 0 , 1 5 , 2 0 , 2 5 , 3 0 , 3 5 , 4 0 , 4 5 , 5 0 ]
2 s k s = [ ] # empity l i s t t o s t o r e t h e s p o t r a t e s
3 f o r k i n Ts :
Pricing Applications 231

4 srts = s h o r t r a t e l a t i c e (0.06 , 1.25 , 0.9 , k)


5 z e r o c u p o n s , zcb , sk = ZCB( s r t s , t e r m i n a l v a l u e , k )
6 s k s . append ( sk )

0.13
0.12
0.11
The spot-rates

0.10
0.09
0.08
0.07
0.06
0 10 20 30 40 50
Time to Maturity

Figure 10.4: The term structure

Bond Derivatives
To calculate the value of a derivative of a bond, we proceed in two steps:

(1) calculate the price lattice of the bond itself, then


(2) calculate the value of the derivative.

Example 10.3.2
Pricing a European Call Option on the ZCB :
Strike = $84
Option Expiration at t = 2
Option Payoff = max(0, Z24 − 84)
Underlying ZCB Matures at t = 4
0 1 2

2 0.00
1 1.56 3.35
0 2.97 4.74 6.64
For instance:
1 1 1
4.74 = [ × 3.35 + × 6.64]
1 + 0.054 2 2
232 Models of Interest Rate Dynamics

Example 10.3.3

American Put Option on the ZCB: Strike = $88


Option Expiration at t = 3
Option Payoff = max(0, 88 − Z34 )
Underlying ZCB Matures at t = 4
0 1 2 3

3 0.0
2 4.93 0.0
1 8.74 0.65 0.0
0 10.78 3.57 0.00 0.0
For instance :
  
1 1 1
4.92 = max 88 − 83.08, ×0+ ×0
1 + 0.0983 2 2
  
1 1 1
8.73 = max 88 − 79.27, × 4.92 + × 0.65
1 + 0.075 2 2
Turn’s out it’s optimal early-exercise everywhere. Not a very realistic example.

10.4 Models of Interest Rate Dynamics


Alternatively, we can specify the short rate as a process defined by an Ito equation, similar
to the processes used to define stock behavior.

dr = µ(r, t)dt + σ(r, t)dW (10.6)

were W (t) is a standardized Wiener process in the risk-neutral world. Given an initial
condition r(0), the equation defines a stochastic process r(t).

(1) Rendleman and Bartter model

dr = mrdt + σrdW

This model copies the standard geometric Brownian motion model used for stock
dynamics. It leads to lognormal distributions of future short rates. It is now, however,
rarely advocated as a realistic model of the short rate process.
(2) Ho-Lee model
dr = θ(t)dt + σdW.
Models of Interest Rate Dynamics 233

This is the continuous time limit of the Ho-Lee model. The function θ(t) is chosen so
that the resulting forward rate curve matches the current term structure. A potential
difficulty with the model is that r(t) may be negative for some t.
(3) Black-Derman-Toy model

d ln r = θ(t)dt + σdW.

Using Ito’s lemma, it can be transformed to the equivalent form

1
dr = [θ(t) + σ 2 ]rdt + σrdW.
2

(4) Vasicek model


dr = a(b − r)dt + σdW.

(5) Cox, Ingersoll, and Ross model



dr = a(b − r)dt + c rdW

(6) Hull and White model

dr = [θ(t) − ar]dt + σdW.

(7) Black and Karasinski model

d ln r = (θ − a ln r)dt + σdW.

All of these models are referred to as single-factor models because they each depend on a
single Wiener process W . There are other models that are multifactor, which depend on
two or more underlying Wiener processes.
234 Models of Interest Rate Dynamics
Bibliography

Beder, T. S. and Marshall, C. M. (2011). Financial engineering: the evolution of a profession,


volume 2. John Wiley & Sons.

Boudreault, M. and Renaud, J.-F. (2019). Actuarial finance: Derivatives, quantitative


Models and risk management. John Wiley & Sons.

Choe, G. H. et al. (2016). Stochastic analysis for finance with simulations. Springer.

Cox, J. C., Ross, S. A., and Rubinstein, M. (1979). Option pricing: A simplified approach.
Journal of Financial Economics, 7(3):229–263.

Hilpisch, Y. (2014). Python for Finance: Analyze big financial data. ” O’Reilly Media, Inc.”.

Hilpisch, Y. (2018). Python for finance: mastering data-driven finance. O’Reilly Media.

Hull, J. C. (2021). Options futures and other derivatives. Pearson Education India.

Lewinson, E. (2020). Python for Finance Cookbook: Over 50 recipes for applying modern
Python libraries to financial data analysis. Packt Publishing Ltd.

235

You might also like