public method O2GTradesTable.getNextRowByColumnValue

Brief

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

Declaration
Java
O2GTradeTableRow  getNextRowByColumnValue (String columnId, Object columnValue, O2GTableIterator iterator)

Parameters
columnId

The name of a column in the Trades table. For example, OfferID.

columnValue

The value of the column specified by the columnId parameter. For example, if you want to search the Trades table for open positions in the EUR/USD instrument only, the columnId parameter value is OfferID, the columnValue parameter value is 1.

iterator

The table iterator.

Details

If the row is not found, the method returns null.
Note: The returned row contains the current column values. The values are not automatically updated. To monitor changes, use IO2GTableListener.onChanged. The row interface is thread-safe. The returned row can be used in different threads without synchronization.

Example

Get open positions in EUR/USD from the Trades table [hide]

    O2GTradesTable tradesTable = (O2GTradesTable)tableManager.getTable(O2GTableType.TRADES);
    boolean found = false;
    O2GTableIterator iterator = new O2GTableIterator();
    O2GTradeTableRow trade = tradesTable.getNextRowByColumnValue("OfferID", "1", iterator);
    while (trade != null) {
        found = true;
        System.out.println("TradeID: " + trade.getTradeID() +
                           " OfferID = " + trade.getOfferID() +
                           " Amount = " + trade.getAmount());
        trade = tradesTable.getNextRowByColumnValue("OfferID", "1", iterator);
    }
    if (!found) {
        System.out.println("You don't have any open positions in EUR/USD instrument.");
    }

Declared in O2GTradesTable

back