FillModelPythonWrapper
QuantConnect.Python.FillModelPythonWrapper
FillModelPythonWrapper(model: Any)
Bases: FillModel
Wraps a PyObject object that represents a model that simulates order fill events
Constructor for initialising the FillModelPythonWrapper class with wrapped PyObject object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Any
|
Represents a model that simulates order fill events |
required |
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.
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. |
fill
fill(parameters: FillModelParameters) -> Fill
Return an order event with the fill details
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
FillModelParameters
|
A parameters object containing the security and order |
required |
Returns:
| Type | Description |
|---|---|
Fill
|
Order fill information detailing the average price and quantity filled. |
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 |
limit_fill
limit_fill(
asset: Security, order: LimitOrder
) -> OrderEvent
Limit Fill Model. Return an order event with the fill details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset
|
Security
|
Stock Object to use to help model limit fill |
required |
order
|
LimitOrder
|
Order to fill. Alter the values directly if filled. |
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
Limit if Touched Fill Model. Return an order event with the fill details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset
|
Security
|
Asset we're trading this order |
required |
order
|
LimitIfTouchedOrder
|
LimitIfTouchedOrder Order to Check, return filled if true |
required |
Returns:
| Type | Description |
|---|---|
OrderEvent
|
Order fill information detailing the average price and quantity filled. |
market_fill
market_fill(
asset: Security, order: MarketOrder
) -> OrderEvent
Model the slippage on a market order: fixed percentage of order price
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset
|
Security
|
Asset we're trading this order |
required |
order
|
MarketOrder
|
Order to update |
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. |
stop_limit_fill
stop_limit_fill(
asset: Security, order: StopLimitOrder
) -> OrderEvent
Stop Limit Fill Model. Return an order event with the fill details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset
|
Security
|
Asset we're trading this order |
required |
order
|
StopLimitOrder
|
Stop Limit Order to Check, return filled if true |
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
Stop Market Fill Model. Return an order event with the fill details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset
|
Security
|
Asset we're trading this order |
required |
order
|
StopMarketOrder
|
Trailing Stop Order to check, return filled if true |
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
Trailing Stop Fill Model. Return an order event with the fill details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset
|
Security
|
Asset we're trading this order |
required |
order
|
TrailingStopOrder
|
Stop Order to Check, return filled if true |
required |
Returns:
| Type | Description |
|---|---|
OrderEvent
|
Order fill information detailing the average price and quantity filled. |
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.
set_python_wrapper
set_python_wrapper(
python_wrapper: FillModelPythonWrapper,
) -> None
Used to set the FillModelPythonWrapper instance if any