DefaultMarginCallModel
QuantConnect.Securities.DefaultMarginCallModel
DefaultMarginCallModel(
portfolio: SecurityPortfolioManager,
default_order_properties: IOrderProperties,
margin_buffer: float = 0.1,
)
Bases: Object, IMarginCallModel
Represents the model responsible for picking which orders should be executed during a margin call
Initializes a new instance of the DefaultMarginCallModel class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
portfolio
|
SecurityPortfolioManager
|
The portfolio object to receive margin calls |
required |
default_order_properties
|
IOrderProperties
|
The default order properties to be used in margin call orders |
required |
margin_buffer
|
float
|
The percent margin buffer to use when checking whether the total margin used is above the total portfolio value to generate margin call orders |
0.1
|
portfolio
portfolio: SecurityPortfolioManager
Gets the portfolio that margin calls will be transacted against
This codeEntityType is protected.
default_order_properties
default_order_properties: IOrderProperties
Gets the default order properties to be used in margin call orders
This codeEntityType is protected.
execute_margin_call
execute_margin_call(
generated_margin_call_orders: List[SubmitOrderRequest],
) -> List[OrderTicket]
Executes synchronous orders to bring the account within margin requirements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
generated_margin_call_orders
|
List[SubmitOrderRequest]
|
These are the margin call orders that were generated by individual security margin models. |
required |
Returns:
| Type | Description |
|---|---|
List[OrderTicket]
|
The list of orders that were actually executed. |
generate_margin_call_orders
generate_margin_call_orders(
parameters: MarginCallOrdersParameters,
) -> Iterable[SubmitOrderRequest]
Generates a new order for the specified security taking into account the total margin used by the account. Returns null when no margin call is to be issued.
This codeEntityType is protected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
MarginCallOrdersParameters
|
The set of parameters required to generate the margin call orders |
required |
Returns:
| Type | Description |
|---|---|
Iterable[SubmitOrderRequest]
|
An order object representing a liquidation order to be executed to bring the account within margin requirements. |
get_margin_call_orders
get_margin_call_orders(
issue_margin_call_warning: Optional[bool],
) -> Tuple[List[SubmitOrderRequest], bool]
Scan the portfolio and the updated data for a potential margin call situation which may get the holdings below zero! If there is a margin call, liquidate the portfolio immediately before the portfolio gets sub zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
issue_margin_call_warning
|
Optional[bool]
|
Set to true if a warning should be issued to the algorithm |
required |
Returns:
| Type | Description |
|---|---|
Tuple[List[SubmitOrderRequest], bool]
|
True for a margin call on the holdings. |