Ejemplo n.º 1
0
def temp_pipeline_engine(calendar, sids, random_seed, symbols=None):
    """
    A contextManager that yields a SimplePipelineEngine holding a reference to
    an AssetFinder generated via tmp_asset_finder.

    Parameters
    ----------
    calendar : pd.DatetimeIndex
        Calendar to pass to the constructed PipelineEngine.
    sids : iterable[int]
        Sids to use for the temp asset finder.
    random_seed : int
        Integer used to seed instances of SeededRandomLoader.
    symbols : iterable[str], optional
        Symbols for constructed assets. Forwarded to make_simple_equity_info.
    """
    equity_info = make_simple_equity_info(
        sids=sids,
        start_date=calendar[0],
        end_date=calendar[-1],
        symbols=symbols,
    )

    loader = make_seeded_random_loader(random_seed, calendar, sids)

    def get_loader(column):
        return loader

    with tmp_asset_finder(equities=equity_info) as finder:
        yield SimplePipelineEngine(get_loader, calendar, finder)
Ejemplo n.º 2
0
def temp_pipeline_engine(calendar, sids, random_seed, symbols=None):
    """
    A contextManager that yields a SimplePipelineEngine holding a reference to
    an AssetFinder generated via tmp_asset_finder.

    Parameters
    ----------
    calendar : pd.DatetimeIndex
        Calendar to pass to the constructed PipelineEngine.
    sids : iterable[int]
        Sids to use for the temp asset finder.
    random_seed : int
        Integer used to seed instances of SeededRandomLoader.
    symbols : iterable[str], optional
        Symbols for constructed assets. Forwarded to make_simple_equity_info.
    """
    equity_info = make_simple_equity_info(
        sids=sids,
        start_date=calendar[0],
        end_date=calendar[-1],
        symbols=symbols,
    )

    loader = make_seeded_random_loader(random_seed, calendar, sids)

    def get_loader(column):
        return loader

    with tmp_asset_finder(equities=equity_info) as finder:
        yield SimplePipelineEngine(get_loader, calendar, finder)
Ejemplo n.º 3
0
 def init_class_fixtures(cls):
     super(WithSeededRandomPipelineEngine, cls).init_class_fixtures()
     cls._sids = cls.asset_finder.sids
     cls.seeded_random_loader = loader = make_seeded_random_loader(
         cls.SEEDED_RANDOM_PIPELINE_SEED,
         cls.trading_days,
         cls._sids,
     )
     cls.seeded_random_engine = SimplePipelineEngine(
         get_loader=lambda column: loader,
         calendar=cls.trading_days,
         asset_finder=cls.asset_finder,
     )
Ejemplo n.º 4
0
 def init_class_fixtures(cls):
     super(WithSeededRandomPipelineEngine, cls).init_class_fixtures()
     cls._sids = cls.asset_finder.sids
     cls.seeded_random_loader = loader = make_seeded_random_loader(
         cls.SEEDED_RANDOM_PIPELINE_SEED,
         cls.trading_days,
         cls._sids,
     )
     cls.seeded_random_engine = SimplePipelineEngine(
         get_loader=lambda column: loader,
         calendar=cls.trading_days,
         asset_finder=cls.asset_finder,
     )