Problem: I have to extract data based on different asset classes such as Bonds, Commodities, Listed Options, Cryptocurrency, etc. I am able to get the financial data from yfinance if and only if I know the ticker symbol and it is a manual process and not based on the asset class.
Example (Hard Coded):
import yfinance as yf
import pandas as pd
cryptocurrency = ['BTC-USD', 'ETH-USD', 'USDT-USD', 'BNB-USD', 'XRP-USD', 'ADA-USD', 'HEX-USD', 'SOL-USD',
'AVAX-USD', 'LUNA1-USD', 'DOGE-USD', 'DOT-USD', 'DOT-USD', 'SHIB-USD', 'MATIC-USD']
cryptocurrency_df = yf.download(cryptocurrency, period = '1y')
cryptocurrency_df.dropna(inplace = True)
Through this, I am able to get the desired result but being hard coded I am able to extract only a few of the available options.
Relevant Link: Through this source: https://finance.yahoo.com/cryptocurrencies/ we can see all the listed cryptocurrencies. I want to extract data of the say top 25 cryptocurrencies based on the market cap.
Request: It would be better if the help is provided not using web scraping libraries because I need data to be in the form of:
Adj Close Close High Low Open Volume
C1 C2... C1 C2... C1 C2... C1 C2... C1 C2... C1 C2...
Date
YYYY-MM-DD PAC1 PAC2 PC1 PC2 PH1 PH2 PL1 PL2 PO1 PO2 PV1 PV2
where C1, C2 ... are the cryptocurrencies
PAC1, PAC2 ... are Adj Close of the cryptocurrencies, and so on