public method IO2GClosedTradesTable.getNextRowByColumnValue

Brief

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

Declaration
C++
virtual bool  getNextRowByColumnValue (const char * columnID, const void * columnValueAsVariant, IO2GTableIterator & iterator, IO2GClosedTradeTableRow *& row) = 0

Parameters
columnID

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

columnValueAsVariant

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

iterator

The table iterator.

row

[out] The row fetched.

Details

This method allows finding all rows that contain the specified value.
If the row is not found, the method returns false

Example

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

    O2G2Ptr<IO2GClosedTradesTable> closedTradesTable = (IO2GClosedTradesTable *)tableManager->getTable(ClosedTrades);
    bool found = false;
    IO2GTableIterator iterator;
    IO2GClosedTradeTableRow *closedTrade = NULL;
    while(closedTradesTable->getNextRowByColumnValue("OfferID", "1", iterator, closedTrade))
    {
        found = true;
        std::cout << "TradeID: " << closedTrade->getTradeID() <<
                     " CloseRate = " << closedTrade->getCloseRate() <<
                     " GrossPL= " << closedTrade->getGrossPL() << std::endl;
        closedTrade->release();
    }
    if (!found)
        std::cout << "You don't have any positions in EUR/USD instrument closed during the current trading day." << std::endl;

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.

Declared in IO2GClosedTradesTable

back