I can’t figure out how to make the tick of the stock from each txt file, in which on each new line, the quotes are downloaded line by line.
Here is the main code:
from pandas_datareader import data input = open('C:/Users/II/Downloads/1.txt', 'r') s = input.read() r = data.DataReader(s, 'yahoo', '1900-01-01') r.to_csv('C:/Users/II/Downloads/'+s+'_data.csv') I can not understand how to put while or for line, please write in the sample code. Thank.
An example of what is obtained at the output of the csv file.
Date,Open,High,Low,Close,Volume,Adj Close 2010-11-18,35.0,35.990002000000004,33.889998999999996,34.189999,457044300,30.210939 2010-11-19,34.150002,34.5,33.110001000000004,34.259997999999996,107842000,30.272792 2010-11-22,34.200001,34.48,33.810001,34.080002,36650600,30.113744 2010-11-23,33.950001,33.990002000000004,33.189999,33.25,31170200,29.380338000000002 2010-11-24,33.73,33.799999,33.220001,33.48,26138000,29.58357 2010-11-26,33.41,33.810001,33.209998999999996,33.799999,12301200,29.866328000000003 2010-11-29,33.799999,33.810001,33.07,33.799999,27776900,29.866328000000003