basana.backtesting.liquidity

Liquidity strategies are used by the backtesting exchange to determine:

  • How much of a bar’s volume can be consumed by an order.

  • The price slippage.

class basana.backtesting.liquidity.InfiniteLiquidity

This class models infinite liquidity with no price impact.

class basana.backtesting.liquidity.VolumeShareImpact(volume_limit_pct=Decimal('25'), price_impact=Decimal('10'))

The price impact is calculated by multiplying the price impact constant by the square of the ratio of the used volume to the total volume.

Parameters:
  • volume_limit_pct (Decimal) – Maximum percentage of volume that can be used from each bar.

  • price_impact (Decimal) – Maximum price impact (percentage).