All language subtitles for 10. Price Simulations in Code

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt-PT Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:11,100 --> 00:00:16,620 OK, so in this lecture, you're going to look at a simple example of how to simulate stock prices, 2 00:00:16,890 --> 00:00:19,920 assuming that the log returns come from a normal distribution. 3 00:00:20,520 --> 00:00:24,800 Now, this might seem at first to be a strange exercise, but it should get you thinking. 4 00:00:25,320 --> 00:00:30,950 We'll see how totally unpredictable randomness can lead to something that looks very much like a stock 5 00:00:30,960 --> 00:00:32,010 race time series. 6 00:00:32,790 --> 00:00:38,910 In fact, this exact method can be used for doing Montecarlo simulations and evaluating the Black-Scholes 7 00:00:38,910 --> 00:00:39,480 formula. 8 00:00:40,320 --> 00:00:45,500 Furthermore, it is also useful for when we want to analyze certain rules of thumb for Arima. 9 00:00:45,960 --> 00:00:50,550 This may not make too much sense right now, but you'll see how this kind of approach can help to validate 10 00:00:50,550 --> 00:00:53,880 some of the rules that we use for a rhema model selection. 11 00:00:55,950 --> 00:00:58,920 OK, so let's start by importing nonpaying matplotlib. 12 00:01:05,550 --> 00:01:10,740 The next step is to set a few constants will be using, such as the number of time steps, the initial 13 00:01:10,740 --> 00:01:12,360 price and the drift term. 14 00:01:17,460 --> 00:01:22,800 The next step is to run our simulation, so we'll start by taking the log of the price and setting it 15 00:01:22,800 --> 00:01:29,160 to last P last P is a variable will continue to update throughout the loop, since the current price 16 00:01:29,160 --> 00:01:31,160 will always depend on the last price. 17 00:01:34,110 --> 00:01:39,450 The next step is to create two arrays, to store log returns and our prices, and of course, these 18 00:01:39,450 --> 00:01:40,860 should both have length T. 19 00:01:43,100 --> 00:01:47,870 The next step is to enter a loop that goes 40 iterations inside the loop. 20 00:01:47,900 --> 00:01:53,810 We'll start by sampling a random log return from a zero mean normal distribution with standard deviation 21 00:01:53,810 --> 00:01:54,980 zero point zero one. 22 00:01:57,600 --> 00:02:00,160 The next step is to compute our new log price. 23 00:02:00,510 --> 00:02:04,980 This is equal to the old log price, plus the drifter, plus the random noise. 24 00:02:08,140 --> 00:02:13,510 The next step is to store the log return and the new price note that we don't actually make use of the 25 00:02:13,510 --> 00:02:18,550 log returns, but you may find them to be useful in later code for the price. 26 00:02:18,580 --> 00:02:23,770 Note that we have to take the exponential since we want to plot the price and not the log price. 27 00:02:26,710 --> 00:02:32,770 The final step in this loop is to assign P to last P so that last P has the correct value in the next 28 00:02:32,770 --> 00:02:33,460 iteration. 29 00:02:38,970 --> 00:02:43,410 OK, and so in the next block, we are going to plot our simulated time series. 30 00:02:49,180 --> 00:02:55,020 So as you can see, this certainly looks like a plausible stock price evolution in the coming lectures, 31 00:02:55,030 --> 00:02:57,430 you learn about the why behind what we just did. 32 00:02:57,580 --> 00:03:01,090 And hopefully this will give you some insight behind this exercise. 3503

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.