Note (1)
Note (1)
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
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
iii
iv CONTENTS
Introduction
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.
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.
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.
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.
[1]: 100
[2]: 200
[3]: 0
[4]: 10000
[5]: 1.0
[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]: 8
[10]: 2.0
[*********************100%***********************] 1 of 1 completed
[14]: bitcoin.tail()
[15]: bitcoin.tail()
2
8 Getting Started with Python
[16]: type(bitcoin)
[16]: pandas.core.frame.DataFrame
[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
[21]: Date
2022-01-01 218.373104
Name: Close, dtype: float64
[23]: list1
[23]: [1, 2, 3]
[25]: list2
[*********************100%***********************] 1 of 1 completed
[*********************100%***********************] 1 of 1 completed
[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]: 3
[31]: len(list4)
[31]: 2
[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:]
[36]: list4
[36]: [Date
2023-01-31 4076.600098
Name: Close, dtype: float64,
Date
2023-01-31 34086.039062
Name: Close, dtype: float64]
[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
[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
[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
[46]: matrix
[47]: matrix[0]
[47]: [1, 2, 3]
[48]: matrix[0][0]
[48]: 1
[50]: dict1['a']
[50]: 1
[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]: 39
[56]: dict2
[58]: d
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()
8
14 Getting Started with Python
[63]: Data_Frame
[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]: 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)
[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
10
16 Getting Started with Python
11
Getting Started with Python 17
12
18 Getting Started with Python
[74]: 72243.80990600586
[75]: 266.5823243764054
[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
13
Getting Started with Python 19
[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]: False
[85]: True
It is correct
[87]: a = False
if a:
print('a is correct')
else:
print('anything but correct')
[88]: a = True
if a:
print('a is correct')
else:
print('anything but correct')
a is correct
[90]: for x in m:
print(x)
1
2
15
Getting Started with Python 21
3
5
6
k1
k2
k3
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)
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
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)
[97]: #
list = [x**2 for x in range(0, 11)]
print(list)
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)
[3]: wb
[5]: # we now have one worksheet object, which has index number 0
wb.get_active_sheet()
[5]: 0
[7]: ws_1
[10]: # both worksheet objects are still empty. Let us generate a NumPy ndarray object␣
,→containing some numbers:
[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])
18
24 Getting Started with Python
[14]: data.shape
[14]: (8, 8)
[107]: # Using the write method and providing row and column information (with␣
,→zero-based indexing),
#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]):
[ ]: wb = xlsxwriter.Workbook('workbook.xlsx')
[ ]: ws_1 = wb.add_worksheet('first_sheet')
ws_2 = wb.add_worksheet('second_sheet')
[113]: ll workbook.xlsx
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]: 0
[119]: 0
[120]: wb.close()
20
26 Getting Started with Python
[122]: book
[125]: sheet_2.name
21
Getting Started with Python 27
[125]: 'second_sheet'
[126]: (8, 8)
[128]: cl.value
[128]: 1.0
[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]
[ ]: 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()
[138]: wb.save('oxl_book.xlsx')
[140]: # single cells are easily accessed via their cell names:
ws = wb.active
[141]: 2
[142]: cell.row
[142]: 4
[143]: cell.value
[143]: 12
23
Getting Started with Python 29
9
10
11
12
24
30 Getting Started with Python
For more reading please refer (Hilpisch, 2014, 2018; Lewinson, 2020).
Chapter 2
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.
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
6
y
0
−10.0 −7.5 −5.0 −2.5 0.0 2.5 5.0 7.5 10.0
x
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
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.
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
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:
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
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 Ω:
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
(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:
(2) Should events A and B be distinct and non-overlapping, this principle simplifies:
P (A ∪ B) = P (A) + P (B).
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
where Z ∞
fX (x) ≥ 0 for every x ∈ R and fX (y)dy = 1.
−∞
Review of Basic Probability 39
∞
X
µX = EX = xk pk .
k=1
∞
X
Eg(X) = g(xk )pk .
k=1
40 Review of Basic Probability
n
where k represents the binomial coefficient, which is the number of ways to choose
k successes from n trials.
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
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.
e−λ λk
P (X = k) = , k = 0, 1, 2, . . . ,
k!
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
0.20
Probability 0.15
0.10
0.05
0.00
0 2 4 6 8 10 12 14
Number of Events
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.
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
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
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 } ' )
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.
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.
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
• 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
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
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 ).
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
2
E[X] = E[eY ] = MY (1) = eµ+σ /2
and
2
E[X 2 ] = E[e2Y ] = MY (2) = e2µ+2σ
Finally,
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.
Stop-loss transforms
Recall the definition of the stop-loss function (x − a)+ . Using its properties, we can write
µX = EX = (EX1 , . . . , EXn ).
ΣX = (cov(Xi , Xj ) : i, j = 1, . . . , n),
50 Review of Basic Probability
where
2
is the covariance of Xi and Xj . Notice that cov(Xi , Xi ) = σX i
.
cov(X1 , X2 )
corr(X1 , X2 ) =
σX1 σX2
E[(X1 − µX1 )(X2 − µX2 )]
=
σX1 σ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 }),
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 ,
−∞ −∞
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.
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.
P (A ∩ B)
P (A|B) = .
P (B)
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)
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
EX = E[E(X|Y )]
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
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.
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.
{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.
• 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.
(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
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.
1
P (ϵi = 1) = P (ϵi = −1) = , i = 1, 2, . . .
2
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,
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,
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
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,
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
where ,
E[Wt ] = µW = 0, and V ar(Wt ) = E[(Wt )2 ] = t.
can be simplified to
Cov(Ws , Wt ) = E[Ws Wt ]
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
Markovian property
(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 ],
Martingale property
E[WT |Ws , 0 ≤ s ≤ t] = Wt .
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
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
Xt ∼ N(X0 + µt, σ 2 t)
Stochastic Processes 61
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 .
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.
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
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
ST S0 exp(µt + σWT )
=
St S0 exp(µt + σWt )
= exp(µ(T − t) + σ(WT − Wt ))
= exp(XT − Xt ).
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
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()
[3]: 0.0
[4]: 1.0
[5]: 1.0
[6]: 0.3989422804014327
[7]: 0.5
1
Python Implementation 65
[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
2
66 Python Implementation
plt.show()
[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
4
68 Python Implementation
[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()
[20]: apl.tail()
Volume
Date
2023-03-27 52390300
2023-03-28 45992200
2023-03-29 51305700
2023-03-30 49501700
2023-03-31 68749800
5
Python Implementation 69
[22]: 73.35910640745954
[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
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]: 0.0010942281372229837
7
Python Implementation 71
[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
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:
[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
[35]: df.tail()
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
[5 rows x 24 columns]
[36]: df["Close"].tail()
Mean Vectors
[38]: X = df['Adj Close'].dropna()
X.mean()
11
Python Implementation 75
covXY
ρXY =
σX σY
[39]: X.cov()
[40]: X.corr()
12
76 Python Implementation
[45]: # skewness
returns_skew = returns.skew()
returns_skew
[46]: # Kurtosis
returns_kurtosis = returns.kurtosis()
returns_kurtosis
13
Python Implementation 77
MSFT 1.290831
dtype: float64
14
78 Python Implementation
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
[53]: B[0,:] = 0
B
16
80 Python Implementation
17
Python Implementation 81
Problems 2.1
(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
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.
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.
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.
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
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∆
ensure equivalence in the final portfolio value for both alternatives. Therefore, the portfolio
becomes riskless under the conditions:
22∆ − 1 = 18∆
or
∆ = 0.25.
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
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 .
S0 u∆ − fu = S0 d∆ − fd .
S0 u∆ − fu .
(S0 u∆ − fu )e−rT .
S0 ∆ − f.
Risk-Neutral Valuation 89
f = S0 ∆ − (S0 u∆ − fu )e−rT .
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.
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
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 ,
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
or
E(ST ) = pS0 (u − d) + S0 d
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
24.2
D
22
B
19.8
20 A E
18
C
16.2
F
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).
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
• 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”.
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
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.
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.
leading to
e(r−q)∆t − d
p= .
u−d
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:
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 }.
St1
2
St
.. ,
St =
.
StN
the entry Dij represents the value (including dividend payments) of the ith asset the j th
state at time T .
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 .
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
S 0 = Dψ. (3.14)
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
Theorem 3.2. The market is complete if and only if the rank of the matrix D of securities
is equal to M .
Proof.
M
X 1
ψj = .
j=1
1+r
1 = ψ1 (1 + r) + · · · + ψM (1 + r)
M M
X X 1
1 = (1 + r) ψj =⇒ ψj =
j=1 j=1
1+r
ψ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
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
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.
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)
1+r−d u − (1 + r)
p∗u = and p∗u = .
u−d u−d
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
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
At the end of 1 year the variable will have a normal probability distribution with mean 40
and standard deviation 1.
What is the probability distribution of the stock price at the end of 2 years?
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.
1
• 2 years or 6 months is ϕ(0, 0.5).
1
• 4 years is ϕ(0, 0.25),
• ∆t years is ϕ(0, ∆t).
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
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
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,
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
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
10.5
10.4
10.3
X
10.2
10.1
10.0
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
where a(·) and b(·) are deterministic functions and where X0 = x0 ∈ R initial value of the
processes X.
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
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
∂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
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,
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ε.
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
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
115
110
105
100
S(t)
95
90
85
80
Figure 4.3: One possible the price movement for S0 = 100, µ = 0.15, σ = 0.3, T = 1
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,
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 ” )
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
∂G 1 ∂ 2 G 2 2
∂G ∂G
dG = µS + + σ S dt + σSdW (4.13)
∂S ∂t 2 ∂S 2 ∂S
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
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 µ.
Since
∂G 1 ∂2G 1 ∂G
= , = − 2, =0
∂S S ∂S 2 S ∂t
Python Implementations 119
σ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)
[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]
1
Python Implementations 121
[8]: T = 1
# we will do the simulation for different N's
N1 = 21
N2 = 101
N3 = 365
2
122 Python Implementations
3
Python Implementations 123
[12]: # Example
T = 1
N = 252
a = 0.3
b = 0.2
x0 = 10
[13]: plt.plot(t, x)
plt.xlabel('t')
plt.ylabel('x');
4
124 Python Implementations
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)
112.41
6
126 Python Implementations
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
∆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
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%
σ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
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
given by
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
ST = S0 exT
1 ST
x= ln (5.6)
T S0
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.
1 ST
x= ln .
T S0
σ2
and, as indicated in equation (5.7), the expected value E(x) = µ − 2 .
E(ST ) = S0 eµ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 )
• 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?
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
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
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:
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
−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
∂f
∆Π = −∆f + ∆S (5.13)
∂S
1 ∂2f 2 2
∂f
∆Π = − − σ S ∆t (5.14)
∂t 2 ∂S 2
∆Π = 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
f = max(S − K, 0) when t = T
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)
∂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
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
QS
f=
H
(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
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
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
Solutions of the differential equation (5.16) are Black-Scholes-Merton formulas for the prices
of European call and put options:
where,
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.
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
The differential equation (5.16) gives the call and put prices at a general time t.
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
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.
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
where
It is not possible to invert this equation. However, an iterative search procedure can
be used to find the implied σ.
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.
(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:
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
Since,
S0 e−qT S0
ln = ln − qT,
K K
it follows that d1 and d2 are given by
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
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:
where
Both the domestic interest rate, r, and the foreign interest rate, rf , are the rate for a
maturity T
F0 = S0 e(r−rf )T
American Options 143
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.
[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
[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
it = (1 + rt )it−1
[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]: 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
3
Python Implementations 147
[8]: sp_returns.describe()
[9]: sp_returns.skew()
[9]: 0.015388815608160697
[10]: sp_returns.kurtosis()
[10]: 0.42285809997837287
# plot
4
148 Python Implementations
[12]: log_returns.describe()
[13]: log_returns.skew()
[13]: -0.03826067014680983
[14]: log_returns.kurtosis()
[14]: 0.4064839959609401
5
Python Implementations 149
[15]: 0.2374705117331707
[17]: len(train)
[17]: 251
[18]: len(test)
[18]: 20
[19]: len(sp_returns)
[19]: 271
6
150 Python Implementations
[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"]
7
Python Implementations 151
[26]: 21.79260421286685
[28]: 22.413952824809225
[ ]:
8
152 Python Implementations
Chapter 6
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,
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 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.
Stop-Loss Strategy
This involves:
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).
50.2
50.0
49.8
49.6
49.4
49.2
49.0
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
Option price
Stock price
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.
∆(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).
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%)
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
2π
is the probability density function for a standard normal distribution.
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.
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.
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)
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%).
∂Π ∂Π 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.
∂C ∂P
= N (d1 ), and = N (d1 ) − 1,
∂S ∂S
respectively.
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
we directly obtain,
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
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:
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)
θ(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)
θ(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
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:
T
Assuming a time grid with ti = i m , the following recursive formula for the m time steps is
obtained.
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:
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
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)
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)
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
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
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.
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.
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 .
At t = 2∆t, there are three possible asset price, S0 u2 , S0 , and S0 d2 ; and so on.
S0 uj di−j , j = 0, 1, . . . , i
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
Example 7.1.1
European
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
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.
Table 7.1: The possible price dynamics and the European call prices
American
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
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
The calculation for American call option prices are indicated in Table 7.3.
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
Calculation of Gamma:
Gamma is calculated from the nodes at time 2∆t
∆1 − ∆2
Gamma =
11.65
Calculation of Theta:
3.77 − 4.49
Theta = = −4.3 per year
0.1667
Calculation of Vega:
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)
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
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 .
• 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.
ε1 = x1
p
ε2 = ρx1 + x2 1 − ρ2
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
ε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.
• 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
Example 7.2.1
The following Python function in Listing 7.3 is for computing the European option using
the Black-Scholes analytic formula.
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.
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
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
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
∂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.
2ΔS
ΔS
0 Δt 2Δt
Time, t
∂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
∂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
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 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
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
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
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
The Listing in 7.6 is a function for the implementation of American put option using the
implicit finite difference method
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
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
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.
(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
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.
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,
and
pBS + S0 e−qT = cBS + Ke−rT
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
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
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.
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−β .
The valuation formulas for European call and put options under the CEV model are
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
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.
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.
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
dσ
= 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−ρ
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
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 .
Interest rates are typically quoted on annual basis, even if the compounding period is less
than 1 year.
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
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
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
FV
PV = .
(1 + r)n
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
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.
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 .
(1 + i − if )−1 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
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.
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
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:
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 .
1 − (1 + i)n−N
An = A0 (9.6)
1 − (1 + i)−N
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
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.
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:
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
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
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.
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.
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
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
Spot rates can, in theory, be measured by recording the yields of zero-coupon bonds.
Discount factors dt are factors by which future cash flows must be multiplied to obtain an
equivalent present value.
1
dk = .
(1 + sk )k
1
dk = .
(1 + sk /m)mk
Term structure of interest rates 213
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.
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
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 .
t−1
Y t−1
Y
(1 + st )t = (1 + fk,k+1 ) = (1 + rk ).
k=0 k=0
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.
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
Price of contract that pays rk−1 F at time k. Construct a portfolio that has a deterministic
cash flow.
Table 9.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)
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
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.
Set the forward price F for a forward contract at time t = 0 for 1 unit of an asset with
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
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
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
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
• 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
• 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,
N × (S1 − X, S2 − X, . . . , SM − X)
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.
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
(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
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.
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 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
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.
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)
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.
r55
r44 r54
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
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.
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
By iteration,
Vt Q Vt+s
= Et (10.3)
Bt Bt+s
for any non-coupon paying security and any s > 0.
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
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
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.
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
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
Bond Derivatives
To calculate the value of a derivative of a bond, we proceed in two steps:
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
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.
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).
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.
1
dr = [θ(t) + σ 2 ]rdt + σrdW.
2
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
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