Lean  $LEAN_TAG$
QuantConnect.Securities.Future.FutureMarginModel Class Reference

Represents a simple margin model for margin futures. Margin file contains Initial and Maintenance margins More...

Inheritance diagram for QuantConnect.Securities.Future.FutureMarginModel:
[legend]

Public Member Functions

 FutureMarginModel (decimal requiredFreeBuyingPowerPercent=0, Security security=null)
 Initializes a new instance of the FutureMarginModel More...
 
override decimal GetLeverage (Security security)
 Gets the current leverage of the security More...
 
override void SetLeverage (Security security, decimal leverage)
 Sets the leverage for the applicable securities, i.e, futures More...
 
override GetMaximumOrderQuantityResult GetMaximumOrderQuantityForTargetBuyingPower (GetMaximumOrderQuantityForTargetBuyingPowerParameters parameters)
 Get the maximum market order quantity to obtain a position with a given buying power percentage. Will not take into account free buying power. More...
 
override InitialMargin GetInitialMarginRequiredForOrder (InitialMarginRequiredForOrderParameters parameters)
 Gets the total margin required to execute the specified order in units of the account currency including fees More...
 
override MaintenanceMargin GetMaintenanceMargin (MaintenanceMarginParameters parameters)
 Gets the margin currently allotted to the specified holding More...
 
override InitialMargin GetInitialMarginRequirement (InitialMarginParameters parameters)
 The margin that must be held in order to increase the position by the provided quantity More...
 
- Public Member Functions inherited from QuantConnect.Securities.SecurityMarginModel
 SecurityMarginModel ()
 Initializes a new instance of the SecurityMarginModel with no leverage (1x) More...
 
 SecurityMarginModel (decimal initialMarginRequirement, decimal maintenanceMarginRequirement, decimal requiredFreeBuyingPowerPercent)
 Initializes a new instance of the SecurityMarginModel More...
 
 SecurityMarginModel (decimal leverage, decimal requiredFreeBuyingPowerPercent=0)
 Initializes a new instance of the SecurityMarginModel More...
 
- Public Member Functions inherited from QuantConnect.Securities.BuyingPowerModel
 BuyingPowerModel ()
 Initializes a new instance of the BuyingPowerModel with no leverage (1x) More...
 
 BuyingPowerModel (decimal initialMarginRequirement, decimal maintenanceMarginRequirement, decimal requiredFreeBuyingPowerPercent)
 Initializes a new instance of the BuyingPowerModel More...
 
 BuyingPowerModel (decimal leverage, decimal requiredFreeBuyingPowerPercent=0)
 Initializes a new instance of the BuyingPowerModel More...
 
virtual HasSufficientBuyingPowerForOrderResult HasSufficientBuyingPowerForOrder (HasSufficientBuyingPowerForOrderParameters parameters)
 Check if there is sufficient buying power to execute this order. More...
 
virtual GetMaximumOrderQuantityResult GetMaximumOrderQuantityForDeltaBuyingPower (GetMaximumOrderQuantityForDeltaBuyingPowerParameters parameters)
 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. More...
 
decimal GetAmountToOrder ([NotNull]Security security, decimal targetMargin, decimal marginForOneUnit, out decimal finalMargin)
 Helper function that determines the amount to order to get to a given target safely. Meaning it will either be at or just below target always. More...
 
virtual ReservedBuyingPowerForPosition GetReservedBuyingPowerForPosition (ReservedBuyingPowerForPositionParameters parameters)
 Gets the amount of buying power reserved to maintain the specified position More...
 
virtual BuyingPower GetBuyingPower (BuyingPowerParameters parameters)
 Gets the buying power available for a trade More...
 

Public Attributes

virtual decimal InitialOvernightMarginRequirement => GetCurrentMarginRequirements(_security)?.InitialOvernight ?? 0m
 Initial Overnight margin requirement for the contract effective from the date of change More...
 
virtual decimal MaintenanceOvernightMarginRequirement => GetCurrentMarginRequirements(_security)?.MaintenanceOvernight ?? 0m
 Maintenance Overnight margin requirement for the contract effective from the date of change More...
 
virtual decimal InitialIntradayMarginRequirement => GetCurrentMarginRequirements(_security)?.InitialIntraday ?? 0m
 Initial Intraday margin for the contract effective from the date of change More...
 
virtual decimal MaintenanceIntradayMarginRequirement => GetCurrentMarginRequirements(_security)?.MaintenanceIntraday ?? 0m
 Maintenance Intraday margin requirement for the contract effective from the date of change More...
 

Properties

bool EnableIntradayMargins [get, set]
 True will enable usage of intraday margins. More...
 
- Properties inherited from QuantConnect.Securities.BuyingPowerModel
decimal RequiredFreeBuyingPowerPercent [get, set]
 The percentage used to determine the required unused buying power for the account. More...
 

Additional Inherited Members

- Static Public Attributes inherited from QuantConnect.Securities.BuyingPowerModel
static readonly IBuyingPowerModel Null = new NullBuyingPowerModel()
 Gets an implementation of IBuyingPowerModel that does not check for sufficient buying power More...
 
