INNER CODE UNIT · Python

_build_default_portfolio_configuration_from_study

coding-kitties/investing-algorithm-framework · investing_algorithm_framework/app/app.py:95

def _build_default_portfolio_configuration_from_study(study):
    """Build a ``PortfolioConfiguration`` from ``study.universe`` /
    ``study.initial_capital``, mirroring what a user would otherwise
    have to configure manually via ``app.add_market()``. Returns
    ``None`` when the Study doesn't fully specify a universe (market +
    trading_symbol) and an initial capital, in which case callers
    should fall back to any already-registered portfolio configuration.

    Shared by both the vector and event-driven branches of
    ``App.run_backtest()`` so a single ``Study`` behaves identically
    regardless of which engine is selected.
    """
    universe = study.universe if study is not None else None
    if (
        universe is not None
        and study.initial_capital is not None
        and universe.market is not None
        and universe.trading_symbol is not None

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…