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 when your 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 in memory the trading tables and therefore allows access to the up-to-date field values and
ability to capture table events.
If you want to process notifications about specific table events, you must obtain an instance of the 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 of 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.TABLES_UPDATES).
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 methods of the IO2GTableListener
interface, you must create a class that implements the interface.
For example,
public class TableListener implements 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 updates of the Trades table, 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 subscription/unsubscription methods syntax are listed below. These examples are based on the Trades table.
Method name |
Subscribe syntax |
Unsubscribe syntax |
|
|
|
|
|
|
|
|
|
|
|
For the interface implementation details, see the example below.
Example
Process notifications about opened positions [show]
The namespace is com.fxcore2
.
Public Methods | |
Processes a notification about the row addition to a table. |
|
Processes a notification about the row change in a table. |
|
Processes a notification about the row deletion from a table. |
|
Processes notifications about a table status changes. |