Lean  $LEAN_TAG$
QuantConnect.Orders Namespace Reference

Classes

class  BinanceOrderProperties
 Contains additional properties and settings for an order submitted to Binance brokerage More...
 
class  BitfinexOrderProperties
 Contains additional properties and settings for an order submitted to Bitfinex brokerage More...
 
class  BrokerageOrderIdChangedEvent
 Event used when the brokerage order id has changed More...
 
class  CancelOrderRequest
 Defines a request to cancel an order More...
 
class  CoinbaseOrderProperties
 Contains additional properties and settings for an order submitted to Coinbase brokerage More...
 
class  ComboLegLimitOrder
 Combo leg limit order type More...
 
class  ComboLimitOrder
 Combo limit order type More...
 
class  ComboMarketOrder
 Combo market order type More...
 
class  ComboOrder
 Combo order type More...
 
class  EzeOrderProperties
 Contains additional properties and settings for an order submitted to EZE brokerage More...
 
class  FixOrderProperites
 FIX (Financial Information Exchange) order properties More...
 
class  FTXOrderProperties
 Contains additional properties and settings for an order submitted to FTX brokerage More...
 
class  GDAXOrderProperties
 Contains additional properties and settings for an order submitted to GDAX brokerage More...
 
class  GroupOrderExtensions
 Group (combo) orders extension methods for easiest combo order manipulation More...
 
class  GroupOrderManager
 Manager of a group of orders More...
 
class  IndiaOrderProperties
 Contains additional properties and settings for an order submitted to Indian Brokerages More...
 
class  InteractiveBrokersOrderProperties
 Contains additional properties and settings for an order submitted to Interactive Brokers More...
 
class  KrakenOrderProperties
 Kraken order properties More...
 
class  Leg
 Basic order leg More...
 
class  LimitIfTouchedOrder
 In effect, a LimitIfTouchedOrder behaves opposite to the StopLimitOrder; after a trigger price is touched, a limit order is set for some user-defined value above (below) the trigger when selling (buying). https://www.interactivebrokers.ca/en/index.php?f=45318 More...
 
class  LimitOrder
 Limit order type definition More...
 
class  MarketOnCloseOrder
 Market on close order type - submits a market order on exchange close More...
 
class  MarketOnOpenOrder
 Market on Open order type, submits a market order when the exchange opens More...
 
class  MarketOrder
 Market order type definition More...
 
class  OptionExerciseOrder
 Option exercise order type definition More...
 
class  Order
 Order struct for placing new trade More...
 
class  OrderEvent
 Order Event - Messaging class signifying a change in an order state and record the change in the user's algorithm portfolio More...
 
class  OrderExtensions
 Provides extension methods for the Order class and for the OrderStatus enumeration More...
 
class  OrderJsonConverter
 Provides an implementation of JsonConverter that can deserialize Orders More...
 
class  OrderProperties
 Contains additional properties and settings for an order More...
 
class  OrderRequest
 Represents a request to submit, update, or cancel an order More...
 
class  OrderResponse
 Represents a response to an OrderRequest. See OrderRequest.Response property for a specific request's response value More...
 
class  OrderSizing
 Provides methods for computing a maximum order size. More...
 
class  OrdersResponseWrapper
 Collection container for a list of orders for a project More...
 
class  OrderSubmissionData
 The purpose of this class is to store time and price information available at the time an order was submitted. More...
 
class  OrderTicket
 Provides a single reference to an order for the algorithm to maintain. As the order gets updated this ticket will also get updated More...
 
class  OrderUpdateEvent
 Event that fires each time an order is updated in the brokerage side. These are not status changes but mainly price changes, like the stop price of a trailing stop order. More...
 
class  RBIOrderProperties
 RBI order properties More...
 
class  StopLimitOrder
 Stop Market Order Type Definition More...
 
class  StopMarketOrder
 Stop Market Order Type Definition More...
 
class  SubmitOrderRequest
 Defines a request to submit a new order More...
 
class  TDAmeritradeOrderProperties
 TDAmeritrade order properties More...
 
class  TerminalLinkOrderProperties
 The terminal link order properties More...
 
class  TimeInForce
 Time In Force - defines the length of time over which an order will continue working before it is canceled More...
 
