Lean  $LEAN_TAG$
QuantConnect.Securities.BuyingPowerModelExtensions Class Reference

Provides extension methods as backwards compatibility shims More...

Static Public Member Functions

static decimal GetReservedBuyingPowerForPosition (this IBuyingPowerModel model, Security security)
 Gets the amount of buying power reserved to maintain the specified position More...
 
static HasSufficientBuyingPowerForOrderResult HasSufficientBuyingPowerForOrder (this IBuyingPowerModel model, SecurityPortfolioManager portfolio, Security security, Order order)
 Check if there is sufficient buying power to execute this order. More...
 
static GetMaximumOrderQuantityResult GetMaximumOrderQuantityForTargetBuyingPower (this IBuyingPowerModel model, SecurityPortfolioManager portfolio, Security security, decimal target, decimal minimumOrderMarginPortfolioPercentage)
 Get the maximum market order quantity to obtain a position with a given value in account currency More...
 
static decimal GetBuyingPower (this IBuyingPowerModel model, SecurityPortfolioManager portfolio, Security security, OrderDirection direction)
 Gets the buying power available for a trade More...
 
static decimal GetMaintenanceMargin (this IBuyingPowerModel model, Security security)
 Gets the margin currently allocated to the specified holding More...
 
static decimal GetInitialMarginRequirement (this IBuyingPowerModel model, Security security, decimal quantity)
 Gets the margin currently allocated to the specified holding More...
 
static bool AboveMinimumOrderMarginPortfolioPercentage (this IBuyingPowerModel model, Security security, decimal quantity, SecurityPortfolioManager portfolioManager, decimal minimumOrderMarginPortfolioPercentage)
 Helper method to determine if the requested quantity is above the algorithm minimum order margin portfolio percentage More...
 
static bool AboveMinimumOrderMarginPortfolioPercentage (SecurityPortfolioManager portfolioManager, decimal minimumOrderMarginPortfolioPercentage, decimal absFinalOrderMargin)
 Helper method to determine if the requested quantity is above the algorithm minimum order margin portfolio percentage More...
 

Detailed Description

Provides extension methods as backwards compatibility shims

Definition at line 24 of file BuyingPowerModelExtensions.cs.

Member Function Documentation

◆ GetReservedBuyingPowerForPosition()

static decimal QuantConnect.Securities.BuyingPowerModelExtensions.GetReservedBuyingPowerForPosition ( this IBuyingPowerModel  model,
Security  security 
)
static

Gets the amount of buying power reserved to maintain the specified position

Parameters
modelThe IBuyingPowerModel
securityThe security
Returns
The reserved buying power in account currency

Definition at line 32 of file BuyingPowerModelExtensions.cs.

Here is the call graph for this function:

◆ HasSufficientBuyingPowerForOrder()

static HasSufficientBuyingPowerForOrderResult QuantConnect.Securities.BuyingPowerModelExtensions.HasSufficientBuyingPowerForOrder ( this IBuyingPowerModel  model,
SecurityPortfolioManager  portfolio,
Security  security,
Order  order 
)
static

Check if there is sufficient buying power to execute this order.

Parameters
modelThe IBuyingPowerModel
portfolioThe algorithm's portfolio
securityThe security to be traded
orderThe order
Returns
Returns buying power information for an order

Definition at line 47 of file BuyingPowerModelExtensions.cs.

Here is the call graph for this function:

◆ GetMaximumOrderQuantityForTargetBuyingPower()

static GetMaximumOrderQuantityResult QuantConnect.Securities.BuyingPowerModelExtensions.GetMaximumOrderQuantityForTargetBuyingPower ( this IBuyingPowerModel  model,
SecurityPortfolioManager  portfolio,
Security  security,
decimal  target,
decimal  minimumOrderMarginPortfolioPercentage 
)
static

Get the maximum market order quantity to obtain a position with a given value in account currency

Parameters
modelThe IBuyingPowerModel
portfolioThe algorithm's portfolio
securityThe security to be traded
targetThe target percent holdings
minimumOrderMarginPortfolioPercentageConfigurable minimum order margin portfolio percentage to ignore orders with unrealistic small sizes
Returns
Returns the maximum allowed market order quantity and if zero, also the reason

Definition at line 68 of file BuyingPowerModelExtensions.cs.

Here is the call graph for this function:

◆ GetBuyingPower()

static decimal QuantConnect.Securities.BuyingPowerModelExtensions.GetBuyingPower ( this IBuyingPowerModel  model,
SecurityPortfolioManager  portfolio,
Security  security,
OrderDirection  direction 
)
static

Gets the buying power available for a trade

Parameters
modelThe IBuyingPowerModel
portfolioThe algorithm's portfolio
securityThe security to be traded
directionThe direction of the trade
Returns
The buying power available for the trade

Definition at line 89 of file BuyingPowerModelExtensions.cs.

Here is the call graph for this function:

◆ GetMaintenanceMargin()

static decimal QuantConnect.Securities.BuyingPowerModelExtensions.GetMaintenanceMargin ( this IBuyingPowerModel  model,
Security  security 
)
static

Gets the margin currently allocated to the specified holding

Parameters
modelThe buying power model
securityThe security
Returns
The maintenance margin required for the provided holdings quantity/cost/value

Definition at line 109 of file BuyingPowerModelExtensions.cs.

Here is the call graph for this function:

◆ GetInitialMarginRequirement()

static decimal QuantConnect.Securities.BuyingPowerModelExtensions.GetInitialMarginRequirement ( this IBuyingPowerModel  model,
Security  security,
decimal  quantity 
)
static

Gets the margin currently allocated to the specified holding

Parameters
modelThe buying power model
securityThe security
quantityThe quantity of shares
Returns
The initial margin required for the provided security and quantity

Definition at line 121 of file BuyingPowerModelExtensions.cs.

Here is the call graph for this function:

◆ AboveMinimumOrderMarginPortfolioPercentage() [1/2]

static bool QuantConnect.Securities.BuyingPowerModelExtensions.AboveMinimumOrderMarginPortfolioPercentage ( this IBuyingPowerModel  model,
Security  security,
decimal  quantity,
SecurityPortfolioManager  portfolioManager,
decimal  minimumOrderMarginPortfolioPercentage 
)
static

Helper method to determine if the requested quantity is above the algorithm minimum order margin portfolio percentage

Parameters
modelThe buying power model
securityThe security
quantityThe quantity of shares
portfolioManagerThe algorithm's portfolio
minimumOrderMarginPortfolioPercentageMinimum order margin portfolio percentage to ignore bad orders, orders with unrealistic small sizes

If we are trading with negative margin remaining this method will return true always

Returns
True if this order quantity is above the minimum requested

Definition at line 136 of file BuyingPowerModelExtensions.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AboveMinimumOrderMarginPortfolioPercentage() [2/2]

static bool QuantConnect.Securities.BuyingPowerModelExtensions.AboveMinimumOrderMarginPortfolioPercentage ( SecurityPortfolioManager  portfolioManager,
decimal  minimumOrderMarginPortfolioPercentage,
decimal  absFinalOrderMargin 
)
static

Helper method to determine if the requested quantity is above the algorithm minimum order margin portfolio percentage

Parameters
portfolioManagerThe algorithm's portfolio
minimumOrderMarginPortfolioPercentageMinimum order margin portfolio percentage to ignore bad orders, orders with unrealistic small sizes
absFinalOrderMarginThe calculated order margin value

If we are trading with negative margin remaining this method will return true always

Returns
True if this order quantity is above the minimum requested

Definition at line 157 of file BuyingPowerModelExtensions.cs.

Here is the call graph for this function:

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