How to query the historical stock price of a stock?

Time:2021-2-5

A small tool that can query the historical stock price online. At present, it can query the historical stock prices of a shares, Hong Kong shares and U.S. stocks. In addition, it can download the historical stock price excel of individual stocks, which is very useful for analysis and research
How to query the historical stock price of a stock?

Download in two steps:

  1. Fill in the stock code and email
  2. Stock history data will be received in 5 minutes

[mobile phone users can copy [data as a service] and search Princess number to download in batches in steps 1 and 2, 0, no need to forward and share. Computer users can scan the code directly. 】It’s really helpless to download it on princess. Otherwise, it’s easy to be downloaded maliciously. It’s very convenient to download the stock history data. You can do two steps in princess. Generally, you can receive the stock history data in five minutes.
How to query the historical stock price of a stock?

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 downloading through princess. Very simple, no routine restrictions, not on the princess, normal people simply can not grab those machines.

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, are basically routine money, do not believe you have to find a circle back
How to query the historical stock price of a stock?
Stock history

pro = ts.pro_api()

df =  pro.daily (ts_ code='000002.SZ', start_ date='19910129', end_ date='20191226') # start_ Date is the listing date of the stock, end_ Date is the end date. These two dates mean the period of time you want to get the data. If you want to get a year's data, write it: start_ date='20181226', end_ date='20191226'

print(df)

Input data (example)
 ts_code trade_date  open  high   low  close  pre_close  change    pct_chg  vol        amount
0  000002.SZ   20180718  8.75  8.85  8.69   8.70       8.72   -0.02       -0.23   525152.77   460697.377
1  000002.SZ   20180717  8.74  8.75  8.66   8.72       8.73   -0.01       -0.11   375356.33   326396.994
2  000002.SZ   20180716  8.85  8.90  8.69   8.73       8.88   -0.15       -1.69   689845.58   603427.713
3  000002.SZ   20180713  8.92  8.94  8.82   8.88       8.88    0.00        0.00   603378.21   535401.175
4  000002.SZ   20180712  8.60  8.97  8.58   8.88       8.64    0.24        2.78  1140492.31  1008658.828
5  000002.SZ   20180711  8.76  8.83  8.68   8.78       8.98   -0.20       -2.23   851296.70   744765.824
6  000002.SZ   20180710  9.02  9.02  8.89   8.98       9.03   -0.05       -0.55   896862.02   803038.965
7  000002.SZ   20180709  8.69  9.03  8.68   9.03       8.66    0.37        4.27  1409954.60  1255007.609
8  000002.SZ   20180706  8.61  8.78  8.45   8.66       8.60    0.06        0.70   988282.69   852071.526
9  000002.SZ   20180705  8.62  8.73  8.55   8.60       8.61   -0.01       -0.12   835768.77   722169.579