Запуск примера поддержки CSV в библиотеке pyalgotrade-python-3
Я пытаюсь запустить код из документации PyAlgoTrade 0.18 ( http://gbeced.github.io/pyalgotrade/docs/v0.18/html/feed.html):
from pyalgotrade.feed import csvfeed
feed = csvfeed.Feed("Date", "%Y-%m-%d")
feed.addValuesFromCSV("quandl_gold_2.csv")
for dateTime, value in feed:
print (dateTime, value)
но получаю ошибку:
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information.
================== RESTART: D:\New\Pyalgotrade\csvfeed_1.py ==================
Traceback (most recent call last):
File "D:\New\Pyalgotrade\csvfeed_1.py", line 6, in for dateTime, value in feed:
File "C:\Users\Ivanitskii\AppData\Local\Programs\Python\Python36\lib\site- packages\pyalgotrade\feed_init_.py", line 28, in feed_iterator feed.start()
File "C:\Users\Ivanitskii\AppData\Local\Programs\Python\Python36\lib\site-packages\pyalgotrade\feed\memfeed.py", line 40, in start self.__values.sort(cmpFun)
TypeError: must use keyword argument for key function
# line 40 - self.__values.sort(cmpFun) in this function^
def start(self):
super(MemFeed, self).start()
# Now that all the data is in place, sort it to dispatch it in order.
cmpFun = lambda x, y: list(cmp(x[0], y[0]))
self.__values.sort(cmpFun)
Кажется, это ошибка при адаптации Python 2 к 3. Что мне нужно сделать?