warren-oneill / powerline

Extension to the zipline library for the German EPEX and EEX energy markets
Other
7 stars 1 forks source link

Error in eex algo tests when instant_fill=False #50

Closed warren-oneill closed 8 years ago

warren-oneill commented 8 years ago
======================================================================
ERROR: test suite for <class 'tests.test_algos_eex.TestEexAlgo'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dev/envs/pow-new/lib/python3.4/site-packages/nose/suite.py", line 210, in run
    self.setUp()
  File "/home/dev/envs/pow-new/lib/python3.4/site-packages/nose/suite.py", line 293, in setUp
    self.setupContext(ancestor)
  File "/home/dev/envs/pow-new/lib/python3.4/site-packages/nose/suite.py", line 316, in setupContext
    try_run(context, names)
  File "/home/dev/envs/pow-new/lib/python3.4/site-packages/nose/util.py", line 471, in try_run
    return func()
  File "/home/dev/repos/powerline/master/tests/test_algos_eex.py", line 45, in setUpClass
    cls.results = cls.algo.run(cls.data)
  File "/home/dev/envs/pow-new/src/zipline/zipline/algorithm.py", line 585, in run
    for perf in self.gen:
  File "/home/dev/envs/pow-new/src/zipline/zipline/gens/tradesimulation.py", line 121, in transform
    self.algo.instant_fill,
  File "/home/dev/envs/pow-new/src/zipline/zipline/gens/tradesimulation.py", line 282, in _process_snapshot
    perf_process_trade(trade)
  File "/home/dev/envs/pow-new/src/zipline/zipline/finance/performance/tracker.py", line 293, in process_trade
    cash_adjustment = self.position_tracker.update_last_sale(event)
  File "/home/dev/envs/pow-new/src/zipline/zipline/finance/performance/position_tracker.py", line 275, in update_last_sale
    * pos.amount)
KeyError: 0
dhexus commented 8 years ago

Fixed

warren-oneill commented 8 years ago

@dhexus how did you fix it? Would be great if you could reference the relevant commits in the future.