This is a two-part blog where we’ll explore how Ito’s Lemma extends traditional calculus to model the randomness in financial markets. Using real-world examples and Python code, we’ll break down concepts like drift, volatility, and geometric Brownian motion, showing how they help us understand and model financial data, and we’ll also have a sneak peek into how to use the same for trading in the markets.
In the first part, we’ll see how classical calculus cannot be used for modeling stock prices, and in the second part, we’ll have an intuition of Ito’s lemma and see how it can be used in the financial markets.
If you are already conversant with the chain rule in calculus, the concepts of deterministic and stochastic processes, drift and volatility components in asset prices, and Wiener processes, you can skip this blog and directly read this one: Ito’s Lemma Applied to Stock Trading
It has an involved discussion on Ito’s lemma, and how it is harnessed for trading in the financial markets.
This blog covers:
- Pre-requisites
- Etymology of Sorts
- The Chain Rule
- Deterministic and Stochastic Processes
- Drift and Volatility Components on Python
- Weiner Weiner Stochastic Dinner
Pre-requisites
You will be able to follow the article smoothly if you have elementary-level proficiency in:
- Calculus
- Python coding
Etymology of Sorts
You would have learned theorems in high school math. Simply put, a lemma is like a milestone in attempting to prove a theorem. So what is Ito’s lemma? Kiyoshi Ito came up with his own ways of calculus (as if the existing ones weren’t hard to learn already) Why did he do that? Were there any problems with the existing methods? Let’s understand this with an example.
The Chain Rule
Suppose we have the following function:
This function can also be written as:
Here, y is a function of z, which itself is a function of x. Such functions are known as composite functions.
This means that whatever value x takes, z would take thrice its value, and whatever value z takes, y would take its corresponding sine value.
Suppose x doubles, what would happen to z? It would also double. And when x halves, z would also halve. Thus, z would always bear the same ratio with x, i.e., 3. The ratio between the change in z, and the change in x would also be 3. We refer to this as the derivative of z with respect to x, also denoted by: dz/dx.
From elementary calculus, you would know that dz/dx = 3.
Similarly, dy/dz = cos(x), that is, the tangent to the slope of the sinusoidal curve sin(x) at every point on the curve would be cos(x).
What about dy/dx?
We can solve this using the chain rule, shown below:
Substituting the above values for dy/dz and dz/dx,
Straightforward, isn’t it?
Sure, but only when we deal with ‘functions’. The problem is, when it comes to finance, we deal with processes. What kind of processes? Well, we can have deterministic processes and stochastic processes.
Deterministic and Stochastic Processes
A deterministic process is one whose realized path, and value after certain intervals of time is known beforehand with certainty. Examples would be the returns on a fixed deposit or the payouts of an annuity.
What about a stochastic process then? Can you think of something whose value can never be predicted with certainty, even for the next second? The path traversed by a stock! Can you imagine a world where the stock prices follow a deterministic path? No, right? But hey, we’ll discuss this too in a while now!
Coming back, in financial literature, stock prices are assumed to follow a Geometric Brownian motion. What’s that? Keep reading!
Suppose you ignite an incense stick. What variables contribute to the path that a single particle of fumes from the stick would follow? The wind speed in the surroundings, the direction of the wind, the density of the surrounding air, the absolute and relative proportion of other particles already present in the air, the size of the particles of the incense stick, the gap between each particle, the molecular orientation of the particles, their inflammability, and so on.
Even if you can create an elegant model that factors in the effect of all these variables, would you be able to predict with certainty the exact path that a single fume particle would traverse? No! Same is the case with asset prices. Suppose you know the fundamentals of the underlying, values of all technical indicators, the drift (we’ll come to this in a while), the volatility, the risk-free rate, macro-economic metrics, market sentiments, and everything else. Can you predict the exact path the price will take tomorrow?
If yes, well, you don’t need to read any further. Keep your secrets and make a ton of money. Realistically, we cannot predict it with certainty. Stock returns follow a path similar to the incense stick fumes. We call it “Brownian motion” or “Wiener process”.
How do we characterise them?
Firstly, the value of the random variable at time t = 0, is 0.
Secondly, the value of the random variable at one time instant would be independent of its value in any previous time instant.
Thirdly, the random variable would have a normal distribution.
Finally, the random variable would follow a continuous path, not a discrete one.
Now, stock prices don’t have values = 0, at time t =0 (when they get listed). Stock prices are also known to have autocorrelations; i.e., the price at any given instant depends on one or more of the prices in previous instances. Stock prices also don’t follow a normal distribution. Still, how can it be that they follow a Brownian motion?
There’s a minor tweak that we need to do here. We shall use the daily returns of the adjusted close prices as a proxy for the increments in the stock prices. And since the price returns follow a Brownian motion, the prices themselves follow what is known as a geometric Brownian motion (GBM).
Let’s explore the GBM further using math notation. Suppose we have a stochastic process S. We say that it follows a GBM if it can be written in the following form:
Let’s treat S as the stock price here.
dSt simply refers to the change in the stock price over time t. Suppose the current price is $200, and it becomes $203 the next day. In this case, dSt = $3, and t = 1 day.
The Greek alphabet μ (written as mu, and pronounced as ‘mew’) represents the drift. Let’s take the Microsoft stock to understand this.
Stay tuned for the next installment to learn about drift and volatility components on Python.
Originally posted on QuantInsti blog.
Disclosure: Interactive Brokers
Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.
This material is from QuantInsti and is being posted with its permission. The views expressed in this material are solely those of the author and/or QuantInsti and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.