class  TimeInForceJsonConverter
 Provides an implementation of JsonConverter that can deserialize TimeInForce objects More...
 
class  TradingTechnologiesOrderProperties
 Trading Technologies order properties More...
 
class  TrailingStopOrder
 Trailing Stop Order Type Definition More...
 
class  UpdateOrderFields
 Specifies the data in an order to be updated More...
 
class  UpdateOrderRequest
 Defines a request to update an order's values More...
 
class  WolverineOrderProperties
 Wolverine order properties More...
 

Enumerations

enum  OrderError {
  OrderError.CanNotUpdateFilledOrder = -8, OrderError.GeneralError = -7, OrderError.TimestampError = -6, OrderError.MaxOrdersExceeded = -5,
  OrderError.InsufficientCapital = -4, OrderError.MarketClosed = -3, OrderError.NoData = -2, OrderError.ZeroQuantity = -1,
  OrderError.None = 0
}
 Specifies the possible error states during presubmission checks More...
 
enum  OrderField {
  OrderField.LimitPrice, OrderField.StopPrice, OrderField.TriggerPrice, OrderField.TrailingAmount,
  OrderField.TrailingAsPercentage
}
 Specifies an order field that does not apply to all order types More...
 
enum  OrderRequestStatus { OrderRequestStatus.Unprocessed, OrderRequestStatus.Processing, OrderRequestStatus.Processed, OrderRequestStatus.Error }
 Specifies the status of a request More...
 
enum  OrderRequestType { OrderRequestType.Submit, OrderRequestType.Update, OrderRequestType.Cancel }
 Specifies the type of OrderRequest More...
 
enum  OrderResponseErrorCode {
  OrderResponseErrorCode.None = 0, OrderResponseErrorCode.ProcessingError = -1, OrderResponseErrorCode.OrderAlreadyExists = -2, OrderResponseErrorCode.InsufficientBuyingPower = -3,
  OrderResponseErrorCode.BrokerageModelRefusedToSubmitOrder = -4, OrderResponseErrorCode.BrokerageFailedToSubmitOrder = -5, OrderResponseErrorCode.BrokerageFailedToUpdateOrder = -6, OrderResponseErrorCode.BrokerageHandlerRefusedToUpdateOrder = -7,
  OrderResponseErrorCode.BrokerageFailedToCancelOrder = -8, OrderResponseErrorCode.InvalidOrderStatus = -9, OrderResponseErrorCode.UnableToFindOrder = -10, OrderResponseErrorCode.OrderQuantityZero = -11,
  OrderResponseErrorCode.UnsupportedRequestType = -12, OrderResponseErrorCode.PreOrderChecksError = -13, OrderResponseErrorCode.MissingSecurity = -14, OrderResponseErrorCode.ExchangeNotOpen = -15,
  OrderResponseErrorCode.SecurityPriceZero = -16, OrderResponseErrorCode.ForexBaseAndQuoteCurrenciesRequired = -17, OrderResponseErrorCode.ForexConversionRateZero = -18, OrderResponseErrorCode.SecurityHasNoData = -19,
  OrderResponseErrorCode.ExceededMaximumOrders = -20, OrderResponseErrorCode.MarketOnCloseOrderTooLate = -21, OrderResponseErrorCode.InvalidRequest = -22, OrderResponseErrorCode.RequestCanceled = -23,
  OrderResponseErrorCode.AlgorithmWarmingUp = -24, OrderResponseErrorCode.BrokerageModelRefusedToUpdateOrder = -25, OrderResponseErrorCode.QuoteCurrencyRequired = -26, OrderResponseErrorCode.ConversionRateZero = -27,
  OrderResponseErrorCode.NonTradableSecurity = -28, OrderResponseErrorCode.NonExercisableSecurity = -29, OrderResponseErrorCode.OrderQuantityLessThanLotSize = -30, OrderResponseErrorCode.ExceedsShortableQuantity = -31,
  OrderResponseErrorCode.InvalidNewOrderStatus = -32, OrderResponseErrorCode.EuropeanOptionNotExpiredOnExercise = -33, OrderResponseErrorCode.OptionOrderOnStockSplit = -34
}
 Error detail code More...
 
