class IO2GTradesTable

Parents
IO2GTable

Brief

The class keeps in memory the up-to-date information about open positions.

Details

The class is an in-memory representation of the Trades table.
In order to keep this representation in sync with the trading server, you must instantiate the class and listen to the updates coming from the trading server. The class provides methods to find individual open positions, represented by the IO2GTradeTableRow.

Prerequisites

The class is available only through the use of the IO2GTableManager. An IO2GTableManager object must have the O2GTableManagerStatus.TablesLoaded status.
For complete instructions on the table manager usage, see the How to use table manager in ForexConnect API section.

Instantiating the class

In order to get open positions information for the first time, you must obtain an instance of the class by calling the IO2GTableManager.getTable method. For example,

O2GTradesTable tradesTable = (O2GTradesTable)tableManager.getTable(O2GTable::Trades);

Receiving notifications about the Trades table updates

In order to keep the O2GTradesTable data current, your application must listen to the Trades table updates coming from the trading server. These updates represent inserts into the table, changes of the open position information, and deletions from the table. An instance of the class implementing the IO2GTableListener interface must be subscribed to the table updates. Subscription to each update type is done individually. Before the logout, you must unsubscribe the listener from every update type separately. The table below shows the subscription/unsubsription syntax for the O2GTradesTable:

Update type

Subscribe syntax

Unsubscribe syntax

Insert

tradesTable.subscribeUpdate(O2GTableUpdateType.INSERT, tableListener);

tradesTable.unsubscribeUpdate(O2GTableUpdateType.INSERT, tableListener);

Update

tradesTable.subscribeUpdate(O2GTableUpdateType.UPDATE, tableListener);

tradesTable.unsubscribeUpdate(O2GTableUpdateType.UPDATE, tableListener);

Delete

tradesTable.subscribeUpdate(O2GTableUpdateType.DELETE, tableListener);

tradesTable.unsubscribeUpdate(O2GTableUpdateType.DELETE, tableListener);

Public Methods

columns

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

findRow

Finds a row in the IO2GTradesTable by TradeID.

forEachRow

Iterates through the rows of the table.

getCell

Gets the value of a cell.

getGenericRow

Gets a generic row by its index.

getNextGenericRow

Gets the next row from the IO2GTable.

getNextGenericRowByColumnValue

Gets the next row from IO2GTable based on the column value.

getNextGenericRowByColumnValues

Gets the next row from IO2GTable based on any of the column values.

getNextGenericRowByMultiColumnValues

Gets the next row from IO2GTable based on the multiple columns values.

getNextRow

Gets the next row from the IO2GTradesTable.

getNextRowByColumnValue

Gets the next row from IO2GTradesTable based on the column value.

getNextRowByColumnValues

Gets the next row from IO2GTradesTable based on any of the column values.

getNextRowByMultiColumnValues

Gets the next row from IO2GTradesTable based on the multiple columns values.

getRow

Gets a row from the IO2GTradesTable by its index.

getStatus

Gets the status of the table.

getType

Gets the type of a trading table.

isCellChanged

Defines whether the cell is changed.

isCellValid

Checks whether the cell value can be used or not.

size

Gets the number of rows in the reader.

subscribeStatus

Subscribes table listener to changes in table status.

subscribeUpdate

Subscribes table listener to table updates.

unsubscribeStatus

Unsubscribes table listener from changes in table status.

unsubscribeUpdate

Unsubscribes table listener from table updates.

back