Skip to content

GetMaximumLotsForTargetBuyingPowerParameters

QuantConnect.Securities.Positions.GetMaximumLotsForTargetBuyingPowerParameters

GetMaximumLotsForTargetBuyingPowerParameters(
    portfolio: SecurityPortfolioManager,
    position_group: IPositionGroup,
    target_buying_power: float,
    minimum_order_margin_portfolio_percentage: float,
    silence_non_error_reasons: bool = False,
)

Bases: Object

Defines the parameters for IPositionGroupBuyingPowerModel.get_maximum_lots_for_target_buying_power

Initializes a new instance of the GetMaximumLotsForTargetBuyingPowerParameters class

Parameters:

Name Type Description Default
portfolio SecurityPortfolioManager

The algorithm's portfolio manager

required
position_group IPositionGroup

The position group

required
target_buying_power float

The target buying power

required
minimum_order_margin_portfolio_percentage float

Configurable minimum order margin portfolio percentage to ignore orders with unrealistic small sizes

required
silence_non_error_reasons bool

True will not return GetMaximumLotsResult.reason set for non error situation, this is for performance

False

portfolio

Gets the algorithm's portfolio manager

position_group

position_group: IPositionGroup

Gets the position group

target_buying_power

target_buying_power: float

The target buying power.

silence_non_error_reasons

silence_non_error_reasons: bool

True enables the IBuyingPowerModel to skip setting GetMaximumLotsResult.reason for non error situations, for performance

minimum_order_margin_portfolio_percentage

minimum_order_margin_portfolio_percentage: float

Configurable minimum order margin portfolio percentage to ignore bad orders, orders with unrealistic small sizes

zero

zero(reason: str) -> GetMaximumLotsResult

Signature descriptions:

  • Creates a new GetMaximumLotsResult with zero quantity and no message.

  • Creates a new GetMaximumLotsResult with zero quantity and an info message.

error

error(reason: str) -> GetMaximumLotsResult

Creates a new GetMaximumLotsResult with zero quantity and an error message.

result

result(quantity: float) -> GetMaximumLotsResult

Creates a new GetMaximumLotsResult for the specified quantity and no message.