Lean  $LEAN_TAG$
QuantConnect.Orders.Order Class Referenceabstract

Order struct for placing new trade More...

Inheritance diagram for QuantConnect.Orders.Order:
[legend]

Public Member Functions

virtual IEnumerable< IPositionCreatePositions (SecurityManager securities)
 Creates an enumerable containing each position resulting from executing this order. More...
 
decimal GetValue (Security security)
 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 More...
 
virtual string GetDefaultTag ()
 Gets the default tag for this order More...
 
virtual void ApplyUpdateOrderRequest (UpdateOrderRequest request)
 Modifies the state of this order to match the update request More...
 
override string ToString ()
 Returns a string that represents the current object. More...
 
abstract Order Clone ()
 Creates a deep-copy clone of this order More...
 

Static Public Member Functions

static Order CreateOrder (SubmitOrderRequest request)
 Creates an Order to match the specified request More...
 

Public Attributes

DateTime CreatedTime => Time
 Gets the utc time this order was created. Alias for Time More...
 
TimeInForce TimeInForce => Properties.TimeInForce
 Order Time In Force More...
 
SecurityType SecurityType => Symbol.ID.SecurityType
 The symbol's security type More...
 
decimal AbsoluteQuantity => Math.Abs(Quantity)
 Get the absolute quantity for this order More...
 
decimal Value => Quantity * Price
 Deprecated More...
 

Protected Member Functions

 Order ()
 Added a default constructor for JSON Deserialization: More...
 
 Order (Symbol symbol, decimal quantity, DateTime time, GroupOrderManager groupOrderManager, string tag="", IOrderProperties properties=null)
 New order constructor More...
 
 Order (Symbol symbol, decimal quantity, DateTime time, string tag="", IOrderProperties properties=null)
 New order constructor More...
 
abstract decimal GetValueImpl (Security security)
 Gets the order value in units of the security's quote currency for a single unit. A single unit here is a single share of stock, or a single barrel of oil, or the cost of a single share in an option contract. More...
 
void CopyTo (Order order)
 Copies base Order properties to the specified order More...
 

Properties

int Id [get, set]
 Order ID. More...
 
int ContingentId [get, set]
 Order id to process before processing this order. More...
 
List< string > BrokerId [get, set]
 Brokerage Id for this order for when the brokerage splits orders into multiple pieces More...
 
Symbol Symbol [get, set]
 Symbol of the Asset More...
 
decimal Price [get, set]
 Price of the Order. More...
 
string PriceCurrency [get, set]
 Currency for the order price More...
 
DateTime Time [get, set]
 Gets the utc time the order was created. More...
 
DateTime? LastFillTime [get, set]
 Gets the utc time the last fill was received, or null if no fills have been received More...
 
DateTime? LastUpdateTime [get, set]
 Gets the utc time this order was last updated, or null if the order has not been updated. More...
 
DateTime? CanceledTime [get, set]
 Gets the utc time this order was canceled, or null if the order was not canceled. More...
 
virtual decimal Quantity [get, set]
 Number of shares to execute. More...
 
abstract OrderType Type [get]
 Order Type More...
 
OrderStatus Status [get, set]
 Status of the Order More...
 
string Tag [get, set]
 Tag the order with some custom data More...
 
IOrderProperties Properties [get]
 Additional properties of the order More...
 
OrderDirection Direction [get]
 Order Direction Property based off Quantity. More...
 
OrderSubmissionData OrderSubmissionData [get, set]
 Gets the price data at the time the order was submitted More...
 
bool IsMarketable [get]
 Returns true if the order is a marketable order. More...
 
GroupOrderManager GroupOrderManager [get, set]
 Manager for the orders in the group if this is a combo order More...
 
DataNormalizationMode PriceAdjustmentMode [get, set]
 The adjustment mode used on the order fill price More...
 

Detailed Description

Order struct for placing new trade

Definition at line 31 of file Order.cs.

Constructor & Destructor Documentation

◆ Order() [1/3]

