mirror of
https://github.com/wassname/catalyst.git
synced 2026-09-09 11:19:23 +08:00
TST: Use fixture's data with tmp_trading_env
instead of env needing to download it
This commit is contained in:
@@ -859,6 +859,8 @@ class tmp_trading_env(tmp_asset_finder):
|
||||
|
||||
Parameters
|
||||
----------
|
||||
load : callable, optional
|
||||
Function that returns benchmark returns and treasury curves.
|
||||
finder_cls : type, optional
|
||||
The type of asset finder to create from the assets db.
|
||||
**frames
|
||||
@@ -869,8 +871,13 @@ class tmp_trading_env(tmp_asset_finder):
|
||||
empty_trading_env
|
||||
tmp_asset_finder
|
||||
"""
|
||||
def __init__(self, load=None, *args, **kwargs):
|
||||
super(tmp_trading_env, self).__init__(*args, **kwargs)
|
||||
self._load = load
|
||||
|
||||
def __enter__(self):
|
||||
return TradingEnvironment(
|
||||
load=self._load,
|
||||
asset_db_path=super(tmp_trading_env, self).__enter__().engine,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user