Multiple pipeline loaders and how to run tests

95 views
Skip to first unread message

Charles

unread,
May 10, 2017, 10:09:12 AM5/10/17
to Zipline Python Opensource Backtester
Hi,
I created a custom version of zipline.utils.run_algo.py which supports multiple pipeline loaders. This means that I am not restricted anymore to only using USEquityPricing columns in the pipeline. I tested it with various non-price quantities and it seems to work fine. The changes consist in i) adding a "loaders" argument to the run_algorithm and _run functions, where "loaders" is a dictionary of PipelineLoader objects, and 2) modify the choose_loader function in _run:

        def choose_loader(column):
            if column in USEquityPricing.columns:
                return pipeline_loader
            if column in loaders.keys():
                return loaders[column]
            raise ValueError(
                "No PipelineLoader registered for column %s." % column
            )

So far, I have used zipline 1.1.0 as an external library (installed using conda), with my custom run_algo_mutli_loaders.py invoking all necessary objects and functions from it. It all works fine. Now I am trying to properly open up zipline 1.1.0 as its own project in PyCharm on Windows, so I can keep my changes synced with new updates and run the test suite. I installed nose and nose-parameterized. I am unable to run the test suite, because of the following errors:
  •   File "Z:\git\PycharmProjects\zipline\zipline\__init__.py", line 25, in _
        tempfile.tempdir = tempdir = tempfile.mkdtemp()
      File "C:\Program Files\Anaconda2\envs\CondaEnvForZipline\lib\tempfile.py", line 339, in mkdtemp
        _os.mkdir(file, 0700)
    WindowsError: [Error 206] The filename or extension is too long: 
  • If I hack a bit to not use mkdtemp(), then I get a whole bunch of "ImportError: cannot import name treasuries". Then I remove the "from ." in "from . import treasuries, treasuries_can", and go on to the next issue
  • File "Z:\git\PycharmProjects\zipline\zipline\utils\calendars\trading_calendar.py", line 30, in <module>
        from zipline.utils.calendars._calendar_helpers import (
    ImportError: No module named _calendar_helpers
Clearly, there is something not right in my testing setup. Any directions would be appreciated.

Thanks,
C
Reply all
Reply to author
Forward
0 new messages