0
votes

Am trying to create a program that fetches data from yahoo finance all stock data. I found one rest API that gives me a stock price but I have to pass two parameters ex. if I have to get Apple stock price I have to pass Apple and stock name but I want all stock data so how do I get ??

can anyone help me thanks in advance

3

3 Answers

0
votes

Unfortunately there isn't any official source of tickers or method of getting them.

You can use this script link to download tickers but as creator mentioned:

it is not possible to get all the symbols due to limitations set by Yahoo. About 75%-90% of all symbols are gathered using this script depending on type.

And it also downloads some no longer existing or inaccessible tickers.

From this site link you can download list of almost all tickers but about 30% of tickers are either in wrong category or aren't working. Checking whether ticker exists is easy because when API returns no data then we can deduce that ticker is incorrect. But checking if category is appropriate is a bit more complicated.

I've filtered tickers from the second site but only ETFs and Mutual Funds, you can find them on my GitHub. Those files contain about 99% of ETFs and Mututal Funds avaiable on Yahoo. I might consider filtering stocks later and then I'll upload them with script too. Be aware that filtering tickers is impossible on one run without for example VPN because Yahoo limits request to about 10k-20k per day and there are about 20k tickers per category and checking each ticker requires 2 requests.

0
votes

Try with IEX api, it's free, and it provides very complete data, a very simple implementation and a very neat documentation

if yu want AAPL real-time price you just have to request https://api.iextrading.com/1.0/stock/aapl/price

Here's complete documentation https://iextrading.com/developer/docs

0
votes

I was searching for a solution to a similar question for a long time. and at last, I got a solution to my problem. there's a library in python that does this for you! All you have to is pass the right symbol for the stock (for ex: the symbol of Infosys is INFY) Here's the link to the documentation of the library

Dynamic Stock prices : https://nsetools.readthedocs.io/en/latest/ Historical Stock Data : https://nsepy.readthedocs.io/en/latest/

I hope this helps! All the best