interface IO2GTableListener

Brief

The interface provides method signatures to process notifications about trading tables events: adding/updating/deleting of rows, and changes in a table status.

Details

The interface can be implemented only your the application uses the O2GTableManager.

Prerequisites

You must specify that your session uses the table manager before a login. For example,

mSession.useTableManager(O2GTableManagerMode.Yes, null);

After the successful login, you must obtain an instance of the O2GTableManager class. For example,

O2GTableManager tableManager = mSession.getTableManager();

The table manager keeps trading tables in memory and therefore allows access to the up-to-date field values and ability to capture table events.
If you want to process notifications for a specific table events, you must obtain an instance of a class derived from the O2GTable class. For example, if you need information about opened positions, write the following line:

O2GTradesTable tradesTable = (O2GTradesTable)tableManager.getTable(O2GTableType.Trades);

For complete instructions on the table manager usage, see the How to use table manager in ForexConnect API section.

Limitations

The IO2GTableListener is notified only about the trading tables updates (see O2GResponseType.TablesUpdates).
Note:In order to process the response that comes as an answer to a request execution, you application needs to implement the IO2GResponseListener interface.

Implementation

If you want to use the methods of the IO2GTableListener interface, you must create a class that implements the interface. For example,

public class TableListener : IO2GTableListener { }

In your application you must create an instance of the class that implements the interface. For example,

TableListener tableListener = new TableListener();

This instance must be subscribed to a table object event.
You must subscribe to each event individually by using different methods of the O2GTable. For example, if you want to process notifications about the Trades table update, call the O2GTable.subscribeUpdate method as follows:

tradesTable.subscribeUpdate(O2GTableUpdateType.Update, tableListener);

Before the logout, you must unsubscribe the listener from the table object. For example,

tradesTable.unsubscribeUpdate(O2GTableUpdateType.Update, tableListener);

Examples of the subscriprion/unsubscription methods syntax are listed below. These examples are based on the Trades table.

Method name

Subscribe syntax

Unsubscribe syntax

onAdded

tradesTable.subscribeUpdate(O2GTableUpdateType.Insert, tableListener);

tradesTable.unsubscribeUpdate(O2GTableUpdateType.Insert, tableListener);

onChanged

tradesTable.subscribeUpdate(O2GTableUpdateType.Update, tableListener);

tradesTable.unsubscribeUpdate(O2GTableUpdateType.Update, tableListener);

onDeleted

tradesTable.subscribeUpdate(O2GTableUpdateType.Delete, tableListener);

tradesTable.unsubscribeUpdate(O2GTableUpdateType.Delete, tableListener);

onStatusChanged

tradesTable.subscribeStatus(tableListener);

tradesTable.unsubscribeStatus(tableListener);

For the interface implementation details, see the example below: Example

Process notifications about opened positions [show]

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

Public Methods

onAdded

Processes a notification about the row addition to a table.

onChanged

Processes a notification about the row change in a table.

onDeleted

Processes a notification about the row deletion from a table.

onStatusChanged

Processes notifications about a table status changes.

back