如果我运行zipline -r -f zipline/examples/buyapple.py -s 2012 -e 2013
,一切都会正常
如果我运行python -m zipline -r -f zipline/examples/buyapple.py -s 2012 -e 2013
,我会得到ImportError: No module named zipline.data._adjustments
我在使用VSCode调试时注意到了这一点。
到目前为止的调试步骤:
__init__.py
PYTHONPATH=zipline/data python -m zipline -r -f zipline/examples/buyapple.py -s 2012 -e 2013
目录树:
(zipline04) computer@computer ~/Documents/zipline/zipline (master) $ tree -d
.
├── assets
├── data
│ ├── bundles
│ │ └── __pycache__
│ ├── fx
│ └── __pycache__
├── examples
├── finance
│ ├── blotter
│ ├── metrics
│ └── __pycache__
├── gens
│ └── __pycache__
├── lib
├── pipeline
│ ├── classifiers
│ ├── data
│ ├── factors
│ ├── filters
│ ├── hooks
│ └── loaders
│ └── blaze
├── __pycache__
├── resources
│ ├── market_data
│ └── security_lists
│ └── leveraged_etf_list
│ └── 20020103
│ ├── 20120913
├── sources
├── testing
└── utils
└── __pycache__
进口:
__init__py
from distutils.version import StrictVersion
import os
import numpy as np
# This is *not* a place to dump arbitrary classes/modules for convenience,
# it is a place to expose the public interfaces.
from trading_calendars import get_calendar
from . import data
from . import finance
from . import gens
from . import utils
from .utils.numpy_utils import numpy_version
from .utils.pandas_utils import new_pandas
from .utils.run_algo import run_algorithm
from ._version import get_versions
# These need to happen after the other imports.
from . algorithm import TradingAlgorithm
from . import api
from zipline import extensions as ext
from zipline.finance.blotter import Blotter
__main__.py
import errno
import os
import click
import logbook
import pandas as pd
from six import text_type
import zipline
from zipline.data import bundles as bundles_module
from trading_calendars import get_calendar
from zipline.utils.compat import wraps
from zipline.utils.cli import Date, Timestamp
from zipline.utils.run_algo import _run, load_extensions
from zipline.extensions import create_args
try:
__IPYTHON__
except NameError:
__IPYTHON__ = False