Sina stock data interface
Yidaqin Railway (Stock
Code : 601006) for example, if you want to obtain its latest market, you only need to access Sina's stock data
Interface: http://hq.sinajs.cn/list?sh601006this urlwill return a string of records, for example: var hq_str_sh601006 = "Daqin railway, 27.55, 27.25, 26.91, 27.55, 26.20, 26.91, 26.92,
22114263,589 listen 680, 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, 15:05:32 ";
This string is spliced by a lot of data. Data of different meanings are separated by commas (,).ProgramEmployee's idea. The sequence number starts from 0.
0: "Daqin Railway", stock name;
1: "27.55", available today;
2: "27.25", closing price yesterday;
3: "26.91", current price;
4: "27.55", the highest price today;
5: "26.20", the lowest price today;
6: "26.91", bidding price, that is, "buy one" quotation;
7: "26.92", competitive price, that is, "sell one" quotation;
8: "22114263". The number of votes in the transaction. Because the stock transaction uses one hundred shares as the basic unit, this value is usually divided by one hundred during use;
9: "589824680", deal amount, unit: "Yuan", in order to be clear, usually "10 thousand yuan" as the unit of deal amount, so usually divide the value;
10: "4695", "buy one" apply for 4695 shares, that is, 47;
11: "26.91", "buy one" quotation;
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 shares, that is, 31 hands;
21: "26.92", "buy one" quotation
(22, 23), (24, 25), (26, 27), (28, 29) are the situations from "selling two" to "selling four" respectively"
30: "2008-01-11", date;
31: "15:05:32", time;
This interface is very convenient for javascript programs. It is usually used to insert static or dynamic pages:
<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 outputs the current stock price of Daqin Railway (stock code: 601006)
Current Price: 14.20
If you want to query multiple stocks at the same time, add a comma at the end of the URL and the stock code. For example, you need to query Daqin Railway (601006) and Datong coal (601001) at a time) the URL is used as follows:
Http://hq.sinajs.cn/list=sh601003,sh601001
However, if you want to query the index of the dashboard, the situation may be different. For example, to query the Shanghai Composite Index (000001), use the following URL:
The data returned by the http://hq.sinajs.cn/list=s_sh000001 server is: var hq_str_s_sh000001 = "SSE Index, 3094.668,-128.073,-3.97, 436653,5458126 ";
The data meanings are: Index name, current points, current price, rise/fall rate, transaction volume (hand), and transaction amount (10 million RMB );
The URL of the Shenzhen index is:
Http://hq.sinajs.cn/list=s_sz399001
You can request http://image.sinajs.cn/… to obtain the K-line and daily-line charts of a stock /.... /... /*. GIF: This URL is obtained. * indicates the stock code. For details, see the following:
View the daily K-line chart:
Http://image.sinajs.cn/newchart/daily/n/sh601006.gif
Time-sharing line query:
Http://image.sinajs.cn/newchart/min/n/sh000001.gif
Query the daily data records:
Http://image.sinajs.cn/newchart/daily/n/sh000001.gif
Weekly k query:
Http://image.sinajs.cn/newchart/weekly/n/sh000001.gif
Monthly kill query:
Http://image.sinajs.cn/newchart/monthly/n/sh000001.gif
Source:
Http://blog.sina.com.cn/s/blog_540f22560100ba2k.html