How to download A-share historical market under excel? How to download A-share historical market trend data?

Time:2021-7-15

Let’s talk about how to download A-share historical market to local excel. It’s not difficult to download A-share historical market trend data. Many clients of securities companies have provided it before, but now it seems that there are no restrictions or restrictions.
Only need two steps, 0 ¥, don’t download software, download online anytime and anywhere
How to download A-share historical market under excel? How to download A-share historical market trend 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 the princess. I hope you can understand [otherwise it’s easy to be downloaded maliciously]. It’s very convenient to download. You can do two steps in the princess, i.e. 1 and 2, and you can receive the data in five minutes.

How to download A-share historical market under excel? How to download A-share historical market trend 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 downloads, we set up the way of submitting and sending e-mail through Princess number.

It’s because online download is easy to be attacked and downloaded maliciously, so we finally chose to put it on princess. In this case, wechat should be the first one to attack. No one should have such great ability. So this method is m-fee (0 ¥), and it can last for a long time. I hope everyone can understand it

Now do online download, basically are routine money, do not believe you have to find a circle back
How to download A-share historical market under excel? How to download A-share historical market trend data?

If you know the code, it’s simpler. I’ll send you the code directly

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)

source:
Stock market historical data download
Stock history

Recommended Today

Big data Hadoop — spark SQL + spark streaming

catalogue 1、 Spark SQL overview 2、 Sparksql version 1) Evolution of sparksql 2) Comparison between shark and sparksql 3)SparkSession 3、 RDD, dataframes and dataset 1) Relationship between the three 1)RDD 1. Core concept 2. RDD simple operation 3、RDD API 1)Transformation 2)Action 4. Actual operation 2)DataFrames 1. DSL style syntax operation 1) Dataframe creation 2. SQL […]