Skip to content

IOrderProcessor

QuantConnect.Securities.IOrderProcessor

Bases: IOrderProvider

Represents a type capable of processing orders

orders_count

orders_count: int

Gets the current number of orders that have been processed

process

process(request: OrderRequest) -> OrderTicket

Adds the specified order to be processed

Parameters:

Name Type Description Default
request OrderRequest

The OrderRequest to be processed

required

Returns:

Type Description
OrderTicket

The OrderTicket for the corresponding OrderRequest.order_id.

get_open_orders

get_open_orders(
    filter: Callable[[Order], bool] = None,
) -> List[Order]

Gets open orders matching the specified filter. Specifying null will return an enumerable of all open orders.

Parameters:

Name Type Description Default
filter Callable[[Order], bool]

Delegate used to filter the orders

None

Returns:

Type Description
List[Order]

All filtered open orders this order provider currently holds.

get_open_order_tickets

get_open_order_tickets(
    filter: Callable[[OrderTicket], bool] = None,
) -> Iterable[OrderTicket]

Gets and enumerable of opened OrderTicket matching the specified filter

Parameters:

Name Type Description Default
filter Callable[[OrderTicket], bool]

The filter predicate used to find the required order tickets. If null is specified then all tickets are returned

None

Returns:

Type Description
Iterable[OrderTicket]

An enumerable of opened OrderTicket matching the specified filter.

get_order_by_id

get_order_by_id(order_id: int) -> Order

Get the order by its id

Parameters:

Name Type Description Default
order_id int

Order id to fetch

required

Returns:

Type Description
Order

A clone of the order with the specified id, or null if no match is found.

get_orders

get_orders(
    filter: Callable[[Order], bool] = None,
) -> Iterable[Order]

Gets all orders matching the specified filter. Specifying null will return an enumerable of all orders.

Parameters:

Name Type Description Default
filter Callable[[Order], bool]

Delegate used to filter the orders

None

Returns:

Type Description
Iterable[Order]

All orders this order provider currently holds by the specified filter.

get_orders_by_brokerage_id

get_orders_by_brokerage_id(
    brokerage_id: str,
) -> List[Order]

Gets the Lean orders by its brokerage id

Parameters:

Name Type Description Default
brokerage_id str

The brokerage id to fetch

required

Returns:

Type Description
List[Order]

The orders matching the brokerage id, or null if no match is found.

get_order_ticket

get_order_ticket(order_id: int) -> OrderTicket

Gets the order ticket for the specified order id. Returns null if not found

Parameters:

Name Type Description Default
order_id int

The order's id

required

Returns:

Type Description
OrderTicket

The order ticket with the specified id, or null if not found.

get_order_tickets

get_order_tickets(
    filter: Callable[[OrderTicket], bool] = None,
) -> Iterable[OrderTicket]

Gets and enumerable of OrderTicket matching the specified filter

Parameters:

Name Type Description Default
filter Callable[[OrderTicket], bool]

The filter predicate used to find the required order tickets. If null is specified then all tickets are returned

None

Returns:

Type Description
Iterable[OrderTicket]

An enumerable of OrderTicket matching the specified filter.

get_projected_holdings

get_projected_holdings(
    security: Security,
) -> ProjectedHoldings

Calculates the projected holdings for the specified security based on the current open orders.

Parameters:

Name Type Description Default
security Security

The security

required

Returns:

Type Description
ProjectedHoldings

The projected holdings for the specified security, which is the sum of the current holdings plus the sum of the open orders quantity.