Lean  $LEAN_TAG$
QuantConnect.Orders.OrderTicket Class Reference

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...
 
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...
 
OrderStatusStatus [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< UpdateOrderRequestUpdateRequests [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< OrderEventOrderEvents [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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ OrderTicket()

QuantConnect.Orders.OrderTicket.OrderTicket ( SecurityTransactionManager  transactionManager,
SubmitOrderRequest  submitRequest 
)

Initializes a new instance of the OrderTicket class

Parameters
transactionManagerThe transaction manager used for submitting updates and cancels for this ticket
submitRequestThe order request that initiated this order ticket

Definition at line 214 of file OrderTicket.cs.

Here is the caller graph for this function:

Member Function Documentation

◆ Get()

decimal QuantConnect.Orders.OrderTicket.Get ( OrderField  field)

Gets the specified field from the ticket

Parameters
fieldThe order field to get
Returns
The value of the field
Exceptions
ArgumentExceptionField out of range
ArgumentOutOfRangeExceptionField out of range for order type

Definition at line 233 of file OrderTicket.cs.

◆ Get< T >()

Gets the specified field from the ticket and tries to convert it to the specified type

Parameters
fieldThe order field to get
Returns
The value of the field
Exceptions
ArgumentExceptionField out of range
ArgumentOutOfRangeExceptionField out of range for order type

Definition at line 245 of file OrderTicket.cs.

Here is the call graph for this function:

◆ Update()

OrderResponse QuantConnect.Orders.OrderTicket.Update ( UpdateOrderFields  fields)

Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticket with data specified in fields

Parameters
fieldsDefines what properties of the order should be updated
Returns
The OrderResponse from updating the order

Definition at line 319 of file OrderTicket.cs.

Here is the caller graph for this function:

◆ UpdateTag()

OrderResponse QuantConnect.Orders.OrderTicket.UpdateTag ( string  tag)

Submits an UpdateOrderRequest with the SecurityTransactionManager to update the ticket with tag specified in tag

Parameters
tagThe new tag for this order ticket
Returns
OrderResponse from updating the order

Definition at line 331 of file OrderTicket.cs.

Here is the call graph for this function:

◆ UpdateQuantity()

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

Parameters
quantityThe new quantity for this order ticket
tagThe new tag for this order ticket
Returns
OrderResponse from updating the order

Definition at line 347 of file OrderTicket.cs.

Here is the call graph for this function:

◆ UpdateLimitPrice()

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

Parameters
limitPriceThe new limit price for this order ticket
tagThe new tag for this order ticket
Returns
OrderResponse from updating the order

Definition at line 364 of file OrderTicket.cs.

Here is the call graph for this function:

◆ UpdateStopPrice()

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

Parameters
stopPriceThe new stop price for this order ticket
tagThe new tag for this order ticket
Returns
OrderResponse from updating the order

Definition at line 381 of file OrderTicket.cs.

Here is the call graph for this function:

◆ UpdateTriggerPrice()

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

Parameters
triggerPriceThe new price which, when touched, will trigger the setting of a limit order.
tagThe new tag for this order ticket
Returns
OrderResponse from updating the order

Definition at line 398 of file OrderTicket.cs.

Here is the call graph for this function:

◆ UpdateStopTrailingAmount()

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

Parameters
trailingAmountThe new trailing amount for this order ticket
tagThe new tag for this order ticket
Returns
OrderResponse from updating the order

Definition at line 415 of file OrderTicket.cs.

Here is the call graph for this function:

◆ Cancel()

OrderResponse QuantConnect.Orders.OrderTicket.Cancel ( string  tag = null)

Submits a new request to cancel this order

Definition at line 428 of file OrderTicket.cs.

Here is the call graph for this function:

◆ GetMostRecentOrderResponse()

OrderResponse QuantConnect.Orders.OrderTicket.GetMostRecentOrderResponse ( )

Gets the most recent OrderResponse for this ticket

Returns
The most recent OrderResponse for this ticket

Definition at line 450 of file OrderTicket.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMostRecentOrderRequest()

OrderRequest QuantConnect.Orders.OrderTicket.GetMostRecentOrderRequest ( )

Gets the most recent OrderRequest for this ticket

Returns
The most recent OrderRequest for this ticket

Definition at line 459 of file OrderTicket.cs.

Here is the caller graph for this function:

◆ InvalidCancelOrderId()

static OrderTicket QuantConnect.Orders.OrderTicket.InvalidCancelOrderId ( SecurityTransactionManager  transactionManager,
CancelOrderRequest  request 
)
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InvalidUpdateOrderId()

static OrderTicket QuantConnect.Orders.OrderTicket.InvalidUpdateOrderId ( SecurityTransactionManager  transactionManager,
UpdateOrderRequest  request 
)
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InvalidSubmitRequest()

static OrderTicket QuantConnect.Orders.OrderTicket.InvalidSubmitRequest ( SecurityTransactionManager  transactionManager,
SubmitOrderRequest  request,
OrderResponse  response 
)
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToString()

override string QuantConnect.Orders.OrderTicket.ToString ( )

Returns a string that represents the current object.

Returns
A string that represents the current object.

<filterpriority>2</filterpriority>

Definition at line 633 of file OrderTicket.cs.

Here is the call graph for this function:

◆ operator int()

static implicit QuantConnect.Orders.OrderTicket.operator int ( OrderTicket  ticket)
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.

Here is the call graph for this function:

Member Data Documentation

◆ HasOrder

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.

◆ OrderSet

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.

Property Documentation

◆ OrderId

int QuantConnect.Orders.OrderTicket.OrderId
get

Gets the order id of this ticket

Definition at line 57 of file OrderTicket.cs.

◆ Status

OrderStatus? QuantConnect.Orders.OrderTicket.Status
get

Gets the current status of this order ticket

Definition at line 65 of file OrderTicket.cs.

◆ Symbol

Symbol QuantConnect.Orders.OrderTicket.Symbol
get

Gets the symbol being ordered

Definition at line 77 of file OrderTicket.cs.

◆ SecurityType

SecurityType QuantConnect.Orders.OrderTicket.SecurityType
get

Gets the Symbol's SecurityType

Definition at line 85 of file OrderTicket.cs.

◆ Quantity

decimal? QuantConnect.Orders.OrderTicket.Quantity
get

Gets the number of units ordered

Definition at line 93 of file OrderTicket.cs.

◆ AverageFillPrice

decimal QuantConnect.Orders.OrderTicket.AverageFillPrice
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.

◆ QuantityFilled

decimal QuantConnect.Orders.OrderTicket.QuantityFilled
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.

◆ Time

DateTime QuantConnect.Orders.OrderTicket.Time
get

Gets the time this order was last updated

Definition at line 119 of file OrderTicket.cs.

◆ OrderType

OrderType QuantConnect.Orders.OrderTicket.OrderType
get

Gets the type of order

Definition at line 127 of file OrderTicket.cs.

◆ Tag

string? QuantConnect.Orders.OrderTicket.Tag
get

Gets the order's current tag

Definition at line 135 of file OrderTicket.cs.

◆ SubmitRequest

SubmitOrderRequest QuantConnect.Orders.OrderTicket.SubmitRequest
get

Gets the SubmitOrderRequest that initiated this order

Definition at line 143 of file OrderTicket.cs.

◆ UpdateRequests

IReadOnlyList<UpdateOrderRequest> QuantConnect.Orders.OrderTicket.UpdateRequests
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.

◆ CancelRequest

CancelOrderRequest QuantConnect.Orders.OrderTicket.CancelRequest
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.

◆ OrderEvents

IReadOnlyList<OrderEvent> QuantConnect.Orders.OrderTicket.OrderEvents
get

Gets a list of all order events for this ticket

Definition at line 181 of file OrderTicket.cs.

◆ OrderClosed

WaitHandle QuantConnect.Orders.OrderTicket.OrderClosed
get

Gets a wait handle that can be used to wait until this order has filled

Definition at line 195 of file OrderTicket.cs.


The documentation for this class was generated from the following file: