IBuyingPowerModel
QuantConnect.Securities.IBuyingPowerModel
Represents a security's model of buying power
get_buying_power
get_buying_power(
parameters: BuyingPowerParameters,
) -> BuyingPower
Gets the buying power available for a trade
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
BuyingPowerParameters
|
A parameters object containing the algorithm's portfolio, security, and order direction |
required |
Returns:
| Type | Description |
|---|---|
BuyingPower
|
The buying power available for the trade. |
get_initial_margin_required_for_order
get_initial_margin_required_for_order(
parameters: InitialMarginRequiredForOrderParameters,
) -> InitialMargin
Gets the total margin required to execute the specified order in units of the account currency including fees
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
InitialMarginRequiredForOrderParameters
|
An object containing the portfolio, the security and the order |
required |
Returns:
| Type | Description |
|---|---|
InitialMargin
|
The total margin in terms of the currency quoted in the order. |
get_initial_margin_requirement
get_initial_margin_requirement(
parameters: InitialMarginParameters,
) -> InitialMargin
The margin that must be held in order to increase the position by the provided quantity
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
InitialMarginParameters
|
An object containing the security and quantity |
required |
Returns:
| Type | Description |
|---|---|
InitialMargin
|
The initial margin required for the provided security and quantity. |
get_leverage
get_leverage(security: Security) -> float
Gets the current leverage of the security
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
security
|
Security
|
The security to get leverage for |
required |
Returns:
| Type | Description |
|---|---|
float
|
The current leverage in the security. |
get_maintenance_margin
get_maintenance_margin(
parameters: MaintenanceMarginParameters,
) -> MaintenanceMargin
Gets the margin currently allocated to the specified holding
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
MaintenanceMarginParameters
|
An object containing the security and holdings quantity/cost/value |
required |
Returns:
| Type | Description |
|---|---|
MaintenanceMargin
|
The maintenance margin required for the provided holdings quantity/cost/value. |
get_maximum_order_quantity_for_delta_buying_power
get_maximum_order_quantity_for_delta_buying_power(
parameters: GetMaximumOrderQuantityForDeltaBuyingPowerParameters,
) -> GetMaximumOrderQuantityResult
Get the maximum market order quantity to obtain a delta in the buying power used by a security. The deltas sign defines the position side to apply it to, positive long, negative short.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
GetMaximumOrderQuantityForDeltaBuyingPowerParameters
|
An object containing the portfolio, the security and the delta buying power |
required |
Returns:
| Type | Description |
|---|---|
GetMaximumOrderQuantityResult
|
Returns the maximum allowed market order quantity and if zero, also the reason. |
get_maximum_order_quantity_for_target_buying_power
get_maximum_order_quantity_for_target_buying_power(
parameters: GetMaximumOrderQuantityForTargetBuyingPowerParameters,
) -> GetMaximumOrderQuantityResult
Get the maximum market order quantity to obtain a position with a given buying power percentage. Will not take into account free buying power.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
GetMaximumOrderQuantityForTargetBuyingPowerParameters
|
An object containing the portfolio, the security and the target signed buying power percentage |
required |
Returns:
| Type | Description |
|---|---|
GetMaximumOrderQuantityResult
|
Returns the maximum allowed market order quantity and if zero, also the reason. |
get_reserved_buying_power_for_position
get_reserved_buying_power_for_position(
parameters: ReservedBuyingPowerForPositionParameters,
) -> ReservedBuyingPowerForPosition
Gets the amount of buying power reserved to maintain the specified position
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
ReservedBuyingPowerForPositionParameters
|
A parameters object containing the security |
required |
Returns:
| Type | Description |
|---|---|
ReservedBuyingPowerForPosition
|
The reserved buying power in account currency. |
has_sufficient_buying_power_for_order
has_sufficient_buying_power_for_order(
parameters: HasSufficientBuyingPowerForOrderParameters,
) -> HasSufficientBuyingPowerForOrderResult
Check if there is sufficient buying power to execute this order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
HasSufficientBuyingPowerForOrderParameters
|
An object containing the portfolio, the security and the order |
required |
Returns:
| Type | Description |
|---|---|
HasSufficientBuyingPowerForOrderResult
|
Returns buying power information for an order. |