Real time stock data interface

There are two ways to obtain stock data :
1. http/javascript Interface access data
2. web-service Interface

1.http/javascript Interface access data

1.1Sina Stock data interface

Take Daqin Railway as an example ( Stock code :601006) For example , If you want to get the latest information about it , Just visit Sina's stock data
Interface :

http://hq.sinajs.cn/list=sh601006

This url Will return a string of text , for example :

var hq_str_sh601006=" Daqin Railway , 27.55, 27.25, 26.91, 27.55, 26.20, 26.91, 26.92, 
22114263, 589824680, 4695, 26.91, 57590, 26.90, 14700, 26.89, 14300,
 26.88, 15100, 26.87, 3100, 26.92, 8900, 26.93, 14230, 26.94, 25150, 26.95, 15220, 26.96, 2008-01-11, 15:05:32";

This string is made up of a lot of data , Data with different meanings are separated by commas , According to the programmer's idea , Sequence number from 0 Start .

0:” Daqin Railway ”, Stock name ;
1:”27.55″, Today's opening price ;
2:”27.25″, Yesterday's closing price ;
3:”26.91″, Current price ;
4:”27.55″, Today's highest price ;
5:”26.20″, Today's lowest price ;
6:”26.91″, Bidding price , namely “ Buy one ” offer ;
7:”26.92″, The auction price , namely “ Sell one ” offer ;
8:”22114263″, The number of shares traded , Because the stock exchange is based on 100 shares , So in use , Usually divide the value by 100 ;
9:”589824680″, Clinch a deal amount , Unit is “ element ”, To make it clear at a glance , Usually, the “ Ten thousand yuan ” Unit of transaction amount , So it's usually divided by ten thousand ;
10:”4695″,“ Buy one ” apply 4695 stocks , namely 47 hand ;
11:”26.91″,“ Buy one ” offer ;
12:”57590″,“ Buy two ”
13:”26.90″,“ Buy two ”
14:”14700″,“ Buy three ”
15:”26.89″,“ Buy three ”
16:”14300″,“ Buy four ”
17:”26.88″,“ Buy four ”
18:”15100″,“ Buy five ”
19:”26.87″,“ Buy five ”
20:”3100″,“ Sell one ” declare 3100 stocks , namely 31 hand ;
21:”26.92″,“ Sell one ” offer
(22, 23), (24, 25), (26,27), (28, 29) Respectively “ Sell two ” to “ Selling four ”
30:”2008-01-11″, date ;
31:”15:05:32″, Time ;

A simple JavaScript Application examples :

<script type="text/javascript" src="http://hq.sinajs.cn/list=sh601006" charset="gb2312"></script>
<script type="text/javascript">
     var elements=hq_str_sh601006.split(",");
    document.write("current price:"+elements[3]);
</script>

This code output Daqin Railway ( Stock code :601006) The current share price of

current price:14.20

If you want to query multiple stocks at the same time , So in URL Add a comma at the end , Add in the stock code ; For example, you need to check the Daqin Railway (601006) And Datong coal industry (601001) The market of , Use it like this URL:

http://hq.sinajs.cn/list=sh601003,sh601001

Check the market index , For example, query the Shanghai Composite Index (000001):

http://hq.sinajs.cn/list=s_sh000001

The data returned by the server is :

var hq_str_s_sh000001=" The Shanghai composite index ,3094.668,-128.073,-3.97,436653,5458126";

The meaning of the data is : Index name , Current points , Current price , Up and down rate , volume ( hand ), turnover ( Ten thousand yuan );

Check the Shenzhen index :

http://hq.sinajs.cn/list=s_sz399001

For stocks K Line graph , The daily chart can be obtained by request http://image.sinajs.cn/…./…/*.gif this URL obtain , among * Stands for the stock code , See below for details :

Check the day K Line graph :

//inotgo.com/imagesLocal/202105/20/20210520030533030c_0.gif

Query of timesharing :

//inotgo.com/imagesLocal/202105/20/20210520030533030c_1.gif

Japan K Line query :

//inotgo.com/imagesLocal/202105/20/20210520030533030c_2.gif

Zhou K Line query :

//bbsmax.ikafan.com/static/L3Byb3h5L2h0dHAvaW1hZ2Uuc2luYWpzLmNuL25ld2NoYXJ0L3dlZWtseS9uL3NoMDAwMDAxLmdpZg==.jpg

month K Line query :

//inotgo.com/imagesLocal/202105/20/20210520030533030c_4.gif

1.2 Baidu&Google The financial data of
stay baidu, google When searching for a stock code in , Information about the stock will appear in the front page , For example, in google Search for 601006 when ,
The first search result is shown below :
By clicking on the image on the left, we find that we will link this image to sina On the financial channel , in other words google Stock data is also obtained from sina obtain . After the packet analysis , Find out google It also uses 1.1 The interface described in .

Baidu Our stock data comes from baidu Our financial channel
http://stock.baidu.com/

