public method OrdersBatchAut.Execute, ExecuteAsync

Brief

Executes a batch of requests to create, change or delete orders. Allows creating entry orders and linking them to an OCO order at a time.

Declaration
Visual Basic
Sub Execute (ByRef Result as Variant, ByRef OCOId as Variant)
IDL
[id(2)] HRESULT Execute( [out]VARIANT *pvResult, [out]VARIANT *pvOCOID)
Visual Basic
Sub ExecuteAsync (ByRef psBatchId as Variant, ByRef pvRequestIDList as Variant)
IDL
[id(3)] HRESULT ExecuteAsync( [out]VARIANT* psBatchId, [out]VARIANT* pvRequestIDList)

Parameters
Result

[output] Returns a collection of OrdersBatchResultAut objects. Each element of the collection contains the result of the operation for each order from the batch. The sequence of elements in the collection is the same as the sequence of the trading method calls.
Only for the Execute method. See declarations above.

OCOId

[output] Returns the identifier of the OCO order in case the OrdersBatchAut.JoinOCO property was set to True. Otherwise, returns 0.
Only for the Execute method. See declarations above.

psBatchId

[output]An object that contains the identifier of the batch as string.
Only for the ExecuteAsync method. See declarations above.

psRequestIDList

[output] An object of the StringEnumAut class. Contains the list of RequestIDs.
Only for the ExecuteAsync method. See declarations above.

Details

The method may be executed successfully for some of the orders and may fail for others. In this case the method doesn't fail. Information about failed and successfully executed operations can be retrieved from the output parameter Result.

There are the following restrictions for requests in a batch:

  1. All requests in a batch must have the same operation type ("create order", "change order" or "delete order"). Note that there are requests which can either create or change an order. For example, ChangeTradeStopLimit. These requests can be included either in the "create" or "change" batch depending on the trade operation they perform.
  2. All requests in a batch must be either for regular orders (stop, limit, open, close, entry) or for contingent orders (ELS orders).
  3. All requests in a batch must be for different orders.

You can also create a number of entry orders or ELS orders (with an entry order as a primary order) and link them in an OCO order at a time. Note that the batch must include requests either to create entry orders or to create ELS orders. To create and link orders in an OCO order at a time, you must set the OrdersBatchAut.JoinOCO property to True.

The Execute and ExecuteAsync methods are defined in the OrdersBatchAut class.

back