Lean  $LEAN_TAG$
QuantConnect.Securities.Option.FuturesOptionsMarginModel Class Reference

Defines a margin model for future options (an option with a future as its underlying). We re-use the FutureMarginModel implementation and multiply its results by 1.5x to simulate the increased margins seen for future options. More...

Inheritance diagram for QuantConnect.Securities.Option.FuturesOptionsMarginModel:
[legend]

Public Member Functions

 FuturesOptionsMarginModel (decimal requiredFreeBuyingPowerPercent=0, Option futureOption=null)
 Creates an instance of FutureOptionMarginModel More...
 
override MaintenanceMargin GetMaintenanceMargin (MaintenanceMarginParameters parameters)
 Gets the margin currently alloted 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.Future.FutureMarginModel
 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...
 
- 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...
 

Static Public Member Functions

static int GetMarginRequirement (Option option, decimal underlyingRequirement, PositionSide positionSide=PositionSide.Long)
 Get's the margin requirement for a future option based on the underlying future margin requirement and the position side to trade. FOPs margin requirement is an 'S' curve based on the underlying requirement around it's current price, see https://en.wikipedia.org/wiki/Logistic_function More...
 

Public Attributes

override decimal InitialOvernightMarginRequirement => GetMarginRequirement(_futureOption, base.InitialOvernightMarginRequirement)
 Initial Overnight margin requirement for the contract effective from the date of change More...
 
override decimal MaintenanceOvernightMarginRequirement => GetMarginRequirement(_futureOption, base.MaintenanceOvernightMarginRequirement)
 Maintenance Overnight margin requirement for the contract effective from the date of change More...
 
override decimal InitialIntradayMarginRequirement => GetMarginRequirement(_futureOption, base.InitialIntradayMarginRequirement)
 Initial Intraday margin for the contract effective from the date of change More...
 
override decimal MaintenanceIntradayMarginRequirement => GetMarginRequirement(_futureOption, base.MaintenanceIntradayMarginRequirement)
 Maintenance Intraday margin requirement for the contract effective from the date of change More...
 
- Public Attributes inherited from QuantConnect.Securities.Future.FutureMarginModel
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...
 

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...
 
- Protected Attributes inherited from QuantConnect.Securities.BuyingPowerModel
decimal RequiredFreeBuyingPowerPercent
 The percentage used to determine the required unused buying power for the account. More...
 
- Properties inherited from QuantConnect.Securities.Future.FutureMarginModel
bool EnableIntradayMargins [get, set]
 True will enable usage of intraday margins. More...
 

Detailed Description

Defines a margin model for future options (an option with a future as its underlying). We re-use the FutureMarginModel implementation and multiply its results by 1.5x to simulate the increased margins seen for future options.

Definition at line 26 of file FuturesOptionsMarginModel.cs.

Constructor & Destructor Documentation

◆ FuturesOptionsMarginModel()

QuantConnect.Securities.Option.FuturesOptionsMarginModel.FuturesOptionsMarginModel ( decimal  requiredFreeBuyingPowerPercent = 0,
Option  futureOption = null 
)

Creates an instance of FutureOptionMarginModel

Parameters
requiredFreeBuyingPowerPercentThe percentage used to determine the required unused buying power for the account.
futureOptionOption Security containing a Future security as the underlying

Definition at line 55 of file FuturesOptionsMarginModel.cs.

Member Function Documentation

◆ GetMaintenanceMargin()

override MaintenanceMargin QuantConnect.Securities.Option.FuturesOptionsMarginModel.GetMaintenanceMargin ( MaintenanceMarginParameters  parameters)
virtual

Gets the margin currently alloted to the specified holding.

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

We fix the option to 1.5x the maintenance because of its close coupling with the underlying. The option's contract multiplier is 1x, but might be more sensitive to volatility shocks in the long run when it comes to calculating the different market scenarios attempting to simulate VaR, resulting in a margin greater than the underlying's margin.

Reimplemented from QuantConnect.Securities.Future.FutureMarginModel.

Definition at line 71 of file FuturesOptionsMarginModel.cs.

Here is the call graph for this function:

◆ GetInitialMarginRequirement()

override InitialMargin QuantConnect.Securities.Option.FuturesOptionsMarginModel.GetInitialMarginRequirement ( InitialMarginParameters  parameters)
virtual

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

Parameters
parametersAn object containing the security and quantity of shares
Returns
The initial margin required for the option (i.e. the equity required to enter a position for this option)

We fix the option to 1.5x the initial because of its close coupling with the underlying. The option's contract multiplier is 1x, but might be more sensitive to volatility shocks in the long run when it comes to calculating the different market scenarios attempting to simulate VaR, resulting in a margin greater than the underlying's margin.

Reimplemented from QuantConnect.Securities.Future.FutureMarginModel.

Definition at line 89 of file FuturesOptionsMarginModel.cs.

Here is the call graph for this function:

◆ GetMarginRequirement()

static int QuantConnect.Securities.Option.FuturesOptionsMarginModel.GetMarginRequirement ( Option  option,
decimal  underlyingRequirement,
PositionSide  positionSide = PositionSide.Long 
)
static

Get's the margin requirement for a future option based on the underlying future margin requirement and the position side to trade. FOPs margin requirement is an 'S' curve based on the underlying requirement around it's current price, see https://en.wikipedia.org/wiki/Logistic_function

Parameters
optionThe future option contract to trade
underlyingRequirementThe underlying future associated margin requirement
positionSideThe position side to trade, long by default. This is because short positions require higher margin requirements

Definition at line 104 of file FuturesOptionsMarginModel.cs.

Here is the caller graph for this function:

Member Data Documentation

◆ InitialOvernightMarginRequirement

override decimal QuantConnect.Securities.Option.FuturesOptionsMarginModel.InitialOvernightMarginRequirement => GetMarginRequirement(_futureOption, base.InitialOvernightMarginRequirement)

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

Definition at line 33 of file FuturesOptionsMarginModel.cs.

◆ MaintenanceOvernightMarginRequirement

override decimal QuantConnect.Securities.Option.FuturesOptionsMarginModel.MaintenanceOvernightMarginRequirement => GetMarginRequirement(_futureOption, base.MaintenanceOvernightMarginRequirement)

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

Definition at line 38 of file FuturesOptionsMarginModel.cs.

◆ InitialIntradayMarginRequirement

override decimal QuantConnect.Securities.Option.FuturesOptionsMarginModel.InitialIntradayMarginRequirement => GetMarginRequirement(_futureOption, base.InitialIntradayMarginRequirement)

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

Definition at line 43 of file FuturesOptionsMarginModel.cs.

◆ MaintenanceIntradayMarginRequirement

override decimal QuantConnect.Securities.Option.FuturesOptionsMarginModel.MaintenanceIntradayMarginRequirement => GetMarginRequirement(_futureOption, base.MaintenanceIntradayMarginRequirement)

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

Definition at line 48 of file FuturesOptionsMarginModel.cs.


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