enum  OrderType {
  OrderType.Market, OrderType.Limit, OrderType.StopMarket, OrderType.StopLimit,
  OrderType.MarketOnOpen, OrderType.MarketOnClose, OrderType.OptionExercise, OrderType.LimitIfTouched,
  OrderType.ComboMarket, OrderType.ComboLimit, OrderType.ComboLegLimit, OrderType.TrailingStop
}
 Type of the order: market, limit or stop More...
 
enum  OrderDirection { OrderDirection.Buy, OrderDirection.Sell, OrderDirection.Hold }
 Direction of the order More...
 
enum  OrderPosition { OrderPosition.BuyToOpen, OrderPosition.BuyToClose, OrderPosition.SellToOpen, OrderPosition.SellToClose }
 Position of the order More...
 
enum  OrderStatus {
  OrderStatus.New = 0, OrderStatus.Submitted = 1, OrderStatus.PartiallyFilled = 2, OrderStatus.Filled = 3,
  OrderStatus.Canceled = 5, OrderStatus.None = 6, OrderStatus.Invalid = 7, OrderStatus.CancelPending = 8,
  OrderStatus.UpdateSubmitted = 9
}
 Fill status of the order class. More...
 

Enumeration Type Documentation

◆ OrderError

Specifies the possible error states during presubmission checks

Enumerator
CanNotUpdateFilledOrder 

Order has already been filled and cannot be modified (-8)

GeneralError 

General error in order (-7)

TimestampError 

Order timestamp error. Order appears to be executing in the future (-6)

MaxOrdersExceeded 

Exceeded maximum allowed orders for one analysis period (-5)

InsufficientCapital 

Insufficient capital to execute order (-4)

MarketClosed 

Attempting market order outside of market hours (-3)

NoData 

There is no data yet for this security - please wait for data (market order price not available yet) (-2)

ZeroQuantity 

Order quantity must not be zero (-1)

None 

The order is OK (0)

Definition at line 23 of file OrderError.cs.

◆ OrderField

Specifies an order field that does not apply to all order types

Enumerator
LimitPrice 

The limit price for a LimitOrder, StopLimitOrder or LimitIfTouchedOrder (0)

StopPrice 

The stop price for stop orders (StopMarketOrder, StopLimitOrder) (1)

TriggerPrice 

The trigger price for a LimitIfTouchedOrder (2)

TrailingAmount 

The trailing amount for a TrailingStopOrder (3)

TrailingAsPercentage 

Whether the trailing amount for a TrailingStopOrder is a percentage or an absolute currency value (4)

Definition at line 21 of file OrderField.cs.

◆ OrderRequestStatus

Specifies the status of a request

Enumerator
Unprocessed 

This is an unprocessed request (0)

Processing 

This request is partially processed (1)

Processed 

This request has been completely processed (2)

Error 

This request encountered an error (3)

Definition at line 21 of file OrderRequestStatus.cs.

◆ OrderRequestType

Specifies the type of OrderRequest

Enumerator
Submit 

The request is a SubmitOrderRequest (0)

Update 

The request is a UpdateOrderRequest (1)

Cancel 

The request is a CancelOrderRequest (2)

Definition at line 21 of file OrderRequestType.cs.

◆ OrderResponseErrorCode

Error detail code

Enumerator
None 

No error (0)

ProcessingError 

Unknown error (-1)

OrderAlreadyExists 

Cannot submit because order already exists (-2)

InsufficientBuyingPower 

Not enough money to to submit order (-3)

BrokerageModelRefusedToSubmitOrder 

Internal logic invalidated submit order (-4)

BrokerageFailedToSubmitOrder 

Brokerage submit error (-5)

BrokerageFailedToUpdateOrder 

Brokerage update error (-6)

BrokerageHandlerRefusedToUpdateOrder 

Internal logic invalidated update order (-7)

BrokerageFailedToCancelOrder 

Brokerage cancel error (-8)

InvalidOrderStatus 

Only pending orders can be canceled (-9)

UnableToFindOrder 

Missing order (-10)

OrderQuantityZero 

Cannot submit or update orders with zero quantity (-11)

UnsupportedRequestType 

This type of request is unsupported (-12)

PreOrderChecksError 

Unknown error during pre order request validation (-13)

