1

I can retrieve an individual stock's price data as follows:

import yfinance as yf

stockPrice = yf.Ticker("AAPL").history(period="max")["Close"] #by the way, ["Close"] is not strictly required.

Is there a way to retrieve the historical compounded price data of a stock exchange as a whole (e.g. AEX, IBEX, DAX, etc.)?

Any help is appreciated!

  • 3
    What happened when you tried reading the documentation for yfinance? What exactly do you expect "the entire stock exchange" to mean (do you even know how many companies that is?) - how do you expect the data to be structured? Stack Overflow is not intended to replace existing tutorials and documentation. – Karl Knechtel Apr 15 '21 at 15:55
  • 2
    Does this answer your question? [How to get a complete list of ticker symbols from Yahoo Finance?](https://stackoverflow.com/questions/5246843/how-to-get-a-complete-list-of-ticker-symbols-from-yahoo-finance) – Ani Apr 15 '21 at 16:07
  • 1
    @KarlKnechtel, your skepticism is warranted; but it was due to my wrongly formulated question. I'll rewrite it. – Value_Investor Apr 15 '21 at 16:33
  • 1
    @Ani, thank you for your feedback, but no, this does not answer my question. My question, however, was vague, and I will now rewrite it. – Value_Investor Apr 15 '21 at 16:34
  • 1
    @Value_Investor Welcome to stack overflow. This seems like a fine question. I'm not sure why there was a vote to close - that seems like a mean-spirited response to a new member. – user48956 Apr 15 '21 at 16:46
  • In that case, what happened when you tried putting, e.g., `yfinance stock ticker for nasdaq` into a search engine? This doesn't appear to be a programming question, it's just a question of knowing what things are called in the trading world. – Karl Knechtel Apr 15 '21 at 22:33

1 Answers1

0

How about this? Just pass multiple ticker symbols to download.

import yfinance as yf

data = yf.download("AEX IBEX DAX AAPL", periods="max")['Close']
data.tail()

Output:

    AAPL    AEX DAX IBEX
Date                
2022-03-21  165.380005  NaN 28.230000   16.16
2022-03-22  168.820007  NaN 28.629999   15.85
2022-03-23  170.210007  NaN 28.065001   15.91
2022-03-24  174.070007  NaN 28.207001   16.18
2022-03-25  174.720001  NaN 28.340000   15.00
KarelZe
  • 1,466
  • 1
  • 11
  • 21