Lean
$LEAN_TAG$
|
Represents the model responsible for picking which orders should be executed during a margin call More...
Public Member Functions | |
DefaultMarginCallModel (SecurityPortfolioManager portfolio, IOrderProperties defaultOrderProperties, decimal marginBuffer=0.10m) | |
Initializes a new instance of the DefaultMarginCallModel class More... | |
List< SubmitOrderRequest > | GetMarginCallOrders (out bool issueMarginCallWarning) |
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. More... | |
virtual List< OrderTicket > | ExecuteMarginCall (IEnumerable< SubmitOrderRequest > generatedMarginCallOrders) |
Executes synchronous orders to bring the account within margin requirements. More... | |
Protected Member Functions | |
virtual IEnumerable< SubmitOrderRequest > | GenerateMarginCallOrders (MarginCallOrdersParameters parameters) |
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. More... | |
Properties | |
SecurityPortfolioManager | Portfolio [get] |
Gets the portfolio that margin calls will be transacted against More... | |
IOrderProperties | DefaultOrderProperties [get] |
Gets the default order properties to be used in margin call orders More... | |
Represents the model responsible for picking which orders should be executed during a margin call
This is a default implementation that orders the generated margin call orders by the unrealized profit (losers first) and executes each order synchronously until we're within the margin requirements
Definition at line 33 of file DefaultMarginCallModel.cs.
QuantConnect.Securities.DefaultMarginCallModel.DefaultMarginCallModel | ( | SecurityPortfolioManager | portfolio, |
IOrderProperties | defaultOrderProperties, | ||
decimal | marginBuffer = 0.10m |
||
) |
Initializes a new instance of the DefaultMarginCallModel class
portfolio | The portfolio object to receive margin calls |
defaultOrderProperties | The default order properties to be used in margin call orders |
marginBuffer | The percent margin buffer to use when checking whether the total margin used is above the total portfolio value to generate margin call orders |
Definition at line 60 of file DefaultMarginCallModel.cs.
List<SubmitOrderRequest> QuantConnect.Securities.DefaultMarginCallModel.GetMarginCallOrders | ( | out bool | issueMarginCallWarning | ) |
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.
issueMarginCallWarning | Set to true if a warning should be issued to the algorithm |
Implements QuantConnect.Securities.IMarginCallModel.
Definition at line 73 of file DefaultMarginCallModel.cs.
|
protectedvirtual |
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.
parameters | The set of parameters required to generate the margin call orders |
Definition at line 125 of file DefaultMarginCallModel.cs.
|
virtual |
Executes synchronous orders to bring the account within margin requirements.
generatedMarginCallOrders | These are the margin call orders that were generated by individual security margin models. |
Implements QuantConnect.Securities.IMarginCallModel.
Definition at line 187 of file DefaultMarginCallModel.cs.
|
getprotected |
Gets the portfolio that margin calls will be transacted against
Definition at line 44 of file DefaultMarginCallModel.cs.
|
getprotected |
Gets the default order properties to be used in margin call orders
Definition at line 49 of file DefaultMarginCallModel.cs.