Lean
$LEAN_TAG$
|
Provides a single reference to an order for the algorithm to maintain. As the order gets updated this ticket will also get updated More...
Public Member Functions | |
OrderTicket (SecurityTransactionManager transactionManager, SubmitOrderRequest submitRequest) | |
Initializes a new instance of the OrderTicket class More... | |
decimal | Get (OrderField field) |
Gets the specified field from the ticket More... | |
T | Get< T > (OrderField field) |
Gets the specified field from the ticket and tries to convert it to the specified type More... | |
OrderResponse | Update (UpdateOrderFields fields) |
Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticket with data specified in fields More... | |
OrderResponse | UpdateTag (string tag) |
Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticket with tag specified in tag More... | |
OrderResponse | UpdateQuantity (decimal quantity, string tag=null) |
Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticket with quantity specified in quantity and with tag specified in quantity More... | |
OrderResponse | UpdateLimitPrice (decimal limitPrice, string tag=null) |
Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticker with limit price specified in limitPrice and with tag specified in tag More... | |
OrderResponse | UpdateStopPrice (decimal stopPrice, string tag=null) |
Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticker with stop price specified in stopPrice and with tag specified in tag More... | |
OrderResponse | UpdateTriggerPrice (decimal triggerPrice, string tag=null) |
Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticker with trigger price specified in triggerPrice and with tag specified in tag More... | |
OrderResponse | UpdateStopTrailingAmount (decimal trailingAmount, string tag=null) |
Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticker with stop trailing amount specified in trailingAmount and with tag specified in tag More... | |
OrderResponse | Cancel (string tag=null) |
Submits a new request to cancel this order More... | |
OrderResponse | GetMostRecentOrderResponse () |
Gets the most recent OrderResponse for this ticket More... | |
OrderRequest | GetMostRecentOrderRequest () |
Gets the most recent OrderRequest for this ticket More... | |
override string | ToString () |
Returns a string that represents the current object. More... | |
Static Public Member Functions | |
static OrderTicket | InvalidCancelOrderId (SecurityTransactionManager transactionManager, CancelOrderRequest request) |
Creates a new OrderTicket that represents trying to cancel an order for which no ticket exists More... | |
static OrderTicket | InvalidUpdateOrderId (SecurityTransactionManager transactionManager, UpdateOrderRequest request) |
Creates a new OrderTicket that represents trying to update an order for which no ticket exists More... | |
static OrderTicket | InvalidSubmitRequest (SecurityTransactionManager transactionManager, SubmitOrderRequest request, OrderResponse response) |
Creates a new OrderTicket that represents trying to submit a new order that had errors embodied in the response More... | |
static implicit | operator int (OrderTicket ticket) |
This is provided for API backward compatibility and will resolve to the order ID, except during an error, where it will return the integer value of the OrderResponseErrorCode from the most recent response More... | |
Public Attributes | |
bool | HasOrder => _order != null |
Returns true if the order has been set for this ticket More... | |
WaitHandle | OrderSet => _orderSetEvent |
Gets a wait handle that can be used to wait until the order has been set More... | |
Properties | |
int | OrderId [get] |
Gets the order id of this ticket More... | |
OrderStatus? | Status [get] |
Gets the current status of this order ticket More... | |
Symbol | Symbol [get] |
Gets the symbol being ordered More... | |
SecurityType | SecurityType [get] |
Gets the Symbol's SecurityType More... | |
decimal? | Quantity [get] |
Gets the number of units ordered More... | |
decimal | AverageFillPrice [get] |
Gets the average fill price for this ticket. If no fills have been processed then this will return a value of zero. More... | |
decimal | QuantityFilled [get] |
Gets the total qantity filled for this ticket. If no fills have been processed then this will return a value of zero. More... | |
DateTime | Time [get] |
Gets the time this order was last updated More... | |
OrderType | OrderType [get] |
Gets the type of order More... | |
string? | Tag [get] |
Gets the order's current tag More... | |
SubmitOrderRequest | SubmitRequest [get] |
Gets the SubmitOrderRequest that initiated this order More... | |
IReadOnlyList< UpdateOrderRequest > | UpdateRequests [get] |
Gets a list of UpdateOrderRequest containing an item for each UpdateOrderRequest that was sent for this order id More... | |
CancelOrderRequest | CancelRequest [get] |
Gets the CancelOrderRequest if this order was canceled. If this order was not canceled, this will return null More... | |
IReadOnlyList< OrderEvent > | OrderEvents [get] |
Gets a list of all order events for this ticket More... | |
WaitHandle | OrderClosed [get] |
Gets a wait handle that can be used to wait until this order has filled More... | |
Provides a single reference to an order for the algorithm to maintain. As the order gets updated this ticket will also get updated
Definition at line 30 of file OrderTicket.cs.
QuantConnect.Orders.OrderTicket.OrderTicket | ( | SecurityTransactionManager | transactionManager, |
SubmitOrderRequest | submitRequest | ||
) |
Initializes a new instance of the OrderTicket class
transactionManager | The transaction manager used for submitting updates and cancels for this ticket |
submitRequest | The order request that initiated this order ticket |
Definition at line 214 of file OrderTicket.cs.
decimal QuantConnect.Orders.OrderTicket.Get | ( | OrderField | field | ) |
Gets the specified field from the ticket
field | The order field to get |
ArgumentException | Field out of range |
ArgumentOutOfRangeException | Field out of range for order type |
Definition at line 233 of file OrderTicket.cs.
T QuantConnect.Orders.OrderTicket.Get< T > | ( | OrderField | field | ) |
Gets the specified field from the ticket and tries to convert it to the specified type
field | The order field to get |
ArgumentException | Field out of range |
ArgumentOutOfRangeException | Field out of range for order type |
Definition at line 245 of file OrderTicket.cs.
OrderResponse QuantConnect.Orders.OrderTicket.Update | ( | UpdateOrderFields | fields | ) |
Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticket with data specified in fields
fields | Defines what properties of the order should be updated |
Definition at line 319 of file OrderTicket.cs.
OrderResponse QuantConnect.Orders.OrderTicket.UpdateTag | ( | string | tag | ) |
Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticket with tag specified in tag
tag | The new tag for this order ticket |
Definition at line 331 of file OrderTicket.cs.
OrderResponse QuantConnect.Orders.OrderTicket.UpdateQuantity | ( | decimal | quantity, |
string | tag = null |
||
) |
Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticket with quantity specified in quantity and with tag specified in quantity
quantity | The new quantity for this order ticket |
tag | The new tag for this order ticket |
Definition at line 347 of file OrderTicket.cs.
OrderResponse QuantConnect.Orders.OrderTicket.UpdateLimitPrice | ( | decimal | limitPrice, |
string | tag = null |
||
) |
Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticker with limit price specified in limitPrice and with tag specified in tag
limitPrice | The new limit price for this order ticket |
tag | The new tag for this order ticket |
Definition at line 364 of file OrderTicket.cs.
OrderResponse QuantConnect.Orders.OrderTicket.UpdateStopPrice | ( | decimal | stopPrice, |
string | tag = null |
||
) |
Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticker with stop price specified in stopPrice and with tag specified in tag
stopPrice | The new stop price for this order ticket |
tag | The new tag for this order ticket |
Definition at line 381 of file OrderTicket.cs.
OrderResponse QuantConnect.Orders.OrderTicket.UpdateTriggerPrice | ( | decimal | triggerPrice, |
string | tag = null |
||
) |
Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticker with trigger price specified in triggerPrice and with tag specified in tag
triggerPrice | The new price which, when touched, will trigger the setting of a limit order. |
tag | The new tag for this order ticket |
Definition at line 398 of file OrderTicket.cs.
OrderResponse QuantConnect.Orders.OrderTicket.UpdateStopTrailingAmount | ( | decimal | trailingAmount, |
string | tag = null |
||
) |
Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticker with stop trailing amount specified in trailingAmount and with tag specified in tag
trailingAmount | The new trailing amount for this order ticket |
tag | The new tag for this order ticket |
Definition at line 415 of file OrderTicket.cs.
OrderResponse QuantConnect.Orders.OrderTicket.Cancel | ( | string | tag = null | ) |
Submits a new request to cancel this order
Definition at line 428 of file OrderTicket.cs.
OrderResponse QuantConnect.Orders.OrderTicket.GetMostRecentOrderResponse | ( | ) |
Gets the most recent OrderResponse for this ticket
Definition at line 450 of file OrderTicket.cs.
OrderRequest QuantConnect.Orders.OrderTicket.GetMostRecentOrderRequest | ( | ) |
Gets the most recent OrderRequest for this ticket
Definition at line 459 of file OrderTicket.cs.
|
static |
Creates a new OrderTicket that represents trying to cancel an order for which no ticket exists
Definition at line 590 of file OrderTicket.cs.
|
static |
Creates a new OrderTicket that represents trying to update an order for which no ticket exists
Definition at line 605 of file OrderTicket.cs.
|
static |
Creates a new OrderTicket that represents trying to submit a new order that had errors embodied in the response
Definition at line 620 of file OrderTicket.cs.
override string QuantConnect.Orders.OrderTicket.ToString | ( | ) |
Returns a string that represents the current object.
<filterpriority>2</filterpriority>
Definition at line 633 of file OrderTicket.cs.
|
static |
This is provided for API backward compatibility and will resolve to the order ID, except during an error, where it will return the integer value of the OrderResponseErrorCode from the most recent response
Definition at line 668 of file OrderTicket.cs.
bool QuantConnect.Orders.OrderTicket.HasOrder => _order != null |
Returns true if the order has been set for this ticket
Definition at line 202 of file OrderTicket.cs.
WaitHandle QuantConnect.Orders.OrderTicket.OrderSet => _orderSetEvent |
Gets a wait handle that can be used to wait until the order has been set
Definition at line 207 of file OrderTicket.cs.
|
get |
Gets the order id of this ticket
Definition at line 57 of file OrderTicket.cs.
|
get |
Gets the current status of this order ticket
Definition at line 65 of file OrderTicket.cs.
|
get |
Gets the symbol being ordered
Definition at line 77 of file OrderTicket.cs.
|
get |
Gets the Symbol's SecurityType
Definition at line 85 of file OrderTicket.cs.
|
get |
Gets the number of units ordered
Definition at line 93 of file OrderTicket.cs.
|
get |
Gets the average fill price for this ticket. If no fills have been processed then this will return a value of zero.
Definition at line 102 of file OrderTicket.cs.
|
get |
Gets the total qantity filled for this ticket. If no fills have been processed then this will return a value of zero.
Definition at line 111 of file OrderTicket.cs.
|
get |
Gets the time this order was last updated
Definition at line 119 of file OrderTicket.cs.
|
get |
Gets the type of order
Definition at line 127 of file OrderTicket.cs.
|
get |
Gets the order's current tag
Definition at line 135 of file OrderTicket.cs.
|
get |
Gets the SubmitOrderRequest that initiated this order
Definition at line 143 of file OrderTicket.cs.
|
get |
Gets a list of UpdateOrderRequest containing an item for each UpdateOrderRequest that was sent for this order id
Definition at line 152 of file OrderTicket.cs.
|
get |
Gets the CancelOrderRequest if this order was canceled. If this order was not canceled, this will return null
Definition at line 167 of file OrderTicket.cs.
|
get |
Gets a list of all order events for this ticket
Definition at line 181 of file OrderTicket.cs.
|
get |
Gets a wait handle that can be used to wait until this order has filled
Definition at line 195 of file OrderTicket.cs.