-2

Just looking for a return, where I can input ticker symbols and receive a list of the full company names:

list = ['MSFT','HIVE','etc','etc']

ticker(list) will return list of company names

pbb031
  • 1
  • 1

1 Answers1

1

You can try this:

import yfinance as yf

ticker_list = ['MSFT','HIVE', "AAPL", "HOOD", "TSLA", "GOOG"]


def ticker(ticker_list):
    com_name = []
    for ticker in ticker_list:
        stock = yf.Ticker(ticker)
        name = stock.info.get('longName')
        com_name.append(name)
    return com_name


com_name_list = ticker(ticker_list)
print(com_name_list)

Output:

['Microsoft Corporation', 'HIVE Blockchain Technologies Ltd.', 'Apple Inc.', 'Robinhood Markets, Inc.', 'Tesla, Inc.', 'Alphabet Inc.']

You have to install yfinance to run this code.

yfinance installation command: pip install yfinance

Sabil
  • 3,750
  • 1
  • 5
  • 16