CQG API 4.0 - Revised
QueryOrders Method
See Also  Send Feedback
cqg_account
A CQGAccount object representing the account historical orders of which should be retrieved.
cqg_instrument
An optional CQGInstrument object representing the instrument the historical orders on which should be retrieved.
status_filter
Order status filter allowing to select the historical orders by their statuses. This parameter is optional.
date_

A Date variable, specifying the day of the requested orders.

The date parameter applies only on orders that are in their final state.

Notes:

  • If the other filters are set so that the working orders are going to be retrieved as well, all working orders will be retrieved regardless of the Date value.
  • If the date is not specified, the current date will be used.
  • If date exceeds the user-limit, an error will be thrown.
order_side
Identifies the side of the historical orders to be retrieved. The parameter is optional
CQGCEL Interface : QueryOrders Method

Glossary Item Box

Description

Sends a historical orders information query. The query is constructed based on the passed arguments.

Syntax

Visual Basic
Public Function QueryOrders( _
   ByVal cqg_account As CQGAccount, _
   Optional ByVal cqg_instrument As CQGInstrument = 0, _
   Optional ByVal status_filter As eOrderStatusFilter = osfAll, _
   Optional ByVal date_ As Date = "12/30/1899 12:00:00 AM", _
   Optional ByVal order_side As eOrderSide = osdUndefined _
) As CQGOrdersQuery

Parameters

cqg_account
A CQGAccount object representing the account historical orders of which should be retrieved.
cqg_instrument
An optional CQGInstrument object representing the instrument the historical orders on which should be retrieved.
status_filter
ValueDescription
osfAllOrders with any Gateway status.
osfCanceledCancelled orders.
osfException

Orders with errors or rejected orders.

osfFilled

Orders that have at least 1 fill.

osfFinalFinal orders, i.e. orders, Gateway statuses of which are one of the following: osRejectGW, osRejectFCM, osExpired, osCanceled, osFilled, osBusted, osParked, osInTransitTimeout.
osfNotFinal

Not final orders, i.e. orders, Gateway statuses of which are one of the following: osInOrderBook, osInTransit, osActiveAt, osContingent, osDisconnected, osInCancel, osInModify.

osfParked

Parked and contingent orders.

Order status filter allowing to select the historical orders by their statuses. This parameter is optional.
date_

A Date variable, specifying the day of the requested orders.

The date parameter applies only on orders that are in their final state.

Notes:

  • If the other filters are set so that the working orders are going to be retrieved as well, all working orders will be retrieved regardless of the Date value.
  • If the date is not specified, the current date will be used.
  • If date exceeds the user-limit, an error will be thrown.
order_side
ValueDescription
osdBuySide properties return this value if CQGAPIConfig.UseOrderSide is set to True.

Depending on the owner, osdBuy value is returned in case of:

  • the object is a CQGTrade referring to a buy trade
  • the object is a CQGPosition referring to a long position.

  • the object is a CQGOrder referring to an order of buy type.
  • the object is a CQGFill referring to a fill of buy type.
osdSellSide properties return this value if CQGAPIConfig.UseOrderSide is set to True.

Depending on the owner, osdSell value is returned in case of:

  • the object is a CQGTrade referring to a sell trade
  • the object is a CQGPosition referring to a short position.

  • the object is a CQGOrder referring to an order of sell type.
  • the object is a CQGFill referring to a fill of sell type.
osdUndefinedSide properties return this value if CQGAPIConfig.UseOrderSide is set to False.
Identifies the side of the historical orders to be retrieved. The parameter is optional

Return Type

The query object represented as CQGOrdersQuery

Remarks

This method works in asynchronous mode, i.e. its results are not available after the method return.

The order progress will be notified via OnQueryProgress event.

Example

See the usage of QueryOrders method in the OnQueryProgress event's example section.

See Also