pybroker.slippage module
Implements slippage models.
-
class RandomSlippageModel(min_pct: float, max_pct: float)[source]
Bases: SlippageModel
Implements a simple random slippage model.
- Parameters:
-
-
apply_slippage(ctx: ExecContext, buy_shares: Decimal | None = None, sell_shares: Decimal | None = None)[source]
Applies slippage to ctx
.
-
class SlippageModel[source]
Bases: ABC
Base class for implementing a slippage model.
-
abstract apply_slippage(ctx: ExecContext, buy_shares: Decimal | None = None, sell_shares: Decimal | None = None)[source]
Applies slippage to ctx
.