Skip to content

MarketOnCloseOrder

QuantConnect.Orders.MarketOnCloseOrder

MarketOnCloseOrder()
MarketOnCloseOrder(
    symbol: Union[Symbol, str, BaseContract],
    quantity: float,
    time: Union[datetime, date],
    tag: str = ...,
    properties: IOrderProperties = None,
)

Bases: Order

Market on close order type - submits a market order on exchange close

Intiializes a new instance of the MarketOnCloseOrder class.

Parameters:

Name Type Description Default
symbol Optional[Union[Symbol, str, BaseContract]]

The security's symbol being ordered

None
quantity Optional[float]

The number of units to order

None
time Optional[Union[datetime, date]]

The current time

None
tag Optional[str]

A user defined tag for the order

...
properties Optional[IOrderProperties]

The order properties for this order

None

DEFAULT_SUBMISSION_TIME_BUFFER

DEFAULT_SUBMISSION_TIME_BUFFER: timedelta = ...

Gets the default interval before market close that an MOC order may be submitted. For example, US equity exchanges typically require MOC orders to be placed no later than 15 minutes before market close, which yields a nominal time of 3:45PM. This buffer value takes into account the 15 minutes and adds an additional 30 seconds to account for other potential delays, such as LEAN order processing and placement of the order to the exchange.

submission_time_buffer

submission_time_buffer: timedelta = ...

The interval before market close that an MOC order may be submitted.

type

type: OrderType

MarketOnClose Order Type

id

id: int

Order ID.

contingent_id

contingent_id: int

Order id to process before processing this order.

broker_id

broker_id: List[str]

Brokerage Id for this order for when the brokerage splits orders into multiple pieces

symbol

symbol: Symbol

Symbol of the Asset

price

price: float

Price of the Order.

price_currency

price_currency: str

Currency for the order price

time

time: datetime

Gets the utc time the order was created.

created_time

created_time: datetime

Gets the utc time this order was created. Alias for time

last_fill_time

last_fill_time: Optional[datetime]

Gets the utc time the last fill was received, or null if no fills have been received

last_update_time

last_update_time: Optional[datetime]

Gets the utc time this order was last updated, or null if the order has not been updated.

canceled_time

canceled_time: Optional[datetime]

Gets the utc time this order was canceled, or null if the order was not canceled.

quantity

quantity: float

Number of shares to execute.

status

status: OrderStatus

Status of the Order

time_in_force

time_in_force: TimeInForce

Order Time In Force

tag

tag: str

Tag the order with some custom data

properties

properties: IOrderProperties

Additional properties of the order

security_type

security_type: SecurityType

The symbol's security type

direction

direction: OrderDirection

Order Direction Property based off Quantity.

absolute_quantity

absolute_quantity: float

Get the absolute quantity for this order

value

value: float

Deprecated

Please use Order.GetValue(security) or security.Holdings.HoldingsValue

order_submission_data

order_submission_data: OrderSubmissionData

Gets the price data at the time the order was submitted

is_marketable

is_marketable: bool

Returns true if the order is a marketable order.

group_order_manager

group_order_manager: GroupOrderManager

Manager for the orders in the group if this is a combo order

price_adjustment_mode

price_adjustment_mode: DataNormalizationMode

The adjustment mode used on the order fill price

clone

clone() -> Order

Creates a deep-copy clone of this order

Returns:

Type Description
Order

A copy of this order.

get_value_impl

get_value_impl(security: Security) -> float

Gets the order value in units of the security's quote currency

This codeEntityType is protected.

Parameters:

Name Type Description Default
security Security

The security matching this order's symbol

required

apply_update_order_request

apply_update_order_request(
    request: UpdateOrderRequest,
) -> None

Modifies the state of this order to match the update request

Parameters:

Name Type Description Default
request UpdateOrderRequest

The request to update this order object

required

copy_to

copy_to(order: Order) -> None

Copies base Order properties to the specified order

This codeEntityType is protected.

Parameters:

Name Type Description Default
order Order

The target of the copy

required

create_order

create_order(request: SubmitOrderRequest) -> Order

Creates an Order to match the specified request

Parameters:

Name Type Description Default
request SubmitOrderRequest

The SubmitOrderRequest to create an order for

required

Returns:

Type Description
Order

The Order that matches the request.

create_positions

create_positions(
    securities: SecurityManager,
) -> Iterable[IPosition]

Creates an enumerable containing each position resulting from executing this order.

Returns:

Type Description
Iterable[IPosition]

An enumerable of positions matching the results of executing this order.

get_default_tag

get_default_tag() -> str

Gets the default tag for this order

Returns:

Type Description
str

The default tag.

get_value

get_value(security: Security) -> float

Gets the value of this order at the given market price in units of the account currency NOTE: Some order types derive value from other parameters, such as limit prices

Parameters:

Name Type Description Default
security Security

The security matching this order's symbol

required

Returns:

Type Description
float

The value of this order given the current market price.

to_string

to_string() -> str

Returns a string that represents the current object.

Returns:

Type Description
str

A string that represents the current object.