import pandas as pd import matplotlib.pyplot as plt from alpha_vantage.timeseries import TimeSeries from alpha_vantage.techindicators import TechIndicators
sbs = [] newsbs = [] df1 = pd.DataFrame() # Get tickers from file file = open("test1.txt", "r") for x in file: sbs.append(x) print(sbs) #Remove spaces from ticker symbols for y in sbs: newsbs.append(y.strip()) #print(newsbs) for s in newsbs: print(s) API_key = 'HX.........VJ2' ts = TimeSeries(key= API_key, output_format='pandas') data_ts, meta_data_ts = ts.get_daily_adjusted(symbol=s) open_list = data_ts['1. open'].to_list() #df1 = data_ts #print(df1) df1[s] = open_list print(df1) #df2 = df1 #print(df2) df1.to_csv(r'C:\Users\....\out.csv', index = False, header=True, mode ='a')
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)