QuantConnect.Orders.Order.Order ( )
protected

Added a default constructor for JSON Deserialization:

Definition at line 242 of file Order.cs.

◆ Order() [2/3]

QuantConnect.Orders.Order.Order ( Symbol  symbol,
decimal  quantity,
DateTime  time,
GroupOrderManager  groupOrderManager,
string  tag = "",
IOrderProperties  properties = null 
)
protected

New order constructor

Parameters
symbolSymbol asset we're seeking to trade
quantityQuantity of the asset we're seeking to trade
timeTime the order was placed
groupOrderManagerManager for the orders in the group if this is a combo order
tagUser defined data tag for this order
propertiesThe order properties for this order

Definition at line 263 of file Order.cs.

◆ Order() [3/3]

QuantConnect.Orders.Order.Order ( Symbol  symbol,
decimal  quantity,
DateTime  time,
string  tag = "",
IOrderProperties  properties = null 
)
protected

New order constructor

Parameters
symbolSymbol asset we're seeking to trade
quantityQuantity of the asset we're seeking to trade
timeTime the order was placed
tagUser defined data tag for this order
propertiesThe order properties for this order

Definition at line 285 of file Order.cs.

Member Function Documentation

◆ CreatePositions()

virtual IEnumerable<IPosition> QuantConnect.Orders.Order.CreatePositions ( SecurityManager  securities)
virtual

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

This is provided in anticipation of a new combo order type that will need to override this method, returning a position for each 'leg' of the order.

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

Definition at line 298 of file Order.cs.

◆ GetValue()

decimal QuantConnect.Orders.Order.GetValue ( Security  security)

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
securityThe security matching this order's symbol
Returns
The value of this order given the current market price

TODO: we should remove this. Only used in tests

Definition at line 311 of file Order.cs.

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

◆ GetValueImpl()

abstract decimal QuantConnect.Orders.Order.GetValueImpl ( Security  security)
protectedpure virtual

Gets the order value in units of the security's quote currency for a single unit. A single unit here is a single share of stock, or a single barrel of oil, or the cost of a single share in an option contract.

Parameters
securityThe security matching this order's symbol

Implemented in QuantConnect.Orders.LimitIfTouchedOrder, QuantConnect.Orders.StopLimitOrder, QuantConnect.Orders.LimitOrder, QuantConnect.Orders.StopMarketOrder, QuantConnect.Orders.MarketOnCloseOrder, QuantConnect.Orders.MarketOrder, QuantConnect.Orders.ComboLegLimitOrder, QuantConnect.Orders.ComboLimitOrder, QuantConnect.Orders.OptionExerciseOrder, QuantConnect.Orders.MarketOnOpenOrder, and QuantConnect.Orders.ComboMarketOrder.

Here is the caller graph for this function:

◆ GetDefaultTag()

virtual string QuantConnect.Orders.Order.GetDefaultTag ( )
virtual

◆ ApplyUpdateOrderRequest()

virtual void QuantConnect.Orders.Order.ApplyUpdateOrderRequest ( UpdateOrderRequest  request)
virtual

◆ ToString()

override string QuantConnect.Orders.Order.ToString ( )

Returns a string that represents the current object.

Returns
A string that represents the current object.

<filterpriority>2</filterpriority>

Definition at line 370 of file Order.cs.

Here is the call graph for this function:

◆ Clone()

abstract Order QuantConnect.Orders.Order.Clone ( )
pure virtual

◆ CopyTo()

void QuantConnect.Orders.Order.CopyTo ( Order  order)
protected

Copies base Order properties to the specified order

Parameters
orderThe target of the copy

Definition at line 385 of file Order.cs.

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

◆ CreateOrder()

static Order QuantConnect.Orders.Order.CreateOrder ( SubmitOrderRequest  request)
static

Creates an Order to match the specified request

Parameters
requestThe SubmitOrderRequest to create an order for
Returns
The Order that matches the request

Definition at line 413 of file Order.cs.

Here is the caller graph for this function:

Member Data Documentation

