Where to download all stock history data? How to download all stock history data?

Time:2021-7-7

All the historical data of 4000 + stocks and 500 + indexes have been packed, and all the historical data of the latest trading day can be downloaded at any time, which is an online download tool
Where to download all stock history data? How to download all stock history data?
Download in two steps:

  1. Fill in stock code and email
  2. We will receive the historical data of the stock market in Excel in 5 minutes

It’s really helpless to download it on princess. I hope you can understand [otherwise, it’s easy to be downloaded maliciously]. It’s very convenient to download the stock history data. Just go through steps 1 and 2 in princess. Generally, you can receive the stock history data in 5 minutes.[search Princess [data as a service] can be downloaded in 1 and 2 steps, 0 yuan, no need to forward and share
Where to download all stock history data? How to download all stock history data?
Online download is easy to be infinitely malicious download, which greatly affects the download of normal users. So later, in order to block these malicious downloading of stock history data, we set up the way of submitting through Princess number and sending by email.

It’s because online downloading is easy to be attacked and downloaded maliciously, so we finally chose to put it on the princess. If we want to attack, we should attack the princess first. No one has such great ability. So this method [one is m fee (0 ¥), the other is long-term], and I hope you can understand it

Now do online download, basically are routine money, do not believe you have to find a circle back

Where to download all stock history data? How to download all stock history data?

import re
import pandas
import requests
Url ='the URL of the target website '# there is no link to the specific website. The general practice is the same.

Response = requests. Get (URL). Text # get the source code of the web page

###The following is the code to parse the opening data, most of which can be referred to as simple regular expressions###

times = re.findall('class="first left bold noWrap">(.*?)</ Td > '). Group (1) # get all historical transaction times
open_ price = re.findall('class="first left bold noWrap">.*?</ td>\s+<td data-real-value="(.*?)"'). Group (1) # get all historical opening price data
close_ price = re.findall('class="first left bold noWrap">.*?</ td>\s+<td.*?</ td>\s+<td data-real-value="(.*?)">'). Group (1) # get all historical closing price data
high_ price = re.findall('class="first left bold noWrap">.*?</ td>\s+<td.*?</ td>\s+<td.*?</ td>\s+<td data-real-value="(.*?)">'). Group (1) # get all historical closing price data

###The following is the data part of data download cost, take download as local excel as an example###

df = pandas.DataFrame(a, columns=['open_ price', 'close_ Price ','vol'], which converts data into dataframe format
Wt = excelwriter (path) # path is the path to save the file, which should be accurate to the file name. After downloading the cost data, you need to go to this path.
For example: C: \ \ users \ \ administrator \ \ desktop \ \ all historical opening data of stocks download cost data. XLS just follow this path to find the saved excel

df.to_ excel(wt, sheet_ Name ='How to download the historical closing price of a stock ', index = false)