Lean  $LEAN_TAG$
QuantConnect.Orders.Fills.FillModel Class Reference

Provides a base class for all fill models More...

Inheritance diagram for QuantConnect.Orders.Fills.FillModel:
[legend]

Public Member Functions

void SetPythonWrapper (FillModelPythonWrapper pythonWrapper)
 Used to set the FillModelPythonWrapper instance if any More...
 
virtual Fill Fill (FillModelParameters parameters)
 Return an order event with the fill details More...
 
virtual List< OrderEventComboMarketFill (Order order, FillModelParameters parameters)
 Default combo market fill model for the base security class. Fills at the last traded price for each leg. More...
 
virtual List< OrderEventComboLimitFill (Order order, FillModelParameters parameters)
 Default combo limit fill model for the base security class. Fills at the sum of prices for the assets of every leg. More...
 
virtual List< OrderEventComboLegLimitFill (Order order, FillModelParameters parameters)
 Default combo limit fill model for the base security class. Fills at the limit price for each leg More...
 
virtual OrderEvent MarketFill (Security asset, MarketOrder order)
 Default market fill model for the base security class. Fills at the last traded price. More...
 
virtual OrderEvent StopMarketFill (Security asset, StopMarketOrder order)
 Default stop fill model implementation in base class security. (Stop Market Order Type) More...
 
virtual OrderEvent TrailingStopFill (Security asset, TrailingStopOrder order)
 Default trailing stop fill model implementation in base class security. (Trailing Stop Order Type) More...
 
virtual OrderEvent StopLimitFill (Security asset, StopLimitOrder order)
 Default stop limit fill model implementation in base class security. (Stop Limit Order Type) More...
 
virtual OrderEvent LimitIfTouchedFill (Security asset, LimitIfTouchedOrder order)
 Default limit if touched fill model implementation in base class security. (Limit If Touched Order Type) More...
 
virtual OrderEvent LimitFill (Security asset, LimitOrder order)
 Default limit order fill model in the base security class. More...
 
virtual OrderEvent MarketOnOpenFill (Security asset, MarketOnOpenOrder order)
 Market on Open Fill Model. Return an order event with the fill details More...
 
virtual OrderEvent MarketOnCloseFill (Security asset, MarketOnCloseOrder order)
 Market on Close Fill Model. Return an order event with the fill details More...
 

Protected Member Functions

virtual HashSet< Type > GetSubscribedTypes (Security asset)
 Get data types the Security is subscribed to More...
 
virtual Prices GetPricesCheckingPythonWrapper (Security asset, OrderDirection direction)
 This is required due to a limitation in PythonNet to resolved overriden methods. GetPrices More...
 
virtual Prices GetPrices (Security asset, OrderDirection direction)
 Get the minimum and maximum price for this security in the last bar: More...
 
virtual bool IsExchangeOpen (Security asset, bool isExtendedMarketHours)
 Determines if the exchange is open using the current time of the asset More...
 

Protected Attributes

FillModelPythonWrapper PythonWrapper
 This is required due to a limitation in PythonNet to resolved overriden methods. When Python calls a C# method that calls a method that's overriden in python it won't run the python implementation unless the call is performed through python too. More...
 

Properties

FillModelParameters Parameters [get, set]
 The parameters instance to be used by the different XxxxFill() implementations More...
 

Detailed Description

Provides a base class for all fill models

Definition at line 30 of file FillModel.cs.

Member Function Documentation

◆ SetPythonWrapper()

void QuantConnect.Orders.Fills.FillModel.SetPythonWrapper ( FillModelPythonWrapper  pythonWrapper)

Used to set the FillModelPythonWrapper instance if any

Definition at line 47 of file FillModel.cs.

Here is the caller graph for this function:

◆ Fill()

virtual Fill QuantConnect.Orders.Fills.FillModel.Fill ( FillModelParameters  parameters)
virtual

Return an order event with the fill details

Parameters
parametersA FillModelParameters object containing the security and order
Returns
Order fill information detailing the average price and quantity filled.

Implements QuantConnect.Orders.Fills.IFillModel.

Reimplemented in QuantConnect.Python.FillModelPythonWrapper.

Definition at line 57 of file FillModel.cs.

Here is the call graph for this function:

◆ ComboMarketFill()

virtual List<OrderEvent> QuantConnect.Orders.Fills.FillModel.ComboMarketFill ( Order  order,
FillModelParameters  parameters 
)
virtual

Default combo market fill model for the base security class. Fills at the last traded price for each leg.

Parameters
orderOrder to fill
parametersFill parameters for the order
Returns
Order fill information detailing the average price and quantity filled for each leg. If any of the fills fails, none of the orders will be filled and the returned list will be empty

Reimplemented in QuantConnect.Python.FillModelPythonWrapper.

Definition at line 134 of file FillModel.cs.

Here is the caller graph for this function:

◆ ComboLimitFill()

virtual List<OrderEvent> QuantConnect.Orders.Fills.FillModel.ComboLimitFill ( Order  order,
FillModelParameters  parameters 
)
virtual

Default combo limit fill model for the base security class. Fills at the sum of prices for the assets of every leg.

Parameters
orderOrder to fill
parametersFill parameters for the order
Returns
Order fill information detailing the average price and quantity filled for each leg. If any of the fills fails, none of the orders will be filled and the returned list will be empty

Reimplemented in QuantConnect.Python.FillModelPythonWrapper.

Definition at line 159 of file FillModel.cs.

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

◆ ComboLegLimitFill()

virtual List<OrderEvent> QuantConnect.Orders.Fills.FillModel.ComboLegLimitFill ( Order  order,
FillModelParameters  parameters 
)
virtual

Default combo limit fill model for the base security class. Fills at the limit price for each leg

Parameters
orderOrder to fill
parametersFill parameters for the order
Returns
Order fill information detailing the average price and quantity filled for each leg. If any of the fills fails, none of the orders will be filled and the returned list will be empty

Reimplemented in QuantConnect.Python.FillModelPythonWrapper.

Definition at line 242 of file FillModel.cs.

Here is the caller graph for this function:

◆ MarketFill()

virtual OrderEvent QuantConnect.Orders.Fills.FillModel.MarketFill ( Security  asset,
MarketOrder  order 
)
virtual

Default market fill model for the base security class. Fills at the last traded price.

Parameters
assetSecurity asset we're filling
orderOrder packet to model
Returns
Order fill information detailing the average price and quantity filled.

Reimplemented in QuantConnect.Orders.Fills.EquityFillModel, QuantConnect.Python.FillModelPythonWrapper, and QuantConnect.Orders.Fills.FutureFillModel.

Definition at line 271 of file FillModel.cs.

Here is the caller graph for this function:

◆ StopMarketFill()

virtual OrderEvent QuantConnect.Orders.Fills.FillModel.StopMarketFill ( Security  asset,
StopMarketOrder  order 
)
virtual

Default stop fill model implementation in base class security. (Stop Market Order Type)

Parameters
assetSecurity asset we're filling
orderOrder packet to model
Returns
Order fill information detailing the average price and quantity filled.
See also
MarketFill(Security, MarketOrder)

Reimplemented in QuantConnect.Orders.Fills.EquityFillModel, QuantConnect.Python.FillModelPythonWrapper, and QuantConnect.Orders.Fills.FutureFillModel.

Definition at line 332 of file FillModel.cs.

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

◆ TrailingStopFill()

virtual OrderEvent QuantConnect.Orders.Fills.FillModel.TrailingStopFill ( Security  asset,
TrailingStopOrder  order 
)
virtual

Default trailing stop fill model implementation in base class security. (Trailing Stop Order Type)

Parameters
assetSecurity asset we're filling
orderOrder packet to model
Returns
Order fill information detailing the average price and quantity filled.

Reimplemented in QuantConnect.Python.FillModelPythonWrapper.

Definition at line 391 of file FillModel.cs.

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

◆ StopLimitFill()

virtual OrderEvent QuantConnect.Orders.Fills.FillModel.StopLimitFill ( Security  asset,
StopLimitOrder  order 
)
virtual

Default stop limit fill model implementation in base class security. (Stop Limit Order Type)

Parameters
assetSecurity asset we're filling
orderOrder packet to model
Returns
Order fill information detailing the average price and quantity filled.
See also
StopMarketFill(Security, StopMarketOrder)

There is no good way to model limit orders with OHLC because we never know whether the market has gapped past our fill price. We have to make the assumption of a fluid, high volume market.

Stop limit orders we also can't be sure of the order of the H - L values for the limit fill. The assumption was made the limit fill will be done with closing price of the bar after the stop has been triggered..

Reimplemented in QuantConnect.Orders.Fills.EquityFillModel, and QuantConnect.Python.FillModelPythonWrapper.

Definition at line 471 of file FillModel.cs.

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

◆ LimitIfTouchedFill()

virtual OrderEvent QuantConnect.Orders.Fills.FillModel.LimitIfTouchedFill ( Security  asset,
LimitIfTouchedOrder  order 
)
virtual

Default limit if touched fill model implementation in base class security. (Limit If Touched Order Type)

Parameters
asset
order
Returns
Order fill information detailing the average price and quantity filled.

There is no good way to model limit orders with OHLC because we never know whether the market has gapped past our fill price. We have to make the assumption of a fluid, high volume market.

