class IO2GTablesUpdatesReader

Parents
IAddRef

Brief

The class reads a stream of table updates coming from the trading server.

Details

If your application uses the IO2GTableManager class, the table updates must be captured in the methods of the class implementing the IO2GTableListener interface. In this case, the usage of the IO2GTablesUpdatesReader class is not required.

If your application does not use the IO2GTableManager class and you request initial trading tables information, the following sequence of events occurs:

  1. The trading server sends a response to the initial request. For example, if you request initial accounts information, the response is of the GetAccounts type; if you request initial orders information, the response is of the GetOrders type, etc. Notifications about the successful completion of these requests must be processed by using the IO2GResponseListener.onRequestCompleted method.

  2. The server sends responses about updates of the initially requested tables automatically. These responses are of the TablesUpdates type and must be processed by using the IO2GResponseListener.onTablesUpdates method.

To process the contents of a response object of the TablesUpdates type, you must use an instance of the IO2GTablesUpdatesReader class. To get an instance of the class, use the IO2GResponseReaderFactory.createTablesUpdatesReader method by passing the response parameter of the IO2GResponseListener.onTablesUpdates method as an argument. For example,

O2GTablesUpdatesReader updatesReader = factory.createTablesUpdatesReader(response);

Example

IO2GTablesUpdatesReader [hide]

 void ResponseListener::onTablesUpdates(IO2GResponse *data)
 {
     O2G2Ptr<IO2GResponseReaderFactory> factory = mSession->getResponseReaderFactory();
     if (factory)
     {
         O2G2Ptr<IO2GTablesUpdatesReader> reader = factory->createTablesUpdatesReader(data);
         for (int i = 0; i < reader->size(); ++i)
         {
             if (reader->getUpdateType(i) == Insert)
             {
                 if (mOrderID.length() != 0)
                 {
                     O2G2Ptr<IO2GOrderRow> orderRow = reader->getOrderRow(i);
                     //...
                 }
             }
         }
     }
 }

Public Methods

getAccountRow

Gets an instance of the class that provides access to the account information.

getClosedTradeRow

Gets an instance of the class that provides access to the closed position information.

getMessageRow

Gets an instance of the class that provides access to the message information.

getOfferRow

Gets an instance of the class that provides access to the offer information.

getOrderRow

Gets an instance of the class that provides access to the order information.

getServerTime

Gets a calendar instance representing the date/time of a table update.

getTradeRow

Gets an instance of the class that provides access to the open position information.

getUpdateTable

Gets the table that is updated.

getUpdateType

Gets the type of a table update.

size

Gets the number of rows in the reader.

back