12
$\begingroup$

I remember having seen that somewhere, I can't find it any more. Anyone knows how can I get all the list of stocks on Yahoo finance.

Or even all american stocks, maybe Russell 1000/2000/3000...

$\endgroup$
2

12 Answers 12

11
$\begingroup$

BATS has a nice downloadable file: http://batstrading.com/market_data/listed_symbols/

There's a CS and XML. They have 7,000 stocks in that list. Good stocks, not OTC.

$\endgroup$
3
  • $\begingroup$ that's a cool one, it doesn't have non US, or I couldn't find non-us. But I still accepted the answer since I only mentioned Russell index. Anything similar for the rest of the world? (UK, Australia ...) $\endgroup$
    – Charbel
    Commented May 25, 2016 at 15:38
  • $\begingroup$ No that I've found. US Markets have the best data sources due to popularity. $\endgroup$ Commented May 26, 2016 at 21:30
  • 3
    $\begingroup$ After downloading the csv I only have 359 symbols though $\endgroup$ Commented May 4, 2020 at 17:42
9
$\begingroup$

For American stocks: if you are using Python 3, you can first, from a terminal, do

pip install get-all-tickers

then

from get_all_tickers import get_tickers as gt

list_of_tickers = gt.get_tickers()
# or if you want to save them to a CSV file
get.save_tickers()

Alternatively, you can clone the file from https://github.com/shilewenuw/get_all_tickers/blob/master/get_all_tickers/tickers.csv

$\endgroup$
2
  • $\begingroup$ This source is no longer valid. $\endgroup$
    – jetole
    Commented Nov 3, 2021 at 10:36
  • $\begingroup$ valid, i checked and downloaded all $\endgroup$ Commented Jun 20 at 14:12
4
$\begingroup$

You can get a list of tickers for free using Finnhub's API.

You just need to request a free API key.

Check out the following documentation: https://finnhub.io/docs/api#stock-symbols

#pip install finnhub-python
import pandas as pd
import finnhub

#list of available exchanges

df=pd.read_html("https://docs.google.com/spreadsheets/d/1I3pBxjfXB056-g_JYf_6o3Rns3BV2kMGG1nCatb91ls/edit#gid=0")
df1=df[0]
exc=df1.loc[:,"A"].dropna()

exclist=[]
for i in exc:
    exclist.append(str(i))
exclist=exclist[1:] #take out "name" from the list

#retrieve tickers from every exchange available
tickers=[]
finnhub_client = finnhub.Client(api_key="c46qn9iad3iagvmhdk7g")
for exchange in exclist:
    listofdicts=finnhub_client.stock_symbols(exchange)
    for dicts in listofdicts:
        tickers.append(dicts['symbol'])

print("You just got a list of %s tickers worldwide." % len(tickers), tickers)
$\endgroup$
2
  • $\begingroup$ needed to run this on mac: /Applications/Python 3.10/Install Certificates.command $\endgroup$
    – martin
    Commented Apr 17, 2023 at 0:25
  • 1
    $\begingroup$ FinnhubAPIException(status_code: 401): You don't have access to this resource. $\endgroup$
    – Luk Aron
    Commented Sep 7, 2023 at 13:55
3
$\begingroup$

I have found this tool: https://github.com/Benny-/Yahoo-ticker-symbol-downloader

It uses the search api https://finance.yahoo.com/_finance_doubledown/api/resource/searchassist;searchTerm=s6s?device=console&returnMeta=true

$\endgroup$
1
$\begingroup$

Yahoo Closed its API, we are also downloading manually all the symbols for our use. Also we are sharing it wil all on https://github.com/stockdatalab/YAHOO-FINANCE-SCREENER-SYMBOLS-AND-HISTORICAL-DATA. you can download from above link.

Google Yahoo both not providing symbol list any more also Google providing historical data only for one year of any company.

$\endgroup$
1
$\begingroup$

Here's the best link i've found

Best Link I've Found

