i tried to code below:
from pyalgotrade.feed import csvfeed
feed=csvfeed.Feed("Date","%Y.%M.%d %H:%m:%S")
feed.addValuesFromCSV('/Users/emacsen/Duka_Data/EURUSD_UTC_1 Min_Bid_2005.01.01_2015.10.05.csv')
and an error turned out to be :
dateTime = datetime.datetime.strptime(csvRowDict[self.__dateTimeColumn], self.__dateTimeFormat) KeyError: 'Date'
if I use formatting style "Date","%Y.%m.%d %H:%M:%S" ,same error:
feed=csvfeed.Feed("Date","%Y.%m.%d %H:%M:%S")
feed.addValuesFromCSV('/Users/emacsen/Duka_Data/EURUSD_UTC_1 Min_Bid_2005.01.01_2015.10.05.csv')
Traceback (most recent call last):
File "", line 1, in
File "/Users/emacsen/anaconda/envs/py2.7/lib/python2.7/site-packages/pyalgotrade/feed/csvfeed.py", line 171, in addValuesFromCSV return BaseFeed.addValuesFromCSV(self, path)
File "/Users/emacsen/anaconda/envs/py2.7/lib/python2.7/site-packages/pyalgotrade/feed/csvfeed.py", line 90, in addValuesFromCSV dateTime, rowValues = self.__rowParser.parseRow(row)
File "/Users/emacsen/anaconda/envs/py2.7/lib/python2.7/site-packages/pyalgotrade/feed/csvfeed.py", line 108, in parseRow dateTime = datetime.datetime.strptime(csvRowDict[self.__dateTimeColumn], self.__dateTimeFormat) KeyError: 'Date'
if I use pandas.read_csv() instead,it can be well read , so what is wrong with my Date formatting?
the csv file is formatted
Time,Open,High,Low,Close,Volume
2005.01.02 22:00:00,1.35464,1.3548,1.35464,1.3548,152.2
2005.01.02 22:01:00,1.35485,1.35489,1.35464,1.35479,409.1
2005.01.02 22:02:00,1.35492,1.35492,1.3547,1.3547,687.5
2005.01.02 22:03:00,1.35493,1.35501,1.35469,1.35486,604
2005.01.02 22:04:00,1.35485,1.35507,1.35478,1.3548,541.5
the last column is traded volume of EUR/USD
and by the way, how does pyalgotrade go along with pandas? can i use pandas to read a csv file and transfer that to pyalgotrade?