FixedPortfolioPercentagePositionSizer

class qf_lib.backtesting.position_sizer.fixed_portfolio_percentage_position_sizer.FixedPortfolioPercentagePositionSizer(broker: Broker, data_provider: DataProvider, order_factory: OrderFactory, signals_register: SignalsRegister, fixed_percentage: float, tolerance_percentage: float = 0.0)[source]

Bases: PositionSizer

This PositionSizer converts signals to orders using Fixed Percentage value. Each signal will be sized based on that percentage of the portfolio.

Parameters:
  • broker (Broker) –

  • data_provider (DataProvider) –

  • order_factory (OrderFactory) –

  • fixed_percentage (float) – should be set once for all signals. It corresponds to the fraction of a portfolio that we are investing in every asset on single trade. For example: fixed_percentage = 0.2, means that we are investing 20% of portfolio to any signal that is long or short.

  • tolerance_percentage (float) – used by OrderFactory