MissingSecurity 

Security is missing. Probably did not subscribe (-14)

ExchangeNotOpen 

Some order types require open exchange (-15)

SecurityPriceZero 

Zero security price is probably due to bad data (-16)

ForexBaseAndQuoteCurrenciesRequired 

Need both currencies in cashbook to trade a pair (-17)

ForexConversionRateZero 

Need conversion rate to account currency (-18)

SecurityHasNoData 

Should not attempt trading without at least one data point (-19)

ExceededMaximumOrders 

Transaction manager's cache is full (-20)

MarketOnCloseOrderTooLate 

Below buffer time for MOC order to be placed before exchange closes. 15.5 minutes by default (-21)

InvalidRequest 

Request is invalid or null (-22)

RequestCanceled 

Request was canceled by user (-23)

AlgorithmWarmingUp 

All orders are invalidated while algorithm is warming up (-24)

BrokerageModelRefusedToUpdateOrder 

Internal logic invalidated update order (-25)

QuoteCurrencyRequired 

Need quote currency in cashbook to trade (-26)

ConversionRateZero 

Need conversion rate to account currency (-27)

NonTradableSecurity 

The order's symbol references a non-tradable security (-28)

NonExercisableSecurity 

The order's symbol references a non-exercisable security (-29)

OrderQuantityLessThanLotSize 

Cannot submit or update orders with quantity that is less than lot size (-30)

ExceedsShortableQuantity 

The order's quantity exceeds the max shortable quantity set by the brokerage (-31)

InvalidNewOrderStatus 

Cannot update/cancel orders with OrderStatus.New (-32)

EuropeanOptionNotExpiredOnExercise 

Exercise time before expiry for European options (-33)

OptionOrderOnStockSplit 

Option order is invalid due to underlying stock split (-34)

Definition at line 21 of file OrderResponseErrorCode.cs.

◆ OrderType

Type of the order: market, limit or stop

Enumerator
Market 

Market Order Type (0)

Limit 

Limit Order Type (1)

StopMarket 

Stop Market Order Type - Fill at market price when break target price (2)

StopLimit 

Stop limit order type - trigger fill once pass the stop price; but limit fill to limit price (3)

MarketOnOpen 

Market on open type - executed on exchange open (4)

MarketOnClose 

Market on close type - executed on exchange close (5)

OptionExercise 

Option Exercise Order Type (6)

LimitIfTouched 

Limit if Touched Order Type - a limit order to be placed after first reaching a trigger value (7)

ComboMarket 

Combo Market Order Type - (8)

ComboLimit 

Combo Limit Order Type - (9)

ComboLegLimit 

Combo Leg Limit Order Type - (10)

TrailingStop 

Trailing Stop Order Type - (11)

Definition at line 21 of file OrderTypes.cs.

◆ OrderDirection

Direction of the order

Enumerator
Buy 

Buy Order (0)

Sell 

Sell Order (1)

Hold 

Default Value - No Order Direction (2)

Unfortunately this does not have a value of zero because there are backtests saved that reference the values in this order

Definition at line 87 of file OrderTypes.cs.

◆ OrderPosition

Position of the order

Enumerator
BuyToOpen 

Indicates the buy order will result in a long position, starting either from zero or an existing long position (0)

BuyToClose 

Indicates the buy order is starting from an existing short position, resulting in a closed or long position (1)

SellToOpen 

Indicates the sell order will result in a short position, starting either from zero or an existing short position (2)

SellToClose 

Indicates the sell order is starting from an existing long position, resulting in a closed or short position (3)

Definition at line 112 of file OrderTypes.cs.

◆ OrderStatus

Fill status of the order class.

Enumerator
New 

New order pre-submission to the order processor (0)

Submitted 

Order submitted to the market (1)

PartiallyFilled 

Partially filled, In Market Order (2)

Filled 

Completed, Filled, In Market Order (3)

Canceled 

Order cancelled before it was filled (5)

None 

No Order State Yet (6)

Invalid 

Order invalidated before it hit the market (e.g. insufficient capital) (7)

CancelPending 

Order waiting for confirmation of cancellation (6)

UpdateSubmitted 

Order update submitted to the market (9)

Definition at line 138 of file OrderTypes.cs.