Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,
Greetings for the day!

I don't have much experience of Yahoo Finance API. I'm required to get all the stock symbols stock-market-wise from yahoo using this API. Can somebody please help me to achieve this purpose?

I think this could be achieved by downloading the ticker data from Yahoo.

I've tried getting into the sample codes at http://code.google.com/p/yahoo-finance-managed/[^] but no luck.

I appreciate any little help.


I've tried this so far:

C#
TextWriter tw = File.CreateText("StockData.csv");
            AlphabeticIDIndexDownload dl1 = new AlphabeticIDIndexDownload();
            dl1.Settings.TopIndex = null;                      
            Response<AlphabeticIDIndexResult> resp1 = dl1.Download();

            tw.WriteLine("Id|Isin|Name|Exchange|Type|Industry");
            Console.WriteLine("Id|Isin|Name|Exchange|Type|Industry");
            foreach (var alphabeticalIndex in resp1.Result.Items)
            {
                AlphabeticalTopIndex topIndex = (AlphabeticalTopIndex)alphabeticalIndex;
                dl1.Settings.TopIndex = topIndex;
                Response<AlphabeticIDIndexResult> resp2 = dl1.Download();
                foreach (var index in resp2.Result.Items)
                {
                    IDSearchDownload dl2 = new IDSearchDownload();
                    Response<IDSearchResult> resp3 = dl2.Download(index);                   
                    foreach (var item in resp3.Result.Items)
                    {
                        tw.WriteLine(item.ID + "|" + item.ISIN + "|" + item.Name + "|" + item.Exchange + "|" + item.Type + "|" + item.Industry);
                        Console.WriteLine(item.ID + "|" + item.ISIN + "|" + item.Name + "|" + item.Exchange + "|" + item.Type + "|" + item.Industry + "Exchange: " + item.Exchange);
                    }
                }
            }



Best Regards,
Sunny
Posted
Updated 20-Jan-13 18:22pm
v3

1 solution

Are you sure you cant get this code samples.

I can download the code from this link[^] and sample codes from here[^]
 
Share this answer
 
Comments
Sunny_Kumar_ 20-Jan-13 23:32pm    
Hi jibesh,

I really appreciate your hint but I've already given a try to this. I'm able to download the list of stock, but I want to sort/categorize them market-wise or exchange-wise? Can you help me with this?
Jibesh 20-Jan-13 23:51pm    
what effort you made so far. may be you can post the code where you are having trouble so that i can help you. its really impossible for me to do all the code work your problem. but if you can post the code which doesnt work i may able to find an alternate or try to fix the problem. Thanks
Sunny_Kumar_ 21-Jan-13 0:22am    
I've updated the question with my code. PS.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900