class IO2GTradesTableResponseReader

Parents
IO2GGenericTableResponseReader

Brief

The class reads a stream of open position rows coming from the trading server.

Details

All data from the trading server come in the form of responses. The response type depends on the request type. An IO2GResponse object of the GetTrades type comes from the trading server as a response to the request for initial open position information. The response consists of the Trades table rows. Every row is represented by an IO2GTradeRow object. In order to read this response, you must use the O2GTradesTableResponseReader.

Getting the response

If your application uses the IO2GTableManager, the Trades table is always loaded during the login process. This information is kept in an IO2GTradesTable object.

If your application does not use the IO2GTableManager, the initial open position information needs to be requested.
Depending on the trading server settings, the Trades table may or may not be loaded by the server automatically during the login process. To determine whether the table is loaded or not and what follow-up action is required to obtain the GetTrades response, use the returned value of the IO2GLoginRules.isTableLoadedByDefault method:

Returned Value

Follow-up action

true

Call the IO2GLoginRules.getTableRefreshResponse method. For example,

O2GResponse tradesResponse = loginRules.getTableRefreshResponse(O2GTable::Trades);

false

Create a request to get initial open position information by using the IO2GRequestFactory.createRefreshTableRequest method. For example,

O2GRequest request = requestFactory.createRefreshTableRequest(O2GTable::Trades);

In this case, an instance of the IO2GResponse class is the response parameter in your implementation of the IO2GResponseListener.onRequestCompleted method.

Instantiating the class

After receiving the GetTrades response, an instance of the O2GTradesTableResponseReader class can be obtained by calling the IO2GResponseReaderFactory.createTradesTableReader method. For example:

O2G2Ptr<IO2GResponseReaderFactory> responseFactory = session->getResponseReaderFactory();
if (responseFactory)
{
O2G2Ptr<IO2GTradesTableResponseReader> tradesReader = responseFactory->createTradesTableReader(tradesResponse);
...
}

Public Methods

columns

Gets an instance of the class that provides access to the list of table columns.

getCell

Gets the value of a cell.

getGenericRow

Gets a generic row by its index.

getRow

Gets a row from the Trades table.

getType

Gets the type of a trading table.

isCellValid

Checks whether the cell value can be used or not.

size

Gets the number of rows in the reader.

back