mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-08 23:25:20 +08:00
MAINT: Removes mutable default method args
Also removes accidental modifications to Jenkins
This commit is contained in:
-20
@@ -21,26 +21,6 @@ install:
|
||||
- conda install --yes -c https://conda.binstar.org/Quantopian numpy=$NUMPY_VERSION pandas=$PANDAS_VERSION scipy==$SCIPY_VERSION matplotlib Cython patsy statsmodels tornado pyparsing xlrd mock pytz requests six dateutil ta-lib logbook
|
||||
- pip install --upgrade pip nose-timer coverage
|
||||
- pip install -e .[dev]
|
||||
- grep bottleneck== etc/requirements.txt | xargs pip install
|
||||
- grep cyordereddict== etc/requirements.txt | xargs pip install
|
||||
- grep contextlib2== etc/requirements.txt | xargs pip install
|
||||
- grep click== etc/requirements.txt | xargs pip install
|
||||
- grep networkx== etc/requirements.txt | xargs pip install
|
||||
- grep numexpr== etc/requirements.txt | xargs pip install
|
||||
- grep bcolz== etc/requirements.txt | xargs pip install
|
||||
- grep toolz== etc/requirements.txt | xargs pip install
|
||||
- grep sqlalchemy== etc/requirements.txt | xargs pip install
|
||||
- grep pyflakes== etc/requirements_dev.txt | xargs pip install
|
||||
- grep pep8== etc/requirements_dev.txt | xargs pip install
|
||||
- grep mccabe== etc/requirements_dev.txt | xargs pip install
|
||||
- grep flake8== etc/requirements_dev.txt | xargs pip install
|
||||
- grep nose== etc/requirements_dev.txt | xargs pip install --upgrade --force-reinstall
|
||||
- grep nose-parameterized== etc/requirements_dev.txt | xargs pip install
|
||||
- grep nose-ignore-docstring== etc/requirements_dev.txt | xargs pip install
|
||||
- grep testfixtures== etc/requirements_dev.txt | xargs pip install
|
||||
- pip install coveralls
|
||||
- pip install nose-timer
|
||||
- python setup.py build_ext --inplace
|
||||
before_script:
|
||||
- "flake8 zipline tests"
|
||||
script:
|
||||
|
||||
@@ -50,14 +50,14 @@ class BaseFFCTestCase(TestCase):
|
||||
self.__assets = assets = Int64Index(arange(1, 20))
|
||||
|
||||
# Set up env for test
|
||||
self.__env = TradingEnvironment()
|
||||
self.__env.write_data(
|
||||
env = TradingEnvironment()
|
||||
env.write_data(
|
||||
equities_df=make_simple_asset_info(
|
||||
assets,
|
||||
self.__calendar[0],
|
||||
self.__calendar[-1],
|
||||
))
|
||||
self.__finder = self.__env.asset_finder
|
||||
self.__finder = env.asset_finder
|
||||
self.__mask = self.__finder.lifetimes(self.__calendar[-10:])
|
||||
|
||||
@property
|
||||
|
||||
@@ -493,12 +493,28 @@ class AssetDBWriterFromList(AssetDBWriter):
|
||||
Class used to write list data to SQLite database.
|
||||
"""
|
||||
|
||||
def __init__(self, equities=[], futures=[], exchanges=[], root_symbols=[]):
|
||||
def __init__(self, equities=None, futures=None, exchanges=None,
|
||||
root_symbols=None):
|
||||
|
||||
self._equities = equities
|
||||
self._futures = futures
|
||||
self._exchanges = exchanges
|
||||
self._root_symbols = root_symbols
|
||||
if equities is not None:
|
||||
self._equities = equities
|
||||
else:
|
||||
self._equities = []
|
||||
|
||||
if futures is not None:
|
||||
self._futures = futures
|
||||
else:
|
||||
self._futures = []
|
||||
|
||||
if exchanges is not None:
|
||||
self._exchanges = exchanges
|
||||
else:
|
||||
self._exchanges = []
|
||||
|
||||
if root_symbols is not None:
|
||||
self._root_symbols = root_symbols
|
||||
else:
|
||||
self._root_symbols = []
|
||||
|
||||
def _load_data(self):
|
||||
|
||||
@@ -572,12 +588,28 @@ class AssetDBWriterFromDictionary(AssetDBWriter):
|
||||
{id_0: {attribute_1 : ...}, id_1: {attribute_2: ...}, ...}
|
||||
"""
|
||||
|
||||
def __init__(self, equities={}, futures={}, exchanges={}, root_symbols={}):
|
||||
def __init__(self, equities=None, futures=None, exchanges=None,
|
||||
root_symbols=None):
|
||||
|
||||
self._equities = equities
|
||||
self._futures = futures
|
||||
self._exchanges = exchanges
|
||||
self._root_symbols = root_symbols
|
||||
if equities is not None:
|
||||
self._equities = equities
|
||||
else:
|
||||
self._equities = {}
|
||||
|
||||
if futures is not None:
|
||||
self._futures = futures
|
||||
else:
|
||||
self._futures = {}
|
||||
|
||||
if exchanges is not None:
|
||||
self._exchanges = exchanges
|
||||
else:
|
||||
self._exchanges = {}
|
||||
|
||||
if root_symbols is not None:
|
||||
self._root_symbols = root_symbols
|
||||
else:
|
||||
self._root_symbols = {}
|
||||
|
||||
def _load_data(self):
|
||||
|
||||
@@ -598,13 +630,28 @@ class AssetDBWriterFromDataFrame(AssetDBWriter):
|
||||
Class used to write pandas.DataFrame data to SQLite database.
|
||||
"""
|
||||
|
||||
def __init__(self, equities=pd.DataFrame(), futures=pd.DataFrame(),
|
||||
exchanges=pd.DataFrame(), root_symbols=pd.DataFrame()):
|
||||
def __init__(self, equities=None, futures=None, exchanges=None,
|
||||
root_symbols=None):
|
||||
|
||||
self._equities = equities
|
||||
self._futures = futures
|
||||
self._exchanges = exchanges
|
||||
self._root_symbols = root_symbols
|
||||
if equities is not None:
|
||||
self._equities = equities
|
||||
else:
|
||||
self._equities = pd.DataFrame()
|
||||
|
||||
if futures is not None:
|
||||
self._futures = futures
|
||||
else:
|
||||
self._futures = pd.DataFrame()
|
||||
|
||||
if exchanges is not None:
|
||||
self._exchanges = exchanges
|
||||
else:
|
||||
self._exchanges = pd.DataFrame()
|
||||
|
||||
if root_symbols is not None:
|
||||
self._root_symbols = root_symbols
|
||||
else:
|
||||
self._root_symbols = pd.DataFrame()
|
||||
|
||||
def _load_data(self):
|
||||
|
||||
|
||||
+22
-26
@@ -119,18 +119,18 @@ class TradingEnvironment(object):
|
||||
|
||||
def write_data(self,
|
||||
engine=None,
|
||||
equities_data={},
|
||||
futures_data={},
|
||||
exchanges_data={},
|
||||
root_symbols_data={},
|
||||
equities_df=pd.DataFrame(),
|
||||
futures_df=pd.DataFrame(),
|
||||
exchanges_df=pd.DataFrame(),
|
||||
root_symbols_df=pd.DataFrame(),
|
||||
equities_identifiers=[],
|
||||
futures_identifiers=[],
|
||||
exchanges_identifiers=[],
|
||||
root_symbols_identifiers=[],
|
||||
equities_data=None,
|
||||
futures_data=None,
|
||||
exchanges_data=None,
|
||||
root_symbols_data=None,
|
||||
equities_df=None,
|
||||
futures_df=None,
|
||||
exchanges_df=None,
|
||||
root_symbols_df=None,
|
||||
equities_identifiers=None,
|
||||
futures_identifiers=None,
|
||||
exchanges_identifiers=None,
|
||||
root_symbols_identifiers=None,
|
||||
allow_sid_assignment=True):
|
||||
""" Write the supplied data to the database.
|
||||
|
||||
@@ -166,13 +166,13 @@ class TradingEnvironment(object):
|
||||
|
||||
# If any pandas.DataFrame data has been provided,
|
||||
# write it to the database.
|
||||
if not(equities_df.empty and futures_df.empty and
|
||||
exchanges_df.empty and root_symbols_df.empty):
|
||||
if (equities_df is not None or futures_df is not None or
|
||||
exchanges_df is not None or root_symbols_df is not None):
|
||||
self._write_data_dataframes(equities_df, futures_df,
|
||||
exchanges_df, root_symbols_df)
|
||||
|
||||
if (equities_data or futures_data or exchanges_data or
|
||||
root_symbols_data):
|
||||
if (equities_data is not None or futures_data is not None or
|
||||
exchanges_data is not None or root_symbols_data is not None):
|
||||
self._write_data_dicts(equities_data, futures_data,
|
||||
exchanges_data, root_symbols_data)
|
||||
|
||||
@@ -184,22 +184,18 @@ class TradingEnvironment(object):
|
||||
root_symbols_identifiers,
|
||||
allow_sid_assignment=allow_sid_assignment)
|
||||
|
||||
def _write_data_lists(self, equities=[], futures=[],
|
||||
exchanges=[], root_symbols=[],
|
||||
allow_sid_assignment=True):
|
||||
def _write_data_lists(self, equities=None, futures=None, exchanges=None,
|
||||
root_symbols=None, allow_sid_assignment=True):
|
||||
AssetDBWriterFromList(equities, futures, exchanges, root_symbols)\
|
||||
.write_all(self.engine, allow_sid_assignment=allow_sid_assignment)
|
||||
|
||||
def _write_data_dicts(self, equities={}, futures={},
|
||||
exchanges={}, root_symbols={},
|
||||
allow_sid_assignment=True):
|
||||
def _write_data_dicts(self, equities=None, futures=None, exchanges=None,
|
||||
root_symbols=None, allow_sid_assignment=True):
|
||||
AssetDBWriterFromDictionary(equities, futures, exchanges, root_symbols)\
|
||||
.write_all(self.engine)
|
||||
|
||||
def _write_data_dataframes(self, equities=pd.DataFrame(),
|
||||
futures=pd.DataFrame(),
|
||||
exchanges=pd.DataFrame(),
|
||||
root_symbols=pd.DataFrame()):
|
||||
def _write_data_dataframes(self, equities=None, futures=None,
|
||||
exchanges=None, root_symbols=None):
|
||||
AssetDBWriterFromDataFrame(equities, futures, exchanges, root_symbols)\
|
||||
.write_all(self.engine)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user