public method O2GTradesTable.getNextRowByMultiColumnValues

Brief

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

Declaration
Java
O2GTradeTableRow  getNextRowByMultiColumnValues (String[] columnNames, Object[] columnValues, O2GTableIterator iterator)

Parameters
columnNames

The array of column names in the Trades table. For example, BuySell, TradeID.

columnValues

The array of values of the columns specified by the columnNames parameter. For example, if you want to search the Trades table for positions by AccountID 12345 and EUR/USD instrument only, the columnNames parameter value is an array of AccountID and OfferID, and the columnValues parameter is an array of 12345 and 1.

iterator

The table iterator.

Details

If the row is not found, the method returns null.
Note: The returned row contains the current columns 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 by specified AccountID and OfferID from the Trades table [hide]

    public void enumerateTradesByAccountIDAndOfferID(String sAccountID, String sOfferID) {
        O2GTradesTable trades = (O2GTradesTable)mTblMgr.getTable(O2GTableType.TRADES);
        O2GTableIterator iterator = new O2GTableIterator();
        String[] columnNames = new String[] { "AccountID", "OfferID" };
        Object[] columnValues = new Object[] { sAccountID, sOfferID };
        O2GTradeTableRow trade = trades.getNextRowByMultiColumnValues(columnNames, columnValues, iterator);
        while (trade != null) {
            System.out.println(String.format("TradeID=%s, OfferID=%s, Amount=%s",
                    trade.getTradeID(), trade.getOfferID(), trade.getAmount()));
            trade = trades.getNextRowByMultiColumnValues(columnNames, columnValues, iterator);
        }
    }

Declared in O2GTradesTable

back