字幕表 動画を再生する 英語字幕をプリント we are almost there. All we have to do in this lesson is create a price list. Each price must equal the product of the price observed the previous day and the simulated daily return. Therefore, once we obtain the price and day T, we can estimate the expected stock price we will have in day T plus one. Then this process will be repeated 1000 times and we will obtain a prediction of a company's stock price 1000 days from now. This sounds awesome, but where can we start? We already created in matrix containing daily returns. Right? So the daily returns variable is available, However, which will be the first price in our list. 01 million. Of course not to make credible predictions about the future, the first stock price in our list must be the last one in our data set. It is the current market price. Let's call this variable s zero as it contains the stock price today at the starting point time zero. With the help of the eye look method and the index operator, we can indicate we need the last value from the table by typing minus one within the brackets. Perfect. This is the first stock price in our list. Let's proceed with filling in the list. How big should it be? As big as the daily returns array. Right. This is why the price list matrix could be, at most as biggest, the daily returns matrix. And as we all hoped, numb pie has a method that can create an array with the same dimensions as an array that exists and that we have specified. This method is called zeros like. As an argument answered the daily returns array, we will obtain an array of 1000 by 10 elements just like the dimension of daily returns, and then fill it with zeros. So why did we create this object? Well, now we can replace the zeros with the expected stock prices by using a loop. Let's do this. First, we must set the first row of our price list to s zero. Yes, not just the first value, but the entire row of 10 elements, because s zero will be the initial price. For each of the tenet orations we intend to generate, we will obtain the following array. Great. Finally, we can generate values for our price list. We must set up a loop that begins in Day one and ends at day 1000. Weaken. Simply write down the formula for the expected stock price on day T and Python IQ. It will be equal to the price in day T minus one times the daily return observed in day T. Let's verify if we completed the price list. Absolutely see, and if we would like to plot it on a graph with size 10 to 6, we can do that by using the mat plot lib syntax. When we execute, we will obtain 10 possible pass of the expected stock price of Procter and Gamble's stock, starting from the last day for which we have data from Yahoo. We called these trends iterations, since the computer will iterated through the provided formula 10 times. Here we have the paths we simulated. Amazing, right? This was another toughie, wasn't it? We realize we got involved in more technical language in Maur Advanced concepts, but this is the type of topics you need to master to get into the field of finance or data science. Rewind. If you would like to see how the process was carried out next, we will learn more about derivatives and options pricing.
B1 中級 モンテカルロ:株価予想そのIII (Monte Carlo: Forecasting Stock Prices Part III) 13 2 林宜悉 に公開 2021 年 01 月 14 日 シェア シェア 保存 報告 動画の中の単語