public method IO2GResponseListener.onRequestCompleted

Brief

Processes a notification about the successful request completion.

Declaration
C++
virtual void  onRequestCompleted (const char *requestId, IO2GResponse *response = NULL) = 0

Parameters
requestId

The identifier of the successfully completed request. Session object may send multiple requests (see theIO2GSession.sendRequest method). The method receives notifications of all the requests that have been successfully completed. To make sure you are getting notification about a particular request, you must check if the value of this parameter matches the value obtained by calling the IO2GRequest.getRequestID method. For details, please see the example below.

response

A response object. The type of the response depends on the type of the request. For example, if you request information about open positions, the type of the response will be O2GResponseType.GetTrades. For complete list of response types, see O2GResponseType. The response type defines a reader that can parse the response. For example, if you request information about open positions, you must use the createTradesTableReader method to create the IO2GTradesTableResponseReader object. For a complete list of the methods that create appropriate readers, see the IO2GResponseReaderFactory object.

Details

In order to process a notification about the successful request completion, an instance of the class implementing the IO2GResponseListener interface must be subscribed to a session object. It is accomplished by calling the IO2GSession.subscribeResponse method.

Note: For the order creation request, successful completion means that an order has been validated by the trading server and accepted for execution. It does not mean that the order has been actually inserted in the Orders table.

The order can be rejected if it has been successfully inserted in the Orders table. In case the order is deleted, the order status is \'R\'. The rejected amount is contained in the order amount field. The rejection message is inserted to the Messages table. The rejection message has the "Market Conditions" type(feature). The message text contains the OrderID. The order delete and the reject message notification can be received randomly.

To make sure that the order is inserted to or deleted from the Orders table or the message is inserted to the Messages table, use the following methods:

IO2GTableManager used

Insert Order Method

Delete Order Method

Insert Message Method

YES

IO2GTableListener.onAdded

IO2GTableListener.onDeleted

IO2GTableListener.onAdded

NO

IO2GResponseListener.onTablesUpdates

IO2GResponseListener.onTablesUpdates

IO2GResponseListener.onTablesUpdates

For details of order creation, see the How to Open Position article.

Example

Proccess a notification about a request to get offers [show]

Declared in IO2GResponseListener

back