we can get a stock details in yahoo using the following url . but how can i get stock details using market cap value ,divideend value ,pe ratio ,pro rating instead of sending s=GOOG in the url

http://finance.yahoo.com/d/quotes.csv?s=GOOG&f=snd1l1yr

second thing i get chart data using the following url

http://chartapi.finance.yahoo.com/instrument/1.0/GOOG/chartdata;type=quote;range=5d/csv/

but how can i generate graph using the data

please help me ! i spent 5 days to find i cant find the solution . i posted this in some forums i cant get the answer.

I see you can get data also as xml or as json, this last seems to be malformed, so here's an example based on xml output:

<?php
    $url = 'http://chartapi.finance.yahoo.com/instrument/1.0/GOOG/chartdata;type=quote;range=5d/xml/';

    $f = file_get_contents($url);
    $xml = simplexml_load_string($f);

    # print everything
    print_r($xml);

Since you get an object array you can print a specific node by adding the node name:

print_r($xml->series);

From here it should be easy to collect data and create a chart.

thank you very much , great quick reply other forum they are still didn't reply.but i have one doubt, i am having jquery chart is this data is enough to generate all graph like ohlc,candlestick,ect....

then

we can get a stock details in yahoo using the following url . but how can i get stock details using market cap value ,divideend value ,pe ratio ,pro rating instead of sending s=GOOG in the url

http://finance.yahoo.com/d/quotes.csv?s=GOOG&f=snd1l1yr

If I understand you want to get data by changing this link parameters:

http://finance.yahoo.com/d/quotes.csv?s=GOOG&f=snd1l1yr

I'm not sure you can manipulate it, because you will need an API specification in order to know which parameters you can use. The Yahoo Finance API from what I'm seeing right now, does not provide this kind of feature, but only RSS feeds, which are actually those you're already accessing from:

http://finance.yahoo.com/q?s=GOOG

Maybe you want to consider the Finance Badges: http://finance.yahoo.com/badges/

ok you r right , but i need to do a small website like yahoo finance showing updated information like screening , marketing ,graph and graph comparisions
means how can i do it . i need to generate a graph like comparing two stock datas , multiple graph(ohlc,candlestick,ect). show stock details depent upon diveend yeilds means where can i get accurate data and graph code and datas any guidence

Yahoo finance API is not available anymore. I have moved to MarketXLS after this change, much more reliable data.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.