- Protected Member Functions inherited from QuantConnect.Securities.BuyingPowerModel
virtual decimal GetMarginRemaining (SecurityPortfolioManager portfolio, Security security, OrderDirection direction)
 Gets the margin cash available for a trade More...
 

Detailed Description

Represents a simple margin model for margin futures. Margin file contains Initial and Maintenance margins

Definition at line 32 of file FutureMarginModel.cs.

Constructor & Destructor Documentation

◆ FutureMarginModel()

QuantConnect.Securities.Future.FutureMarginModel.FutureMarginModel ( decimal  requiredFreeBuyingPowerPercent = 0,
Security  security = null 
)

Initializes a new instance of the FutureMarginModel

Parameters
requiredFreeBuyingPowerPercentThe percentage used to determine the required unused buying power for the account.
securityThe security that this model belongs to

Definition at line 75 of file FutureMarginModel.cs.

Member Function Documentation

◆ GetLeverage()

override decimal QuantConnect.Securities.Future.FutureMarginModel.GetLeverage ( Security  security)
virtual

Gets the current leverage of the security

Parameters
securityThe security to get leverage for
Returns
The current leverage in the security

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 86 of file FutureMarginModel.cs.

◆ SetLeverage()

override void QuantConnect.Securities.Future.FutureMarginModel.SetLeverage ( Security  security,
decimal  leverage 
)
virtual

Sets the leverage for the applicable securities, i.e, futures

This is added to maintain backwards compatibility with the old margin/leverage system

Parameters
security
leverageThe new leverage

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 99 of file FutureMarginModel.cs.

◆ GetMaximumOrderQuantityForTargetBuyingPower()

override GetMaximumOrderQuantityResult QuantConnect.Securities.Future.FutureMarginModel.GetMaximumOrderQuantityForTargetBuyingPower ( GetMaximumOrderQuantityForTargetBuyingPowerParameters  parameters)
virtual

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
parametersAn object containing the portfolio, the security and the target signed buying power percentage
Returns
Returns the maximum allowed market order quantity and if zero, also the reason

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 111 of file FutureMarginModel.cs.

◆ GetInitialMarginRequiredForOrder()

override InitialMargin QuantConnect.Securities.Future.FutureMarginModel.GetInitialMarginRequiredForOrder ( InitialMarginRequiredForOrderParameters  parameters)
virtual

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

Parameters
parametersAn object containing the portfolio, the security and the order
Returns
The total margin in terms of the currency quoted in the order

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 128 of file FutureMarginModel.cs.

Here is the call graph for this function:

◆ GetMaintenanceMargin()

override MaintenanceMargin QuantConnect.Securities.Future.FutureMarginModel.GetMaintenanceMargin ( MaintenanceMarginParameters  parameters)
virtual

Gets the margin currently allotted to the specified holding

Parameters
parametersAn object containing the security
Returns
The maintenance margin required for the

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Reimplemented in QuantConnect.Securities.Option.FuturesOptionsMarginModel.

Definition at line 151 of file FutureMarginModel.cs.

◆ GetInitialMarginRequirement()

override InitialMargin QuantConnect.Securities.Future.FutureMarginModel.GetInitialMarginRequirement ( InitialMarginParameters  parameters)
virtual

The margin that must be held in order to increase the position by the provided quantity

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Reimplemented in QuantConnect.Securities.Option.FuturesOptionsMarginModel.

Definition at line 179 of file FutureMarginModel.cs.

Here is the caller graph for this function:

Member Data Documentation

◆ InitialOvernightMarginRequirement

virtual decimal QuantConnect.Securities.Future.FutureMarginModel.InitialOvernightMarginRequirement => GetCurrentMarginRequirements(_security)?.InitialOvernight ?? 0m

Initial Overnight margin requirement for the contract effective from the date of change

Definition at line 53 of file FutureMarginModel.cs.

◆ MaintenanceOvernightMarginRequirement

virtual decimal QuantConnect.Securities.Future.FutureMarginModel.MaintenanceOvernightMarginRequirement => GetCurrentMarginRequirements(_security)?.MaintenanceOvernight ?? 0m

Maintenance Overnight margin requirement for the contract effective from the date of change

Definition at line 58 of file FutureMarginModel.cs.

◆ InitialIntradayMarginRequirement

virtual decimal QuantConnect.Securities.Future.FutureMarginModel.InitialIntradayMarginRequirement => GetCurrentMarginRequirements(_security)?.InitialIntraday ?? 0m

Initial Intraday margin for the contract effective from the date of change

Definition at line 63 of file FutureMarginModel.cs.

◆ MaintenanceIntradayMarginRequirement

virtual decimal QuantConnect.Securities.Future.FutureMarginModel.MaintenanceIntradayMarginRequirement => GetCurrentMarginRequirements(_security)?.MaintenanceIntraday ?? 0m

Maintenance Intraday margin requirement for the contract effective from the date of change

Definition at line 68 of file FutureMarginModel.cs.

Property Documentation

◆ EnableIntradayMargins

bool QuantConnect.Securities.Future.FutureMarginModel.EnableIntradayMargins
getset

True will enable usage of intraday margins.

Disabled by default. Note that intraday margins are less than overnight margins and could lead to margin calls

Definition at line 48 of file FutureMarginModel.cs.


The documentation for this class was generated from the following file: