Lean
$LEAN_TAG$
|
Represents the fill model used to simulate order fills for equities More...
Public Member Functions | |
override OrderEvent | LimitIfTouchedFill (Security asset, LimitIfTouchedOrder order) |
Default limit if touched fill model implementation in base class security. More... | |
override OrderEvent | MarketFill (Security asset, MarketOrder order) |
Default market fill model for the base security class. Fills at the last traded price. More... | |
override OrderEvent | StopMarketFill (Security asset, StopMarketOrder order) |
Stop fill model implementation for Equity. More... | |
override OrderEvent | StopLimitFill (Security asset, StopLimitOrder order) |
Default stop limit fill model implementation in base class security. (Stop Limit Order Type) More... | |
override OrderEvent | LimitFill (Security asset, LimitOrder order) |
Limit fill model implementation for Equity. More... | |
override OrderEvent | MarketOnOpenFill (Security asset, MarketOnOpenOrder order) |
Market on Open Fill Model. Return an order event with the fill details More... | |
override OrderEvent | MarketOnCloseFill (Security asset, MarketOnCloseOrder order) |
Market on Close Fill Model. Return an order event with the fill details More... | |
Public Member Functions inherited from QuantConnect.Orders.Fills.FillModel | |
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< OrderEvent > | ComboMarketFill (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< OrderEvent > | ComboLimitFill (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< OrderEvent > | ComboLegLimitFill (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 | TrailingStopFill (Security asset, TrailingStopOrder order) |
Default trailing stop fill model implementation in base class security. (Trailing Stop Order Type) More... | |
Protected Member Functions | |
override HashSet< Type > | GetSubscribedTypes (Security asset) |
Get data types the Security is subscribed to More... | |
override Prices | GetPricesCheckingPythonWrapper (Security asset, OrderDirection direction) |
This is required due to a limitation in PythonNet to resolved overriden methods. GetPrices More... | |
override Prices | GetPrices (Security asset, OrderDirection direction) |
Get the minimum and maximum price for this security in the last bar: More... | |
Protected Member Functions inherited from QuantConnect.Orders.Fills.FillModel | |
virtual bool | IsExchangeOpen (Security asset, bool isExtendedMarketHours) |
Determines if the exchange is open using the current time of the asset More... | |
Additional Inherited Members | |
Properties inherited from QuantConnect.Orders.Fills.FillModel | |
FillModelParameters | Parameters [get, set] |
The parameters instance to be used by the different XxxxFill() implementations More... | |
FillModelPythonWrapper | PythonWrapper [get, set] |
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... | |
Represents the fill model used to simulate order fills for equities
Definition at line 33 of file EquityFillModel.cs.
|
virtual |
Default limit if touched fill model implementation in base class security.
asset | Security asset we're filling |
order | Order packet to model |
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 from QuantConnect.Orders.Fills.FillModel.
Definition at line 52 of file EquityFillModel.cs.
|
virtual |
Default market fill model for the base security class. Fills at the last traded price.
asset | Security asset we're filling |
order | Order packet to model |
Reimplemented from QuantConnect.Orders.Fills.FillModel.
Definition at line 124 of file EquityFillModel.cs.
|
virtual |
Stop fill model implementation for Equity.
asset | Security asset we're filling |
order | Order packet to model |
A Stop order is an instruction to submit a buy or sell market order if and when the user-specified stop trigger price is attained or penetrated.
A Sell Stop order is always placed below the current market price. We assume a fluid/continuous, high volume market. Therefore, it is filled at the stop trigger price if the current low price of trades is less than or equal to this price.
A Buy Stop order is always placed above the current market price. We assume a fluid, high volume market. Therefore, it is filled at the stop trigger price if the current high price of trades is greater or equal than this price.
The continuous market assumption is not valid if the market opens with an unfavorable gap. In this case, a new bar opens below/above the stop trigger price, and the order is filled with the opening price.
Reimplemented from QuantConnect.Orders.Fills.FillModel.
Definition at line 180 of file EquityFillModel.cs.
|
virtual |
Default stop limit fill model implementation in base class security. (Stop Limit Order Type)
asset | Security asset we're filling |
order | Order packet to model |
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 from QuantConnect.Orders.Fills.FillModel.
Definition at line 258 of file EquityFillModel.cs.
|
virtual |
Limit fill model implementation for Equity.
asset | Security asset we're filling |
order | Order packet to model |
A Limit order is an order to buy or sell at a specified price or better. The Limit order ensures that if the order fills, it will not fill at a price less favorable than your limit price, but it does not guarantee a fill.
A Buy Limit order is always placed above the current market price. We assume a fluid/continuous, high volume market. Therefore, it is filled at the limit price if the current low price of trades is less than this price.
A Sell Limit order is always placed below the current market price. We assume a fluid, high volume market. Therefore, it is filled at the limit price if the current high price of trades is greater than this price.
This model does not trigger the limit order when the limit is attained (equals to). Since the order may not be filled in reality if it is not the top of the order book (first come, first served), we assume our order is the last in the book with its limit price, thus it will be filled when the limit price is penetrated.
The continuous market assumption is not valid if the market opens with a favorable gap. If the buy/sell limit order is placed below/above the current market price, the order is filled with the opening price.
Reimplemented from QuantConnect.Orders.Fills.FillModel.
Definition at line 364 of file EquityFillModel.cs.
|
virtual |
Market on Open Fill Model. Return an order event with the fill details
asset | Asset we're trading with this order |
order | Order to be filled |
Reimplemented from QuantConnect.Orders.Fills.FillModel.
Definition at line 440 of file EquityFillModel.cs.
|
virtual |
Market on Close Fill Model. Return an order event with the fill details
asset | Asset we're trading with this order |
order | Order to be filled |
Reimplemented from QuantConnect.Orders.Fills.FillModel.
Definition at line 581 of file EquityFillModel.cs.
|
protectedvirtual |
Get data types the Security is subscribed to
asset | Security which has subscribed data types |
Reimplemented from QuantConnect.Orders.Fills.FillModel.
Definition at line 698 of file EquityFillModel.cs.
|
protectedvirtual |
This is required due to a limitation in PythonNet to resolved overriden methods. GetPrices
Reimplemented from QuantConnect.Orders.Fills.FillModel.
Definition at line 979 of file EquityFillModel.cs.
|
protectedvirtual |
Get the minimum and maximum price for this security in the last bar:
asset | Security asset we're checking |
direction | The order direction, decides whether to pick bid or ask |
Reimplemented from QuantConnect.Orders.Fills.FillModel.
Definition at line 994 of file EquityFillModel.cs.