Stocks API More articles about

  1. [threeJs][ Sina stock api][css3]3D Sina Financial Data - lately A Stocks are going crazy too ......

    Use threeJS With Sina stock finance API On-line : http://wangxinsheng.herokuapp.com/stock Screenshot : A Stocks are up [ It's red 10%] retrieval [ Click Add to selection , Choose to use l ...

  2. Sina Stocks API

    Sina futures data interface [ Example ]http://hq.sinajs.cn/list=M0 Soybean meal is continuous M0 The return value is as follows :var hq_str_M0=" Soybean meal is continuous ,145958,3170,3190,3145 ...

  3. Python3 Get stock market data ( Chinese stocks / China Index / Global index )

    #!/usr/local/bin/python3 #coding=utf-8 #source http://www.cnblogs.com/txw1958/ import os, io, sys, r ...

  4. Marry Bai Fumei , Reach the peak of life (python Crawler stock analysis )

    One . Posture reserve Stock Exchange , linear algebra ( Analyzing stocks ), quantile ( risk assessment )... finace.yahoo.com Yahoo offers almost all the stocks api www.kaggle.com  Ask the community if you have problems To be continued .....

  5. python Get real-time stock information

    Python3 Get stock market data ( Chinese stocks / China Index / Global index ) #!/usr/local/bin/python3 #coding=utf-8 #source http://www.cnblogs.co ...

  6. Python Web request module urllib 、requests

    Python The impression is that it's very convenient to grab web pages , To provide this kind of productivity , The main thing is urllib.requests These two modules . urlib Introduce urllib.request Provides a urlopen Letter ...

  7. Free stock data API Interface

    Free stock data API The interface provides Shanghai and Shenzhen . Hong Kong . US stock market information . 1. Shanghai and Shenzhen Stock Markets 2. Hong Kong stock market 3. The U.S. stock market 4. Hong Kong stock market list 5. List of US stock markets 6. Shenzhen stock market list 7. Shanghai stock list API file :https://www. ...

  8. Access to stock historical data and current data API

    keyword : Stocks ,stock,API, Interface 1. Get current stock data Sina data interface :http://hq.sinajs.cn/list={code}.{code} Replace it with the stock code , Shanghai stock code with prefix sh, Shenzhen stock market ...

  9. Data interface - Free version ( Stock data API)

    The main sources of stock data are : Data supermarket . Yahoo . Sina .Google. Blog . sohu .ChinaStockWebService. Oriental Fortune client . Stock star . NetEase Finance . Data supermarket 2016 year 5 month 6 Daily update . According to the recent frequency ...

Random recommendation

  1. [ translate ]AKKA note - CHILD ACTORS And ACTORPATH -6

    original text :http://rerun.me/2014/10/21/akka-notes-child-actors-and-path/ Actor It's a complete inheritance structure . Anything you create Actor It must be all one other Act ...

  2. HTTPf The server (3)

    Full function HTTP The server Introduction This is a fully functional HTTP The server . It can provide a complete document input , Include images ,applet,HTML file , text file . It is associated with SingleFileHttpServer Very similar , Just not ...

  3. atitit.spring3 mvc url Configure best practices

    atitit.spring3 mvc url Configure best practices 1. Url-pattern  bp 1 2.  Universal asterisk url pattern The problem of 1 3. Other code 1 4.  Reference resources 2 1. ...

  4. Assembly view StackFrame Stack frame

    INCLUDE Irvine32.inc myProc PROTO, x:DWORD, y:DWORD .data .code main proc mov eax,0EAEAEAEAh mov ebx ...

  5. E - Trees on the level

     Trees on the level  Background Trees are fundamental in many branches of computer science. Current ...

  6. 【 To configure 】 Telecom Huawei HG8245 Wireless router configuration There are maps

          Introduction : The home wireless router can't connect to the Internet directly , Can only pass through again PPPoe Dial up internet access . After online inquiry and some twists and turns , The strategy is as follows . 1. Log in as a super user 192.168.1.1( Default password ) use ...

  7. About http Status code 204 understand

    HTTP There are many kinds of status codes , There are mainly 1xx( Temporary response ).2xx( success ).3xx( Redirected ).4xx( Request error ) as well as 5xx( Server error ) Five categories , Each category also corresponds to some specific categories . Usually we have more contact with 200. ...

  8. python On the output coding of Chinese characters

    python How many beginners are puzzled by the problem of Chinese output garbled code , I don't know how many mistakes I have made in this respect . Now I'd like to share with you my problems and solutions : 1 Output random code The so-called garbled code refers to “ I don't know  Document column  Jujube ” Such content . Why? ...

  9. FCC(ES6 How to write it ) Exact Change

    Design a cash register  checkCashRegister() , It puts the purchase price (price) As the first parameter , The payment amount (cash) As the second parameter , And the change in the cash register (cid) As the third parameter . cid  ...

  10. Learn step by step .Net Core Web Api Development series 【2】: utilize Swagger debugging WebApi

    Series catalog Learn step by step .Net Core Web Api Development Series catalog This series involves the source code download address :https://github.com/seabluescn/Blog_WebApi One . summary Since the front and back ...