Professional Documents
Culture Documents
A Stochastic Model To Study The Dynamics of Stock Prices in The Nairobi Securities Exchange For Forecasting
A Stochastic Model To Study The Dynamics of Stock Prices in The Nairobi Securities Exchange For Forecasting
A Stochastic Model To Study The Dynamics of Stock Prices in The Nairobi Securities Exchange For Forecasting
BY: S U P E RV I S O R :
K E V I N G A C H AT H I K I B U G I D R . J O H N AW I N O.
SMPQ /00425/2016
INTRODUCTION
A stock market is a legal establishment surrounding the trade of securities of
companies and organizations.
It has become an essential market playing vital roles in economic prosperity by
fostering capital formation and sustaining economic growth in most economies,
when a stock market is on the rise, the economy is considered to be up and
coming.
Typically, stock market prices are the performance indicators of the entire
market and enables investors to get an idea about the performance of the entire
market
Research has also been done in other markets where stock prices prediction was
attempted:
Aghababaeyan et al (2011) undertook study on stock market prediction for
the Tehran Stock Exchange, where they developed a tool that was used for
prediction in the market, achieving an accuracy of 97%.
Khan et al (2011) conducted a study on the Bangladesh Stock market where
they developed a tool with average error of 3.7% and 1.5% on two
simulations.
None of these tools were developed commercially or targeted for the
respective stockbrokers.
In this project, a stochastic model to simulate a portfolio that consists of three stock
prices in the Nairobi Securities Exchange, in which their historical prices are collected
and used as building blocks in the formation of Stochastic Differential Equations for the
model.
Problem Statement.
Trading in shares is a big business in many economies.
The current methods are somehow subjective and are limited to crunch numbers.
Individual investors who are looking forward to invest in the stock market rely on
experience or fundamental analysis (buy and hold) in picking out stocks.
Improper investments could easily mean great losses to investors, especially if
wrong decisions are repeated.
Therefore, it is important to develop a model to help in minimizing losses and
making any investment decisions.
The stochastic model predicts on whether what investors plan to invest in shall
appreciate in value or not thus the investor after observing the trend over a longer
period of time can invest in the stock that will yield the best returns.
Study Objectives.
To develop a model that can be used by stockbrokers for forecasting prices of the
selected stocks in the NSE.
To investigate the financial market prediction for the Kenyan market, by comparison
with actual prices after a short period of time.
Trading of stocks is purely based on supply and demand, with willing buyers and
willing sellers.
No event such as a financial crisis will happen in the foreseeable future which will
affect the stock market negatively.
Significance of the Study.
The purpose of this study is to come up with better ways of investing stocks which
involve analysis in order to mitigate risk.
The Geometric Brownian Motion (GBM) model incorporates the idea of random
walks in stock prices through its uncertain component, along with the idea that stocks
maintain price trends over time as the certain component (Reddy et al, 2016).
METHODOLOGY.
In order to develop a stochastic model that captures the changes in the prices
of stocks, this approach involves:
This involves studying the dynamics of a system of interest for a short time
interval ∆t .
In which the information obtained from the short time study of the
dynamics of the system is used to formulate the mathematical model of
the system.
Consider three selected stocks S1, S2 and S3 subjected to random changes by
market forces.
We assume that in a small interval of time ∆t, a stock price may change by
losing one unit (-1), remaining stable (0) or gaining one unit (+1).
Thereare possibilities by which the stocks may vary in the small time interval.
These possibilities are indicated in table 3.1.
Where; μ(t, S1,S2,S3) is the expectation vector and σ(t, S1,S2,S3) is the standard
deviation.
Stock prices are published daily.
The daily stock prices of three selected stocks namely KCB, SCOM and KQ were
observed for 30 days in the month of September and October 2019 (Table 3.2).
The stock prices were used to characterize the drift and volatility which will form the
coefficients of the stochastic differential equations.
From table 3.2 above, instances of loss, gain or unchanged are noted as shown in the
table 3.3
The column named summary shows how the stock prices of each price vary relating
to the day before.
From the table above, the probability of each event was determined by:
Pi =
Table 3.4 shows patterns of change and their probabilities as calculated by formula
above.
From table 3.4 above, the relevant variables of the drift and volatility are computed.
Thus we obtain the SDE;
dS(t)=μ(t, S1,S2,S3)dt + σ(t, S1,S2,S3)dW(t)
dS(t)=
This is an initial value problem.
RESULTS AND DISCUSSION.
Results.
The SDE obtained was solved using the multi-dimensional Euler-Maruyama
scheme for SDE’s and was achieved through a MATLAB script file.
The following graphs represent simulations on the three stocks shown from the
MATLAB script files.
Fig 4.1:
Fig 4.2:
Fig 4.3:
Discussions.
Figure 4.1 shows fluctuations of stock 1(KCB) prices over the period of time. There is a
significant decrease in value of the stock at the middle of the time according to the
simulation which goes below the initial asset’s price. However, by the end of the year
the stock price increase significantly
Figure 4.2 shows the changes of stock 2(SCOM) prices over a year period. The stock
prices rise high before the middle of the year and drop down significantly to almost
its initial price by mid-year. The stock however increases in prices significantly by the
end of the year
Figure 4.3 shows stock 3 (KQ) prices fluctuations. The prices of this stock are not a
good investment as they reduce with respect to time. They only rise for a short
period of time which is insignificant in investment.
SUMMARY AND CONCLUSION
SUMMARY
A stochastic model is developed for the dynamics of change in prices of selected stocks.
Considering the three stocks subjected to random influence by the market forces, the
assumption is that in a small time interval ∆t, a stock price may change by losing one unit (-1),
remaining stable (0) or gaining one unit (+1).
Checking the probabilities of the gains and losses, the expectation vector and the covariance
matrix are derived, resulting in a Stochastic Differential Equation.
Due to the difficulty in solving most non-linear Stochastic Differential Equations (SDE’s)
analytically, the Euler Maruyama Method for SDEs is used to solve and analyze the model with
the aid of MATLAB software.
CONCLUSION.
Investors willing to invest in either the three stocks should only invest in stock 1 and
stock 2 according to the simulations of the Stochastic Differential Equations.
The investor after observing the trend over longer period can invest in the stock
that will yield the best returns.