SubmitOrderRequest
QuantConnect.Orders.SubmitOrderRequest
SubmitOrderRequest(
order_type: OrderType,
security_type: SecurityType,
symbol: Union[Symbol, str, BaseContract, Security],
quantity: float,
stop_price: float,
limit_price: float,
trigger_price: float,
trailing_amount: float,
trailing_as_percentage: bool,
time: Union[datetime, date],
tag: str,
properties: IOrderProperties = None,
group_order_manager: GroupOrderManager = None,
asynchronous: bool = False,
contingency: OrderContingency = None,
)
SubmitOrderRequest(
order_type: OrderType,
security_type: SecurityType,
symbol: Union[Symbol, str, BaseContract, Security],
quantity: float,
stop_price: float,
limit_price: float,
trigger_price: float,
time: Union[datetime, date],
tag: str,
properties: IOrderProperties = None,
group_order_manager: GroupOrderManager = None,
asynchronous: bool = False,
)
SubmitOrderRequest(
order_type: OrderType,
security_type: SecurityType,
symbol: Union[Symbol, str, BaseContract, Security],
quantity: float,
stop_price: float,
limit_price: float,
time: Union[datetime, date],
tag: str,
properties: IOrderProperties = None,
group_order_manager: GroupOrderManager = None,
asynchronous: bool = False,
)
Bases: OrderRequest
Defines a request to submit a new order. Built through OrderFactory it is also the specification of an order which can be composed with others before being submitted: an order can trigger others once it fills (triggers(SubmitOrderRequest<>)), which can in turn be related to each other (OrderFactory.one_cancels_other(SubmitOrderRequest<>)), see bracket
Initializes a new instance of the SubmitOrderRequest class. The OrderRequest.order_id will default to OrderResponseErrorCode.UNABLE_TO_FIND_ORDER
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order_type
|
OrderType
|
The order type to be submitted |
required |
security_type
|
SecurityType
|
The symbol's security_type |
required |
symbol
|
Union[Symbol, str, BaseContract, Security]
|
The symbol to be traded |
required |
quantity
|
float
|
The number of units to be ordered |
required |
stop_price
|
float
|
The stop price for stop orders, non-stop orders this value is ignored |
required |
limit_price
|
float
|
The limit price for limit orders, non-limit orders this value is ignored |
required |
trigger_price
|
Optional[float]
|
The trigger price for limit if touched orders, for non-limit if touched orders this value is ignored |
None
|
trailing_amount
|
Optional[float]
|
The trailing amount to be used to update the stop price |
None
|
trailing_as_percentage
|
Optional[bool]
|
Whether the trailing_amount is a percentage or an absolute currency value |
None
|
time
|
Union[datetime, date]
|
The time this request was created |
required |
tag
|
str
|
A custom tag for this request |
required |
properties
|
IOrderProperties
|
The order properties for this request |
None
|
group_order_manager
|
GroupOrderManager
|
The manager for this combo order |
None
|
asynchronous
|
bool
|
True if this request should be asynchronous, |
False
|
contingency
|
Optional[OrderContingency]
|
The contingency of this order, if any: the set of contingent orders it belongs to and how it relates to them |
None
|
quantity
quantity: float
Gets the quantity of the order
limit_price
limit_price: float
Gets the limit price of the order, zero if not a limit order
stop_price
stop_price: float
Gets the stop price of the order, zero if not a stop order
trigger_price
trigger_price: float
Price which must first be reached before a limit order can be submitted.
trailing_amount
trailing_amount: float
Trailing amount for a trailing stop order
trailing_as_percentage
trailing_as_percentage: bool
Determines whether the trailing_amount is a percentage or an absolute currency value
group_order_manager
group_order_manager: GroupOrderManager
Gets the manager for the combo order. If null, the order is not a combo order.
contingency
contingency: OrderContingency
Gets the contingency of this order: the set of contingent orders it belongs to and how it relates to them. If null, the order is not a contingent order. Composed before being submitted through triggers(SubmitOrderRequest<>), bracket, OrderFactory.one_cancels_other(SubmitOrderRequest<>) and OrderFactory.one_updates_other(SubmitOrderRequest<>)
asynchronous
asynchronous: bool
Whether this request should be asynchronous, which means the ticket will be returned to the algorithm without waiting for submission
time
time: datetime
Gets the UTC time the request was created
order_id
order_id: int
Gets the order id the request acts on
tag
tag: str
Gets a tag for this request
response
response: OrderResponse
Gets the response for this request. If this request was never processed then this will equal OrderResponse.UNPROCESSED. This value is never equal to null.
triggers
triggers(
*orders: Union[
SubmitOrderRequest, Iterable[SubmitOrderRequest]
]
) -> SubmitOrderRequest
triggers(
orders: List[SubmitOrderRequest],
) -> SubmitOrderRequest
Signature descriptions:
-
Sets the orders this order will trigger once it is completely filled (One Triggers Other): they are held until then and canceled if this order is canceled. The triggered orders are independent of each other, unless grouped through OrderFactory.one_cancels_other(SubmitOrderRequest<>) or OrderFactory.one_updates_other(SubmitOrderRequest<>). For the legs of a combo order see IAlgorithm OneTriggersOtherOrder, they are triggered together once all the legs fill
-
Sets the orders this order will trigger once it is completely filled (One Triggers Other), see triggers(SubmitOrderRequest<>)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
orders
|
Union[SubmitOrderRequest, Iterable[SubmitOrderRequest]]
|
The orders to trigger, for a combo order all its legs |
()
|
Returns:
| Type | Description |
|---|---|
SubmitOrderRequest
|
This instance. |
bracket
bracket(
take_profit_price: float,
stop_loss_price: float,
stop_loss_limit_price: Optional[float] = None,
contingency_type: ContingencyType = ...,
) -> SubmitOrderRequest
Brackets this order with a take profit limit order and a stop loss order, of the opposite quantity, which are held until this order fills (One Triggers a One Cancels Other)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
take_profit_price
|
float
|
The limit price of the take profit order |
required |
stop_loss_price
|
float
|
The stop price of the stop loss order |
required |
stop_loss_limit_price
|
Optional[float]
|
Optionally the limit price of the stop loss order, turning it into a stop limit order |
None
|
contingency_type
|
ContingencyType
|
How the take profit and stop loss relate: by default the first one to fill cancels the other. Use ContingencyType.ONE_UPDATES_OTHER so that a partial fill resizes the other |
...
|
Returns:
| Type | Description |
|---|---|
SubmitOrderRequest
|
This instance. |
to_string
to_string() -> str
Returns a string that represents the current object.
Returns:
| Type | Description |
|---|---|
str
|
A string that represents the current object. |
set_response
set_response(
response: OrderResponse,
status: OrderRequestStatus = ...,
) -> None
Sets the response for this request
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
response
|
OrderResponse
|
The response to this request |
required |
status
|
OrderRequestStatus
|
The current status of this request |
...
|