INNER CODE UNIT · Python
_apply_pair_to_parameters
jptsantossilva/BEC · bec/main.py:460
def _apply_pair_to_parameters(definition: dict, parameters: dict, first_value=0, second_value=0, *, overwrite: bool = True) -> dict:
first_name, second_name = _primary_parameter_pair_names(definition)
result = dict(parameters)
first = _safe_int_or_zero(first_value)
second = _safe_int_or_zero(second_value)
if first_name and first and (overwrite or first_name not in result):
result[first_name] = first
if second_name and second and (overwrite or second_name not in result):
result[second_name] = second
return result
def _backtesting_parameter_overrides(strategy_id: str, symbol: str, timeframe: str, definition: dict) -> tuple[dict, int, int]:
df = database.get_backtesting_results_by_symbol_timeframe_strategy(
symbol=symbol,
time_frame=timeframe,
strategy_id=strategy_id,
)