def job():
# Define variables
tickers = "AAPL GOOGL"
start = "2021-08-01"
end = date.today()
tickers_split = tickers.split()
df = pd.DataFrame()
tickers_split
for ticker in tickers_split:
data = pdr.get_data_yahoo(ticker, start=start, end=end, interval='d')
df[ticker] = data['Adj Close']
print(df.shape)
display(df)
df.to_csv(r'path.csv')
schedule.every().day.at("11:10").do(job)
while True:
schedule.run_pending()
time.sleep(1)
I have the above code to pull stock data and then save it on my local path and would like to make it run daily at specific time automatically. I am using schedule but it dsnt do what it is supposed to do. Do I need to have the code open for it to run? If thats the case, what the options are to execute python codes wo having them open or have my computer keep awake all the time?