class O2GResponse

Brief

The class contains a response received from the trading server.

Details

There are two types of responses:

The way a response object is processed depends on the response type.

Processing user request responses

To process notifications about a request answer, an instance of the class implementing the IO2GResponseListener interface must be subscribed to a session object by using the subscribeResponse method.
Requests may be successfully completed or may fail.
To process notifications about successful request completions, you must use the IO2GResponseListener.onRequestCompleted method.
To process notifications about request failures, you must use the IO2GResponseListener.onRequestFailed method.

The response type depends on the request type. To find out the type of your response, use the Type method of the O2GResponse class.
To process the contents of a response object, you must use an appropriate reader based on the response type. Readers can be created by using methods of the O2GResponseReaderFactory class.
For the list of the response types, their appropriate readers, and methods required to create them, see the table below:

O2GResponseType

Appropriate reader

O2GResponseReaderFactory method

GetAccounts

O2GAccountsTableResponseReader

createAccountsTableReader

GetOffers

O2GOffersTableResponseReader

createOffersTableReader

GetTrades

O2GTradesTableResponseReader

createTradesTableReader

GetClosedTrades

O2GClosedTradesTableResponseReader

createClosedTradesTableReader

GetMessages

O2GMessagesTableResponseReader

createMessagesTableReader

GetOrders

O2GOrdersTableResponseReader

createOrdersTableReader

GetSystemProperties

O2GSystemPropertiesReader

createSystemPropertiesReader

MarketDataSnapshot

O2GMarketDataSnapshotResponseReader

createMarketDataSnapshotReader

CreateOrderResponse

O2GOrderResponseReader

createOrderResponseReader

Processing tables updates responses

In order to receive notifications about a table updates, you must initially request the information about the table. After successful completion of the initial request, responses of the O2GResponseType.TablesUpdates type are sent automatically each time the table data are changed on the server.
For example, if you want to receive open positions updates, you must first send a request to get the initial open position information.

O2GRequest request = requestFactory.createRefreshTableRequest(O2GTableType.TRADES);

After successful completion of this request, you will receive all updates of the Trades table automatically.

To process notifications about tables updates, an instance of the class implementing the IO2GResponseListener interface must be subscribed to a session object by using the subscribeResponse method.
You must process these notifications by using the IO2GResponseListener.onTablesUpdates method.

To process the contents of a response object, you must use an instance of the O2GTablesUpdatesReader class. To create an instance of the reader, use the createTablesUpdatesReader method.

Note: If your application uses the O2GTableManager, processing of tables updates is done in methods of the class that implements the IO2GTableListener interface.

The type defined in the fxcore2.dll assembly. The namespace is fxcore2.

Public Properties

RequestID

Gets the identifier of the request.

Type

Gets the response type.

back