Little question

#5
by kittawere - opened

I just would like to know how do get the data, I need something like this but once a day for a project of mine

Great project btw

Defeat Beta org

Thank you for following this project. Which data in this project would you like to be updated on a daily basis?

Basically I just needed to update all ticket prices from yf every day.
Something like this:

tickers_list = ['AAPL'.... another 10000 more]
yf_final = yf.download(tickers_list, period="10y",interval="1d",auto_adjust=True)  

It fails due to API limits obviously, so maybe I could use your dataset to my project, (that's why I asked you how do you update the prices)

But I realized that if I split the list into chunks of 10 stocks, it does work:

tickers_list = ['AAPL'.... another 10000 more]
tickers_list_chunks = [tickers_list[i:i+10] for i in range(0, len(tickers_list), 10)]  


list_results = []
for tickers in tickers_list_chunks:
    data_yf = yf.download(tickers, period="10y",interval="1d",auto_adjust=True,threads=11)  
    list_results.append(data_yf)
yf_final = pd.concat(list_results, axis=1) 

In the output is obvious that some calls fail, but not much, I am working on capturing the output to try again the failed chunks.
But I am getting around 8000 stocks.

So I don't need your project any more ¯\_(ツ)_/¯ .- Thanks again, and I leave this code here just if someone find it useful

kittawere changed discussion status to closed
Defeat Beta org

ok, thx

Sign up or log in to comment