Lean  $LEAN_TAG$
QuantConnect.Orders.OrderSizing Class Reference

Provides methods for computing a maximum order size. More...

Static Public Member Functions

static decimal GetOrderSizeForPercentVolume (Security security, decimal maximumPercentCurrentVolume, decimal desiredOrderSize)
 Adjust the provided order size to respect maximum order size based on a percentage of current volume. More...
 
static decimal GetOrderSizeForMaximumValue (Security security, decimal maximumOrderValueInAccountCurrency, decimal desiredOrderSize)
 Adjust the provided order size to respect the maximum total order value More...
 
static decimal GetUnorderedQuantity (IAlgorithm algorithm, IPortfolioTarget target)
 Gets the remaining quantity to be ordered to reach the specified target quantity. More...
 
static decimal GetUnorderedQuantity (IAlgorithm algorithm, IPortfolioTarget target, Security security, bool accountForFees=false)
 Gets the remaining quantity to be ordered to reach the specified target quantity. More...
 
static decimal AdjustByLotSize (Security security, decimal quantity)
 Adjusts the provided order quantity to respect the securities lot size. If the quantity is missing 1M part of the lot size it will be rounded up since we suppose it's due to floating point error, this is required to avoid diff between Py and C# More...
 

Detailed Description

Provides methods for computing a maximum order size.

Definition at line 28 of file OrderSizing.cs.

Member Function Documentation

◆ GetOrderSizeForPercentVolume()

static decimal QuantConnect.Orders.OrderSizing.GetOrderSizeForPercentVolume ( Security  security,
decimal  maximumPercentCurrentVolume,
decimal  desiredOrderSize 
)
static

Adjust the provided order size to respect maximum order size based on a percentage of current volume.

Parameters
securityThe security object
maximumPercentCurrentVolumeThe maximum percentage of the current bar's volume
desiredOrderSizeThe desired order size to adjust
Returns
The signed adjusted order size

Definition at line 37 of file OrderSizing.cs.

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

◆ GetOrderSizeForMaximumValue()

static decimal QuantConnect.Orders.OrderSizing.GetOrderSizeForMaximumValue ( Security  security,
decimal  maximumOrderValueInAccountCurrency,
decimal  desiredOrderSize 
)
static

Adjust the provided order size to respect the maximum total order value

Parameters
securityThe security object
maximumOrderValueInAccountCurrencyThe maximum order value in units of the account currency
desiredOrderSizeThe desired order size to adjust
Returns
The signed adjusted order size

Definition at line 52 of file OrderSizing.cs.

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

◆ GetUnorderedQuantity() [1/2]

static decimal QuantConnect.Orders.OrderSizing.GetUnorderedQuantity ( IAlgorithm  algorithm,
IPortfolioTarget  target 
)
static

Gets the remaining quantity to be ordered to reach the specified target quantity.

Parameters
algorithmThe algorithm instance
targetThe portfolio target
Returns
The signed remaining quantity to be ordered

Definition at line 75 of file OrderSizing.cs.

Here is the caller graph for this function:

◆ GetUnorderedQuantity() [2/2]

static decimal QuantConnect.Orders.OrderSizing.GetUnorderedQuantity ( IAlgorithm  algorithm,
IPortfolioTarget  target,
Security  security,
bool  accountForFees = false 
)
static

Gets the remaining quantity to be ordered to reach the specified target quantity.

Parameters
algorithmThe algorithm instance
targetThe portfolio target
securityThe target security
accountForFeesTrue for taking into account the fee's in the order quantity. False, otherwise.
Returns
The signed remaining quantity to be ordered

Definition at line 91 of file OrderSizing.cs.

Here is the call graph for this function:

◆ AdjustByLotSize()

static decimal QuantConnect.Orders.OrderSizing.AdjustByLotSize ( Security  security,
decimal  quantity 
)
static

Adjusts the provided order quantity to respect the securities lot size. If the quantity is missing 1M part of the lot size it will be rounded up since we suppose it's due to floating point error, this is required to avoid diff between Py and C#

Parameters
securityThe security instance
quantityThe desired quantity to adjust, can be signed
Returns
The signed adjusted quantity

Definition at line 121 of file OrderSizing.cs.

Here is the caller graph for this function:

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