Creates an order object.
Visual Basic |
---|
Public Function CreateOrder( _ ByVal order_type As eOrderType, _ ByVal cqg_instrument As CQGInstrument, _ ByVal cqg_account As CQGAccount, _ ByVal order_quantity As Long, _ Optional ByVal order_side As eOrderSide = osdUndefined, _ Optional ByVal limit_price As Double = 0, _ Optional ByVal stop_price As Double = 0, _ Optional ByVal ue_name_part As String = "" _ ) As CQGOrder |
- order_type
The type of order which is to be created.Value Description otLimit Limit order.
otMarket Market order.
otStop Stop order.
otStopLimit Stop Limit order.
otUndefined Undefined order type.
- cqg_instrument
- The CQGInstrument object on which the order is to be created.
- cqg_account
- The CQGAccount object for which the order is to be created.
- order_quantity
The quantity value of the order which is to be created.
Note: If the UseOrderSide setting is set to False the side of the order should be reflected by the quantity sign.
- order_side
The side of order which is to be created. The parameter is optional.Value Description osdBuy Side 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.
osdSell Side 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.
osdUndefined Side properties return this value if CQGAPIConfig.UseOrderSide is set to False. - limit_price
- The limit price of the order which is to be created if the orders of current type have a limit price. The parameter is optional.
- stop_price
- The stop price of the order which is to be created if the orders of current type have a stop price. The parameter is optional.
- ue_name_part
- The part of user friendly name of the order to be created which can be given by user. The rest of the UEName is generated automatically. The parameter is optional.
A CQGOrder object which represents the newly created order.
Depending on its type, the order can be either placed as is or some properties should be set before actual placing.
Some of the properties can be modified after order creation and before the order is placed. For more information see the CQGOrder and CQGOrderProperties objects.
The status of the order is set to osNotSent and its state to olsNotSent before the CQGOrder.Place method is called.
See the usage of CreateOrder method in the OrderChanged event's example section.