Original article: https://www.octoparse.jp/blog/scraping-stock-prices/
The new coronavirus (COVID-19), which was reported to be infected in China in January 2020, has spread worldwide, and in mid-March, the number of infected people in other countries overtook the number of infected people in China. Due to restrictions on going out in each country, financial markets have moved significantly, and the real economy has also fallen sharply in many countries. The pandemic of the new coronavirus has also caused a significant decline in the stock market.
In this article, I will scrape the Nikkei Stock Average from January to April. This time, we will use the data published on the Yahoo! Finance website. You can refer to the Nikkei Stock Average data for the past 4 months at the following URL.
https://info.finance.yahoo.co.jp/history/?code=998407.O&sy=2020&sm=1&sd=1&ey=2020&em=4&ed=30&tm=d
Let's get started!
I often scrape stock price data with Python or API, but Python makes the work complicated and I do not have free API information, so this time it is a scraping tool [Octoparse](https: // www. Use octoparse.jp/).
The latest Version 8.1 has an automatic recognition function for web pages, and the important data can be detected just by entering the above URL. When executed, it can be extracted quickly.
Python etc. are relatively fast, but it still takes time to scrape time series data for the past year or more. If you want to analyze a large amount of data when you want to analyze stock prices, use Scraping Tool such as Octoparse. I think it's most efficient to collect. Moreover, it is easy for amateurs to be able to scrape data hands-free.
The following is the acquired data. It's a perfect data format without any organization.
This time I also got the data, so it's not as perfect as the official one, but I made a stock price graph in Excel.
Looking at the graph, the Nikkei Stock Average continued to plunge from 23,386.74 yen on February 21, and hit a short-term bottom of 16,552.83 yen on March 19. With the support of the BOJ's buying, it was on a recovery trend, and returned to a high of 19,546.63 yen on March 25th. It dropped to 18,065.41 yen on April 1, but now the crash has stopped falling and is gradually rising.
Due to the turmoil caused by the spread of the new coronavirus infection, stock markets not only in Japan but also around the world continue to decline. In the US stock market as well, the S & P 500 Index fell by more than 7% shortly after approaching on March 9, 12 and 16, and a circuit breaker was activated to suspend trading for 15 minutes. This measure has been in effect since 1997.
Source: Picte Investment Trust Investment Advisory Co., Ltd.
In the past, the stock market has plunged many times for various reasons, but regarding the spread of the new coronavirus worldwide, the production capacity of factories has declined, the supply chain and transportation network have been blocked, etc. Concerns about the impact on the supply side (supply shock) led to a decline in stock prices. As globalization progresses, if the effects of the new coronavirus continue in some countries, it will affect the economic activities of other countries, and I think that the severe situation will continue.
In any case, I hope that the situation will be resolved as soon as possible and that the crisis of the new coronavirus will be overcome.
Recommended Posts