CostModel

Defined in fynance.core

class CostModel(*args, **kwargs)[source]

Bases: Protocol

Map a weight book to per-step transaction costs.

Concrete models live in fynance.backtest.cost. A model may also expose an optional components(weights) -> dict[str, NDArray] returning a per-step breakdown whose values sum to __call__ (e.g. transaction vs market_impact); the engine carries it through to the tearsheet’s cumulative-fees panel when present. It is not part of the required interface — only __call__ is.

__call__(weights)[source]

Return per-step costs aligned with the weight series.