Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code the following in Python 2.x A simple model for daily stock prices is based on multiplicative random walks. The idea is simple, but provides

Code the following in Python 2.x A simple model for daily stock prices is based on multiplicative random walks. The idea is simple, but provides a reasonably realistic result. Assume that daily stock returns are randomly distributed, and further assume that they follow a normal (aka. Gaus- sian) distribution. Then, we could simulate the price xt of a given stock on day t (t = 0, 1, 2, . . .) with the following random walk: xt+1 = xt (1 + rt) where rt N(0, ) is a normal random variable, with zero mean and variance . Write a program that accepts three command-line arguments: the initial price x0 (float), the number of days N (integer), and the variance (float). It should then simulate the above multiplicative random walk, printing out the values of x0, x1, x2, . . . , xN one per line of output (i.e., your output should have N + 1 lines). You should use the random.normalvariate() library function to generate numbers following a normal distribution with the desired parameters.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students also viewed these Databases questions

Question

=+ What is the role of government in bargaining?

Answered: 1 week ago

Question

=+ Who is the negotiation partner at company level?

Answered: 1 week ago