Real-time stock and weather forecast

Source: Internet
Author: User

 

Real-time stock

Google data

1. http://www.google.com/ig/api of real-time data? H1 = ZH-CN & stock = 600001

2. K line chart http://www.google.cn/finance/getchart? Q = 600336 & X = Sha & P = 5d & I = 240 http://www.google.com/finance/chart? Q = Sha: 600001 & amp; TLF = 12

3. Complete Information "http://www.google.cn/finance/match? Matchtype = matchall & q= 600 ".

Yahoo data

1. http://download.finance.yahoo.com/d/quotes.csv of real-time data? S0000600336.ss&f0000sl1d1t1c1ohgv&e0000.csv

2. K line chart http://ichart.finance.yahoo.com/t? S = 600036.ss

3. http://chartapi.finance.yahoo.com/instrument/1.0/000001.ss/chartdata;type=quote;range=3m of K-line chart data

 

 

Weather Forecast

Google weather API only supports the United States using zip code for queries, such as: http://www.google.com/ig/api? Hl = ZH-CN & weather = 94043 (94043 is the zip code of Mountain View City, USA). Except for the United States, the longitude and latitude coordinates must be used as parameters to execute the Google weather API. For example: http://www.google.com/ig/api? Hl = ZH-CN & weather =, 3067213,1040%6 (3067%,1040%6 is the longitude and latitude coordinates of Chengdu and mainland China)

Of course, you may also query the city name in Chinese pinyin. For example, the following is the weather in Beijing.

Http://www.google.com/ig/api? Weather = Beijing

To the longitude and latitude coordinates of other regions, you can use the country code list provided by Google API and the corresponding city latitude and longitude coordinate list can be queried, the following is the query parameters provided by Google API: http://www.google.com/ig/countries? Output = xml & HL = ZH-CN (query code for all countries supported by Google and display it in ZH-CN Simplified Chinese) http://www.google.com/ig/cities? Output = xml & HL = ZH-CN & Country = Cn

Google weather API only supports the United States using zip code for queries, such as: http://www.google.com/ig/api? Hl = ZH-CN & weather = 94043 (94043 is the zip code of Mountain View City, USA). Except for the United States, the longitude and latitude coordinates must be used as parameters to execute the Google weather API. For example: http://www.google.com/ig/api? Hl = ZH-CN & weather =, 3067213,1040%6 (3067%,1040%6 is the longitude and latitude coordinates of Chengdu and mainland China)

Of course, you may also query the city name in Chinese pinyin. For example, the following is the weather in Beijing.

Http://www.google.com/ig/api? Weather = Beijing

To the longitude and latitude coordinates of other regions, you can use the country code list provided by Google API and the corresponding city latitude and longitude coordinate list can be queried, the following is the query parameters provided by Google API: http://www.google.com/ig/countries? Output = xml & HL = ZH-CN (query code for all countries supported by Google and display it in ZH-CN Simplified Chinese) http://www.google.com/ig/cities? Output = xml & HL = ZH-CN & Country = Cn

C # example:

Using system; using system. Collections. Generic; using system. Text; using system. xml; using system. net;

/// Code by Roman alifanov-API by Google // posted on http://animaonline.blogspot.com namespace googleweatherapi_parser {class program {static void main (string [] ARGs)

{Int I = 0;

Xmlnodelist gwp_nodelist = googleweatherapi_parser (@ "http://www.google.co.uk/ig/api? Weather = Drammen "). selectnodes ("xml_api_reply/weather/current_conditions"); console. writeline ("current weather in Drammen:" + gwp_nodelist.item (I ). selectsinglenode ("temp_c "). attributes ["data"]. innertext); console. readline ();}

Private Static xmldocument googleweatherapi_parser (string baseurl)

{Httpwebrequest gwp_request;

Httpwebresponse gwp_response = NULL;

Xmldocument gwp_xmldoc = NULL;

Try

{Gwp_request = (httpwebrequest) webrequest. create (string. format (baseurl); gwp_request.useragent = @ "Mozilla/5.0 (windows; U; Windows NT 6.0; en-US; RV: 1.8.1.4) Gecko/20070515 Firefox/2.0.0.4 "; gwp_response = (httpwebresponse) gwp_request.getresponse ();

Gwp_xmldoc = new xmldocument ();

Gwp_xmldoc.load (gwp_response.getresponsestream ());}

Catch (exception ex)

{Console. writeline (ex. Message );}

Gwp_response.close ();

Return gwp_xmldoc ;}

}}

Appendix: other weather APIs

Yahoo: http://developer.yahoo.com/weather/

Beijing weather (you can search for it)

Http://xml.weather.yahoo.com/forecastrss? P = chxx0008 & U = f

Domestic API:

Weather in Beijing

Http://weather.all2rss.com/weatherrss.asp? City = Beijing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.