+ 1

How do solve this one to

import yfinance as yf data = yf.Ticker("BTC-USD") data.info['BTC-USD'] data = data.history(period ='5d'),['Close'] print(data)

4th Apr 2023, 4:13 AM
ARBEIT MANN
ARBEIT MANN - avatar
1 Réponse
+ 1
It seems like there are a few issues with the code you provided. Here's how you can fix them: First, make sure you have installed the yfinance module. You can install it using the command pip install yfinance. Next, you need to import yfinance by running import yfinance as yf. This will allow you to use the Ticker class to get information about a particular security. Once you have imported yfinance, you can create a Ticker object by running data = yf.Ticker("BTC-USD"). This will give you access to information about the BTC-USD cryptocurrency pair. Next, you need to fix the syntax of the line data.info[BTC-USD]. It should be data.info['symbol'] instead, which will give you the symbol of the security ('BTC-USD' in this case). Finally, you can get historical data for the security by running data.history(period='5d', ['Close']). This will give you the closing prices for the last 5 days.
4th Apr 2023, 4:28 AM
don't be sad 😶
don't be sad 😶 - avatar