InitialRiskPositionSizer(broker: qf_lib.backtesting.broker.broker.Broker, data_provider: qf_lib.data_providers.data_provider.DataProvider, order_factory: qf_lib.backtesting.order.order_factory.OrderFactory, signals_register: qf_lib.backtesting.signals.signals_register.SignalsRegister, initial_risk: float, max_target_percentage: float = None, tolerance_percentage: float = 0.0)[source]¶
This PositionSizer converts signals to orders using Initial Risk value that is predefined in the position sizer. Each signal will be sized based on fraction_at_risk. position size = Initial_Risk / signal.fraction_at_risk
broker (Broker) –
data_provider (DataProvider) –
order_factory (OrderFactory) –
initial_risk (float) – should be set once for all signals. It corresponds to the value that we are willing to lose on single trade. For example: initial_risk = 0.02, means that we are willing to lose 2% of portfolio value in single trade
max_target_percentage (float) – max leverage that is accepted by the position sizer. if None, no max_target_percentage is used.
tolerance_percentage (float) – percentage used by OrdersFactory target_percent_orders function; it defines tolerance to the target percentages