Error loading daily data when using todate
-
Hello,
I'm trying to load daily data from .csv files, but
bt does not load any data from .csv file when using 'todate' parameter.
Using this command :data = bt.feeds.GenericCSVData(dataname=dataname, seperatotr=',', dtformat='%Y-%m-%d', datetime=0, open=1, high=2, low=3, close=4, volume=5, openinterest=-1, adjclose=-1, reverse=True, timeframe=bt.TimeFrame.Days, compression=1, fromdate=datetime.datetime(2015, 1, 1), todate=datetime.datetime(2016, 1, 1) )
on this data :
Date,Open,High,Low,Close,Volume
...
2016-01-05,201.40,201.90,200.05,201.36,110845848
2016-01-04,200.49,201.03,198.59,201.02,222353536
2015-12-31,205.13,205.89,203.87,203.87,114877856
2015-12-30,207.11,207.21,205.76,205.93,63317680
2015-12-29,206.51,207.79,206.47,207.40,92640672
2015-12-28,204.86,205.26,203.94,205.21,65899940
...
removing the 'todate' parameter and bt is OK, but with the parameter bt loads no values for any .csv file
any idea how to fix this ?
Thank you -
@trade-prophet probably it happens cause your data is reversed in the .csv. but it is just a guess.
-
You are absolutely right, I see my mistake, GenericCSVData does not support reverse parameter.
Is there a way to reverse data in CSV file? -
@trade-prophet it is a lot of different ways depending on your needs and situation. Couple examples: read into Excel, sort as required, save as .csv. Using pandas read as data frame, sort as required, save as .csv. Open in the text editor, copy - paste in necessary order, save.
-
OK,
thank you