Skip to content

OrderCommand

QuantConnect.Commands.OrderCommand

Bases: BaseCommand

Represents a command to submit an order to the algorithm

symbol

symbol: Symbol

Gets or sets the symbol to be ordered

ticker

ticker: str

Gets or sets the string ticker symbol

security_type

security_type: SecurityType

Gets or sets the security type of the ticker.

market

market: str

Gets or sets the market the ticker resides in

order_type

order_type: OrderType

Gets or sets the order type to be submted

quantity

quantity: float

Gets or sets the number of units to be ordered (directional)

limit_price

limit_price: float

Gets or sets the limit price. Only applies to QuantConnect.Orders.OrderType.Limit and QuantConnect.Orders.OrderType.StopLimit

stop_price

stop_price: float

Gets or sets the stop price. Only applies to QuantConnect.Orders.OrderType.StopLimit and QuantConnect.Orders.OrderType.StopMarket

tag

tag: str

Gets or sets an arbitrary tag to be attached to the order

id

id: str

Unique command id

run

run(algorithm: IAlgorithm) -> CommandResultPacket

Runs this command against the specified algorithm instance

Parameters:

Name Type Description Default
algorithm IAlgorithm

The algorithm to run this command against

required

to_string

to_string() -> str

Returns a string that represents the current object.

Returns:

Type Description
str

A string that represents the current object.

get_symbol

get_symbol(
    ticker: str,
    security_type: SecurityType,
    market: str,
    symbol: Union[Symbol, str, BaseContract] = None,
) -> Symbol

Creats symbol using symbol properties.

This codeEntityType is protected.

Parameters:

Name Type Description Default
ticker str

The string ticker symbol

required
security_type SecurityType

The security type of the ticker. If security_type == Option, then a canonical symbol is created

required
market str

The market the ticker resides in

required
symbol Union[Symbol, str, BaseContract]

The algorithm to run this command against

None