Skip to content
Advertisement

Accessing yfinance Ticker objects for multiple tickers results in AttributeError

JavaScript
  • The code results in the following error
JavaScript

Advertisement

Answer

  • I’m pretty sure it’s a mistake in the documentation.
  • tickers is the object holding multiple Ticker objects.
  • The README is missing the correct method call, which is also tickers.
  • Additionally, the ticker symbols data is accessed with uppercase letters as shown in the following code.
  • TAB completion at the . will show the correct available methods
  • See AttributeError: ‘Tickers’ object has no attribute ‘msft’ #407 and Update README.rst #408 for future details.

Working Code

  • The following code produces the expected output
JavaScript

tickers.tickers.GOOG.actions

JavaScript

tickers.tickers.AAPL.history(period="1mo")

JavaScript

tickers.tickers.MSFT.info

JavaScript
Advertisement