Skip to content

ImmediateFillModel

QuantConnect.Orders.Fills.ImmediateFillModel

Bases: FillModel

Represents the default fill model used to simulate order fills

parameters

parameters: FillModelParameters

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

This codeEntityType is protected.

python_wrapper

python_wrapper: FillModelPythonWrapper

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.

This codeEntityType is protected.

fill

fill(parameters: FillModelParameters) -> Fill

Return an order event with the fill details

Parameters:

Name Type Description Default
parameters FillModelParameters

A FillModelParameters object containing the security and order

required

Returns:

Type Description
Fill

Order fill information detailing the average price and quantity filled.

combo_leg_limit_fill

combo_leg_limit_fill(
    order: Order, parameters: FillModelParameters
) -> List[OrderEvent]

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

Parameters:

Name Type Description Default
order Order

Order to fill

required
parameters FillModelParameters

Fill parameters for the order

required

Returns:

Type Description
List[OrderEvent]

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.

combo_limit_fill

combo_limit_fill(
    order: Order, parameters: FillModelParameters
) -> List[OrderEvent]

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

Parameters:

Name Type Description Default
order Order

Order to fill

required
parameters FillModelParameters

Fill parameters for the order

required

Returns:

Type Description
List[OrderEvent]

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.

combo_market_fill

combo_market_fill(
    order: Order, parameters: FillModelParameters
) -> List[OrderEvent]

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

Parameters:

Name Type Description Default
order Order

Order to fill

required
parameters FillModelParameters

Fill parameters for the order

required

Returns:

Type Description
List[OrderEvent]

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.

get_prices

get_prices(
    asset: Security, direction: OrderDirection
) -> Prices

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

This codeEntityType is protected.

Parameters:

Name Type Description Default
asset Security

Security asset we're checking

required
direction OrderDirection

The order direction, decides whether to pick bid or ask

required

get_prices_checking_python_wrapper

get_prices_checking_python_wrapper(
    asset: Security, direction: OrderDirection
) -> Prices

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

This codeEntityType is protected.

get_subscribed_types

get_subscribed_types(asset: Security) -> HashSet[Type]

Get data types the Security is subscribed to

This codeEntityType is protected.

Parameters:

Name Type Description Default
asset Security

Security which has subscribed data types

required

is_exchange_open

is_exchange_open(
    asset: Security, is_extended_market_hours: bool
) -> bool

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

This codeEntityType is protected.

limit_fill

limit_fill(
    asset: Security, order: LimitOrder
) -> OrderEvent

Default limit order fill model in the base security class.

Parameters:

Name Type Description Default
asset Security

Security asset we're filling

required
order LimitOrder

Order packet to model

required

Returns:

Type Description
OrderEvent

Order fill information detailing the average price and quantity filled.

limit_if_touched_fill

limit_if_touched_fill(
    asset: Security, order: LimitIfTouchedOrder
) -> OrderEvent

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

Parameters:

Name Type Description Default
asset Security
required
order LimitIfTouchedOrder
required

Returns:

Type Description
OrderEvent

Order fill information detailing the average price and quantity filled.

market_fill

market_fill(
    asset: Security, order: MarketOrder
) -> OrderEvent

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

Parameters:

Name Type Description Default
asset Security

Security asset we're filling

required
order MarketOrder

Order packet to model

required

Returns:

Type Description
OrderEvent

Order fill information detailing the average price and quantity filled.

market_on_close_fill

market_on_close_fill(
    asset: Security, order: MarketOnCloseOrder
) -> OrderEvent

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

Parameters:

Name Type Description Default
asset Security

Asset we're trading with this order

required
order MarketOnCloseOrder

Order to be filled

required

Returns:

Type Description
OrderEvent

Order fill information detailing the average price and quantity filled.

market_on_open_fill

market_on_open_fill(
    asset: Security, order: MarketOnOpenOrder
) -> OrderEvent

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

Parameters:

Name Type Description Default
asset Security

Asset we're trading with this order

required
order MarketOnOpenOrder

Order to be filled

required

Returns:

Type Description
OrderEvent

Order fill information detailing the average price and quantity filled.

set_python_wrapper

set_python_wrapper(
    python_wrapper: FillModelPythonWrapper,
) -> None

Used to set the FillModelPythonWrapper instance if any

stop_limit_fill

stop_limit_fill(
    asset: Security, order: StopLimitOrder
) -> OrderEvent

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

Parameters:

Name Type Description Default
asset Security

Security asset we're filling

required
order StopLimitOrder

Order packet to model

required

Returns:

Type Description
OrderEvent

Order fill information detailing the average price and quantity filled.

stop_market_fill

stop_market_fill(
    asset: Security, order: StopMarketOrder
) -> OrderEvent

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

Parameters:

Name Type Description Default
asset Security

Security asset we're filling

required
order StopMarketOrder

Order packet to model

required

Returns:

Type Description
OrderEvent

Order fill information detailing the average price and quantity filled.

trailing_stop_fill

trailing_stop_fill(
    asset: Security, order: TrailingStopOrder
) -> OrderEvent

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

Parameters:

Name Type Description Default
asset Security

Security asset we're filling

required
order TrailingStopOrder

Order packet to model

required

Returns:

Type Description
OrderEvent

Order fill information detailing the average price and quantity filled.