NotImplementedError()这是什么意思,事件探查器pyalgotrad

2024-06-16 16:17:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在运行pyalgotrade的事件探查器。我使用的是自定义数据,当我使用默认的策略/谓词“BuyOnGap”运行它时,它可以工作;但是,当我尝试用一个简单的自定义策略运行它时,它会抛出错误:

Traceback (most recent call last):
  File "C:\Users\David\Desktop\Python\Coursera\Computational Finance\Week2\PyAlgoTrade\Bitfinex\FCT\FCT_single_event_test.py", line 43, in <module>
    main(True)
  File "C:\Users\David\Desktop\Python\Coursera\Computational Finance\Week2\PyAlgoTrade\Bitfinex\FCT\FCT_single_event_test.py", line 35, in main
    eventProfiler.run(feed, True)
  File "C:\Python27\lib\site-packages\pyalgotrade\eventprofiler.py", line 215, in run
    disp.run()
  File "C:\Python27\lib\site-packages\pyalgotrade\dispatcher.py", line 102, in run
    eof, eventsDispatched = self.__dispatch()
  File "C:\Python27\lib\site-packages\pyalgotrade\dispatcher.py", line 90, in __dispatch
    if self.__dispatchSubject(subject, smallestDateTime):
  File "C:\Python27\lib\site-packages\pyalgotrade\dispatcher.py", line 68, in __dispatchSubject
    ret = subject.dispatch() is True
  File "C:\Python27\lib\site-packages\pyalgotrade\feed\__init__.py", line 105, in dispatch
    self.__event.emit(dateTime, values)
  File "C:\Python27\lib\site-packages\pyalgotrade\observer.py", line 59, in emit
    handler(*args, **kwargs)
  File "C:\Python27\lib\site-packages\pyalgotrade\eventprofiler.py", line 172, in __onBars
    eventOccurred = self.__predicate.eventOccurred(instrument, self.__feed[instrument])
  File "C:\Python27\lib\site-packages\pyalgotrade\eventprofiler.py", line 89, in eventOccurred
    raise NotImplementedError()
NotImplementedError

我的代码是:

^{pr2}$

这个错误是什么意思?在

有人知道出了什么问题,怎么解决吗?在

以下是eventprofiler代码的链接:

http://pastebin.com/QD220VQb

作为奖励,有人知道我在哪里可以找到使用分析器的例子吗?pyalgotrade给出的其他示例,seen here


Tags: runinpyselfeventlibpackagesline