ranaroussi / yfinance

Download market data from Yahoo! Finance's API
https://aroussi.com/post/python-yahoo-finance
Apache License 2.0
12.9k stars 2.29k forks source link

How do I get all the VALID tickers for Yahoo Finance? #402

Closed kabonker closed 11 months ago

kabonker commented 4 years ago

I keep getting errors on some tickers, and Is there a quick way to see all the tickers they support?

Is there a function to call? Or a page to go to?

thanks john

ScriptKittyM30wM30w commented 4 years ago

@kabonker I have same question, currently using symbols scraped from EODData . You can select the exchange you want and pull all tickers from each page of the alphabet (all of this is selectable from URL so easily scrapable). I haven't run the whole list yet but will post it once I do. Can post scraper code to GitHub in meantime and update this comment with link.

kabonker commented 4 years ago

I created a list of about 4000 tickers.. but would be cool if we just had a list in this library that is some how synced with yahoo finance, so everyone doesn't have to do it manually themselves.

ScriptKittyM30wM30w commented 4 years ago

Agreed, need to compile the list first. May not be publicly available anywhere on Yahoo finance site though so brute force is only solution. BTW can you post your list?

ScriptKittyM30wM30w commented 4 years ago

@kabonker is this the source you used? http://www.nasdaqtrader.com/trader.aspx?id=symboldirdefs

gunjannandy commented 4 years ago

@kabonker I found out this website which has all the tickers [last updated 2017]. So you can use that.

This Excel spreadsheet was updated in September 2017. It is broken down into eight sheets, one each for:

That’s 245784 ticker symbols in total.

kabonker commented 4 years ago

Dude that is awesome... Scotty we will need more power!!!! https://youtu.be/QYqXSlPmMJs?t=10

taewookim commented 3 years ago

FYI this file says "2017".. been 3 years. Must be missing a ton of companies. Anyone have an updated list?

beglitis commented 3 years ago

I am interested in this one as well. One other problem is that I get a lot of tickers as not existing/delisted/deleted. This is obviously an issue. If a ticker was live in 2017 but the company has been delisted since then and therefore the ticker is not valid then there is no consistent way of creating accurate historic stock universes for backtesting. To make this a bit dramatic, Enron would not appear in any of the universes because it doesn't exist today however if you were doing live trading you would have obviously included it at the time (and taken the hit if you were long). In a technical jargon, the survivorship bias is massive. I guess this is why it pays to have professional grade data. That said, this is better than nothing for small projects.

DimitriBolt commented 3 years ago

Does someone know a python-module that can obtain the ticker list?

kabonker commented 3 years ago

Maybe someone can just write a simple program going through the alphabet for 4 chars and make a list of all the successful calls, then write it out..

that would be nice. Could just run it once a quarter.. like COIN would be new. Then spit out the full list and the incremental so we know the new ones..

On Wed, Apr 28, 2021 at 5:21 AM DimitriBolt @.***> wrote:

Does someone know a python-module that can obtain the ticker list?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ranaroussi/yfinance/issues/402#issuecomment-828299421, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKKMVJIVOIFIIH5E3A4A5Y3TK7HRPANCNFSM4POMVK4A .

Fethe98 commented 2 years ago

Information from https://finviz.com/screener.ashx?ft=4 and package from https://pypi.org/project/pyfinviz/.

See the code below. (You can add more than 10 pages if you want all the tickers...)

I am not an expert in python. So if you know how to optimise this code, please show me how!

Thank you!

Have a nice day! :)

`from pyfinviz.screener import Screener

page = 10

screener = Screener(pages=[x for x in range(1, page)])

list_ticker = [] for i in range(0, page): if i == 1: pass else: for j in range(len(screener.data_frames[i])): list_ticker.append(screener.data_frames[i].Ticker[j]) list(list_ticker)

print(list_ticker)`

shullaw commented 2 years ago

How many should there be? I can scrape 10,000 when looking for ALL tickers, just not sure if I got them all because they claim to have 90,000+

edit:

And that goes for Stocks, Mutual Funds, ETFs, and Indicies (all have more than 10k results, but I can only get 10k of them).

kabonker commented 2 years ago

It is a lot. It is quite a challenge keeping them all straight because some get de listed and companies can change their ticker....

On Thu, Jan 13, 2022 at 3:34 PM shullaw @.***> wrote:

How many should there be? I can scrape 10,000 when looking for ALL tickers, just not sure if I got them all because they claim to have 90,000+

— Reply to this email directly, view it on GitHub https://github.com/ranaroussi/yfinance/issues/402#issuecomment-1012494632, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKKMVJKMPV5U3BKSEDN6233UV4ZMHANCNFSM4POMVK4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

atanasi99 commented 2 years ago

Hey everyone, any updates on retrieving all tickers from Yahoo finance. Also does anyone know any good APIs for retrieving FX options data. Thanks

vishalbelsare commented 1 year ago

https://github.com/mlapenna7/yh_symbol_universe

Mxttak commented 1 year ago

You can use the screeners available at the Yahoo finance site: https://finance.yahoo.com/screener/ For example my screener for ETFs traded in the US would then be https://finance.yahoo.com/screener/unsaved/5719e91c-77b9-42ff-987b-d99bcf5c9c8d (3429 on 2022-12-29)

AGDholo commented 11 months ago

How about https://[api.nasdaq.com/api/screener/stocks?tableonly=true&download=true](https://api.nasdaq.com/api/screener/stocks?tableonly=true&download=true)