$\endgroup$
1
  • $\begingroup$ That's from 2017. $\endgroup$
    – tripleee
    Commented Sep 23, 2021 at 6:26
1
$\begingroup$

You can try this - it pulls down 400000 tickers. https://github.com/mlapenna7/yh_symbol_universe

$\endgroup$
0
$\begingroup$

YQL seems to fail at queries with like '%AM%' and also there is no other way to get list of all stock symbols. but i think this can do the trick..

select * from yahoo.finance.industry where id in (1,2,3....260)

this will give you list of companies and there symbols. start with select * from yahoo.finance.industry where id in (112) and see if it works.

$\endgroup$
2
  • $\begingroup$ can you give me an example of how to use YQL? is that using a link of some sort? $\endgroup$
    – Charbel
    Commented Dec 29, 2016 at 11:07
  • $\begingroup$ YQL was retired in 2019: en.wikipedia.org/wiki/Yahoo!_Query_Language $\endgroup$
    – Contango
    Commented Jun 2, 2021 at 20:40
0
$\begingroup$

For common equities, you the find the list in here.

There are 69k stocks from 49 exchanges.

Also, these tickers comply with Yahoo Finance's standard.

$\endgroup$
0
$\begingroup$

Here is the code to scrape all symbols present in that yahoo-finance screener. You can simply create a screener here

I have modified the code a little bit because yahoo-finance was returning an empty 404 response when working with the python requests module. Similar to this issue / solution

Here is the complete working code.

import requests
import json
import time

# Modify BASE_URL accordingly
BASE_URL = "https://finance.yahoo.com/screener/unsaved/79fce2f7-82fe-49ec-8098-88add84138ec?dependentField=sector&dependentValues=&offset=OFFSET&count=COUNT"

cnt = 100
offset = 0
flag = 1
temp  = 10
name_to_symbol = []
total = 0

while flag > 0:
    url = BASE_URL.replace("OFFSET", str(offset))
    url = url.replace("COUNT",str(cnt))
    offset += cnt
    
    response = requests.get(url, headers={'User-Agent': 'Custom'})
    s = str(response.text)
    jsonArrayStart = s.find('"results":{"rows"') + 18
    jsonArrayEnd = jsonArrayStart + 1

    while s[jsonArrayEnd] != ']':
        jsonArrayEnd += 1
    
    jsonArrayString = s[jsonArrayStart: jsonArrayEnd+1]
    jsonArray = json.loads(jsonArrayString)
    if len(jsonArray) != cnt:
        flag = 0
    
    total += len(jsonArray)
    for obj in jsonArray:
        if 'longName' in obj:
            name_to_symbol.append([obj['symbol'], obj['longName']])
        elif 'shortName' in obj:
            name_to_symbol.append([obj['symbol'], obj['shortName']])
        else:
            name_to_symbol.append([obj['symbol'], obj['symbol']])
    time.sleep(10)
    
name_to_symbol

P.S - Sorry for the late response. Also, I have rejected all the edits as they were irrelevant and I have fixed the code now. In future I would recommend commenting on the post instead of suggesting an improper edit

HTH

$\endgroup$
1
  • $\begingroup$ Thanks for the solution. It was working earlier but it now throws an error. Can you please fix it. I checked the json it returns now is not valid anymore. $\endgroup$
    – utara007
    Commented Feb 18, 2022 at 16:00
0
$\begingroup$

I made my own excel with 87k+ tickers, updated on May 2024, taken from Yahoo Finance lookup, I thought that would be helpful for a lot of folks out there so i have built a website in which I will continue to update it.

https://yftickers.wordpress.com/

I am considering adding indexes, ETFs and so on if I receive enough donations, so keep an eye on that if U want :)

$\endgroup$
0
0
$\begingroup$

This is also comprehensive, with a breakdown by instrument type (stock, ETC, etc.), exchange, country. Published 2017. https://investexcel.net/all-yahoo-finance-stock-tickers/

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.