With Limit if Touched orders, whether or not a trigger is surpassed is determined by the high (low) of the previous tradebar when making a sell (buy) request. Following the behaviour of StopLimitFill, current quote information is used when determining fill parameters (e.g., price, quantity) as the tradebar containing the incoming data is not yet consolidated. This conservative approach, however, can lead to trades not occuring as would be expected when compared to future consolidated data.

Reimplemented in QuantConnect.Python.FillModelPythonWrapper, and QuantConnect.Orders.Fills.EquityFillModel.

Definition at line 561 of file FillModel.cs.

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

◆ LimitFill()

virtual OrderEvent QuantConnect.Orders.Fills.FillModel.LimitFill ( Security  asset,
LimitOrder  order 
)
virtual

Default limit order fill model in the base security class.

Parameters
assetSecurity asset we're filling
orderOrder packet to model
Returns
Order fill information detailing the average price and quantity filled.
See also
StopMarketFill(Security, StopMarketOrder), MarketFill(Security, MarketOrder)

Reimplemented in QuantConnect.Orders.Fills.EquityFillModel, and QuantConnect.Python.FillModelPythonWrapper.

Definition at line 655 of file FillModel.cs.

Here is the caller graph for this function:

◆ MarketOnOpenFill()

virtual OrderEvent QuantConnect.Orders.Fills.FillModel.MarketOnOpenFill ( Security  asset,
MarketOnOpenOrder  order 
)
virtual

Market on Open Fill Model. Return an order event with the fill details

Parameters
assetAsset we're trading with this order
orderOrder to be filled
Returns
Order fill information detailing the average price and quantity filled.

Reimplemented in QuantConnect.Orders.Fills.EquityFillModel, and QuantConnect.Python.FillModelPythonWrapper.

Definition at line 724 of file FillModel.cs.

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

◆ MarketOnCloseFill()

virtual OrderEvent QuantConnect.Orders.Fills.FillModel.MarketOnCloseFill ( Security  asset,
MarketOnCloseOrder  order 
)
virtual

Market on Close Fill Model. Return an order event with the fill details

Parameters
assetAsset we're trading with this order
orderOrder to be filled
Returns
Order fill information detailing the average price and quantity filled.

Reimplemented in QuantConnect.Orders.Fills.EquityFillModel, and QuantConnect.Python.FillModelPythonWrapper.

Definition at line 785 of file FillModel.cs.

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

◆ GetSubscribedTypes()

virtual HashSet<Type> QuantConnect.Orders.Fills.FillModel.GetSubscribedTypes ( Security  asset)
protectedvirtual

Get data types the Security is subscribed to

Parameters
assetSecurity which has subscribed data types

Reimplemented in QuantConnect.Orders.Fills.EquityFillModel.

Definition at line 953 of file FillModel.cs.

Here is the caller graph for this function:

◆ GetPricesCheckingPythonWrapper()

virtual Prices QuantConnect.Orders.Fills.FillModel.GetPricesCheckingPythonWrapper ( Security  asset,
OrderDirection  direction 
)
protectedvirtual

This is required due to a limitation in PythonNet to resolved overriden methods. GetPrices

Reimplemented in QuantConnect.Orders.Fills.EquityFillModel.

Definition at line 1014 of file FillModel.cs.

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

◆ GetPrices()

virtual Prices QuantConnect.Orders.Fills.FillModel.GetPrices ( Security  asset,
OrderDirection  direction 
)
protectedvirtual

Get the minimum and maximum price for this security in the last bar:

Parameters
assetSecurity asset we're checking
directionThe order direction, decides whether to pick bid or ask

Reimplemented in QuantConnect.Orders.Fills.EquityFillModel, QuantConnect.Python.FillModelPythonWrapper, and QuantConnect.Orders.Fills.LatestPriceFillModel.

Definition at line 1028 of file FillModel.cs.

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

◆ IsExchangeOpen()

virtual bool QuantConnect.Orders.Fills.FillModel.IsExchangeOpen ( Security  asset,
bool  isExtendedMarketHours 
)
protectedvirtual

Determines if the exchange is open using the current time of the asset

Definition at line 1086 of file FillModel.cs.

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

Member Data Documentation

◆ PythonWrapper

FillModelPythonWrapper QuantConnect.Orders.Fills.FillModel.PythonWrapper
protected

This is required due to a limitation in PythonNet to resolved overriden methods. When Python calls a C# method that calls a method that's overriden in python it won't run the python implementation unless the call is performed through python too.

Definition at line 42 of file FillModel.cs.

Property Documentation

◆ Parameters

FillModelParameters QuantConnect.Orders.Fills.FillModel.Parameters
getsetprotected

The parameters instance to be used by the different XxxxFill() implementations

Definition at line 35 of file FillModel.cs.


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