◆ CreatedTime

DateTime QuantConnect.Orders.Order.CreatedTime => Time

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

Definition at line 102 of file Order.cs.

◆ TimeInForce

TimeInForce QuantConnect.Orders.Order.TimeInForce => Properties.TimeInForce

Order Time In Force

Definition at line 148 of file Order.cs.

◆ SecurityType

SecurityType QuantConnect.Orders.Order.SecurityType => Symbol.ID.SecurityType

The symbol's security type

Definition at line 166 of file Order.cs.

◆ AbsoluteQuantity

decimal QuantConnect.Orders.Order.AbsoluteQuantity => Math.Abs(Quantity)

Get the absolute quantity for this order

Definition at line 192 of file Order.cs.

◆ Value

decimal QuantConnect.Orders.Order.Value => Quantity * Price

Deprecated

Definition at line 198 of file Order.cs.

Property Documentation

◆ Id

int QuantConnect.Orders.Order.Id
getset

Order ID.

Definition at line 43 of file Order.cs.

◆ ContingentId

int QuantConnect.Orders.Order.ContingentId
getset

Order id to process before processing this order.

Definition at line 62 of file Order.cs.

◆ BrokerId

List<string> QuantConnect.Orders.Order.BrokerId
getset

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

Definition at line 68 of file Order.cs.

◆ Symbol

Symbol QuantConnect.Orders.Order.Symbol
getset

Symbol of the Asset

Definition at line 74 of file Order.cs.

◆ Price

decimal QuantConnect.Orders.Order.Price
getset

Price of the Order.

Definition at line 81 of file Order.cs.

◆ PriceCurrency

string QuantConnect.Orders.Order.PriceCurrency
getset

Currency for the order price

Definition at line 90 of file Order.cs.

◆ Time

DateTime QuantConnect.Orders.Order.Time
getset

Gets the utc time the order was created.

Definition at line 96 of file Order.cs.

◆ LastFillTime

DateTime? QuantConnect.Orders.Order.LastFillTime
getset

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

Definition at line 108 of file Order.cs.

◆ LastUpdateTime

DateTime? QuantConnect.Orders.Order.LastUpdateTime
getset

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

Definition at line 114 of file Order.cs.

◆ CanceledTime

DateTime? QuantConnect.Orders.Order.CanceledTime
getset

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

Definition at line 120 of file Order.cs.

◆ Quantity

virtual decimal QuantConnect.Orders.Order.Quantity
getset

Number of shares to execute.

Definition at line 127 of file Order.cs.

◆ Type

abstract OrderType QuantConnect.Orders.Order.Type
get

Order Type

Definition at line 136 of file Order.cs.

◆ Status

OrderStatus QuantConnect.Orders.Order.Status
getset

Status of the Order

Definition at line 142 of file Order.cs.

◆ Tag

string QuantConnect.Orders.Order.Tag
getset

Tag the order with some custom data

Definition at line 154 of file Order.cs.

◆ Properties

IOrderProperties QuantConnect.Orders.Order.Properties
get

Additional properties of the order

Definition at line 160 of file Order.cs.

◆ Direction

OrderDirection QuantConnect.Orders.Order.Direction
get

Order Direction Property based off Quantity.

Definition at line 173 of file Order.cs.

◆ OrderSubmissionData

OrderSubmissionData QuantConnect.Orders.Order.OrderSubmissionData
getset

Gets the price data at the time the order was submitted

Definition at line 204 of file Order.cs.

◆ IsMarketable

bool QuantConnect.Orders.Order.IsMarketable
get

Returns true if the order is a marketable order.

Definition at line 211 of file Order.cs.

◆ GroupOrderManager

GroupOrderManager QuantConnect.Orders.Order.GroupOrderManager
getset

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

Definition at line 231 of file Order.cs.

◆ PriceAdjustmentMode

DataNormalizationMode QuantConnect.Orders.Order.PriceAdjustmentMode
getset

The adjustment mode used on the order fill price

Definition at line 237 of file Order.cs.


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