Skip to content

PositionGroupBuyingPowerModelExtensions

QuantConnect.Securities.Positions.PositionGroupBuyingPowerModelExtensions

Bases: Object

Provides methods aimed at reducing the noise introduced from having result/parameter types for each method. These methods aim to accept raw arguments and return the desired value type directly.

get_initial_margin_required_for_order

get_initial_margin_required_for_order(
    model: IPositionGroupBuyingPowerModel,
    portfolio: SecurityPortfolioManager,
    position_group: IPositionGroup,
    order: Order,
) -> float

Gets the total margin required to execute the specified order in units of the account currency including fees

get_initial_margin_requirement

get_initial_margin_requirement(
    model: IPositionGroupBuyingPowerModel,
    portfolio: SecurityPortfolioManager,
    position_group: IPositionGroup,
) -> float

The margin that must be held in order to change positions by the changes defined by the provided position group

get_maintenance_margin

get_maintenance_margin(
    model: IPositionGroupBuyingPowerModel,
    portfolio: SecurityPortfolioManager,
    position_group: IPositionGroup,
) -> float

Gets the margin currently allocated to the specified position group

get_position_group_buying_power

get_position_group_buying_power(
    model: IPositionGroupBuyingPowerModel,
    portfolio: SecurityPortfolioManager,
    position_group: IPositionGroup,
    direction: OrderDirection,
) -> PositionGroupBuyingPower

Gets the buying power available for a position group trade

get_reserved_buying_power_for_position_group

get_reserved_buying_power_for_position_group(
    model: IPositionGroupBuyingPowerModel,
    portfolio: SecurityPortfolioManager,
    position_group: IPositionGroup,
) -> float

Computes the amount of buying power reserved by the provided position group

has_sufficient_buying_power_for_order

has_sufficient_buying_power_for_order(
    model: IPositionGroupBuyingPowerModel,
    portfolio: SecurityPortfolioManager,
    position_group: IPositionGroup,
    orders: List[Order],
) -> HasSufficientBuyingPowerForOrderResult

Check if there is sufficient buying power for the position group to execute this order.