INNER CODE UNIT · Python

_apply_execution_config_trading_costs

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

def _apply_execution_config_trading_costs(portfolio_configurations, study):
    """Attach ``study.execution_config.trading_costs`` (the backtest-
    side replacement for the removed per-strategy ``trading_costs``)
    onto every given ``PortfolioConfiguration``, so the event-driven
    engine resolves per-symbol costs the same way the vector engine
    does (which derives its own ``PortfolioConfiguration`` from
    ``study`` directly inside ``BacktestService.run_vector_backtests``).
    No-op when the Study doesn't specify any trading costs — an
    already-registered ``PortfolioConfiguration``'s own
    ``trading_costs`` (if any) is left untouched in that case.
    """
    if study is None or study.execution_config is None:
        return
    trading_costs = study.execution_config.get_trading_costs()
    if not trading_costs:
        return
    for portfolio_configuration in portfolio_configurations:
        portfolio_configuration.trading_costs = trading_costs

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…