public method IO2GResponseListener.onTablesUpdates

Brief

Processes notifications about tables updates.

Declaration
C#
void  onTablesUpdates (O2GResponse data)

Parameters
data

The response object. It is provided by the server as a result of trading tables updates. The type of this response is O2GResponseType.TablesUpdates. You must use the O2GResponseReaderFactory. createTablesUpdatesReader method to process this response and to create the O2GTablesUpdatesReader object. For details, see the example below.

Details

In order to process notifications about tables updates, an instance of the class implementing the IO2GResponseListener interface must be subscribed to a session object. It is accomplished by calling the O2GSession.subscribeResponse method.

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

Process notifications about live offer updates [hide]

    // Implementation of IO2GResponseListener interface public method onTablesUpdates
    public void onTablesUpdates(O2GResponse response)
    {
        O2GResponseReaderFactory factory = mSession.getResponseReaderFactory();
        if (factory != null)
        {
            O2GTablesUpdatesReader updatesReader = factory.createTablesUpdatesReader(response);
            for (int i = 0; i < updatesReader.Count; i++)
            {
                O2GTableType tableType = updatesReader.getUpdateTable(i);
                if (tableType == O2GTableType.Offers)
                {
                    O2GOfferRow offer = updatesReader.getOfferRow(i);
                    Console.WriteLine(" This is a live update: \nInstrument = " + offer.Instrument +
                                       " Bid = " +  offer.Bid +
                                       " Ask = " + offer.Ask);
                }
            }
        }
    }
 

Declared in IO2GResponseListener

back