class IO2GSummaryTableRow

Parents
IO2GSummaryRow

Brief

The class provides access to the summary information of the instrument traded.

Details

The class represents a single row of the Summary table. The class provides methods to access summarized information, such as buy/sell gross and net profits/losses, average open prices, amounts of long and short positions, etc.

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.
After tables are loaded, you must obtain an instance of the IO2GSummaryTable class. For example,

O2GSummaryTable summaryTable = (O2GSummaryTable)tableManager.getTable(O2GTable::Summary);

Instantiating the class

If you need access to the current summary information, get an instance of the class by calling any of the following methods of the IO2GSummaryTable class:

IO2GSummaryTable method

Syntax example

getRow

IO2GSummaryTableRow *summary = summaryTable->getRow(i);

findRow

IO2GSummaryTableRow *summary = NULL;
bool bFound = summaryTable->findRow(mOfferID, summary);

getNextRow

IO2GSummaryTableRow *summary = NULL;
bool bFound = summaryTable->getNextRow(mIterator, summary);

getNextRowByColumnValue

IO2GSummaryTableRow *summary = NULL;
bool bFound = summaryTable->getNextRowByColumnValue("OfferID", (void *)"1", mIterator, summary);

getNextRowByColumnValues

IO2GSummaryTableRow *summary = NULL;
const void *values[] = {(void *)"1", (void *)"2"};
bool bFound = summaryTable->getNextRowByColumnValues("OfferID", 2, values, mIterator, summary);

getNextRowByMultiColumnValues

IO2GSummaryTableRow *summary = NULL;
const char *names[] = {"OfferID", "Amount"};
const void *values[] = {(void *)mOfferID, (void *)mAmount};
bool bFound = summaryTable->getNextRowByMultiColumnValues(2, names, values, mIterator, summary);

If you want to track the Summary table updates, your application must have a listener class that implements the IO2GTableListener interface. An instance of the listener class must be subscribed to the table updates. Subscription for each update type is done individually. Before the logout, you must unsubscribe the listener from each update type separately. The examples of subscription/unsubscription syntax are listed below.

IO2GTableListener method

Subscribe syntax

Unsubscribe syntax

onAdded

summaryTable.subscribeUpdate(O2GTableUpdateType.INSERT, tableListener);

summaryTable.unsubscribeUpdate(O2GTableUpdateType.INSERT, tableListener);

onChanged

summaryTable.subscribeUpdate(O2GTableUpdateType.UPDATE, tableListener);

summaryTable.unsubscribeUpdate(O2GTableUpdateType.UPDATE, tableListener);

onDeleted

summaryTable.subscribeUpdate(O2GTableUpdateType.DELETE, tableListener);

summaryTable.unsubscribeUpdate(O2GTableUpdateType.DELETE, tableListener);

To instantiate the O2GSummaryTableRow class, you must cast the rowData parameter of the above methods to the O2GSummaryTableRow type. For example,

O2GSummaryTableRow row = (O2GSummaryTableRow)(rowData);

Example

Get Offer ID, net profit/loss and amount for the traded instrument [show]

Public Methods

columns

Gets the columns of the table.

getAmount

Gets the amount of all positions (both long and short).

getBuyAmount

Gets the amount of long (buy) positions.

getBuyAvgOpen

Gets the average open price of long (buy) positions.

getBuyClose

Gets the current market price at which all sell positions opened in the instrument can be closed.

getBuyNetPL

Gets the current profit/loss of all long (buy) positions.

getCell

Gets value of a table cell.

getDefaultSortOrder

Gets the sequence number of the instrument.

getGrossPL

Gets the current profit/loss of all positions (both long and short). It does not include commissions and interests.

getInstrument

Gets the symbol of the instrument. For example, EUR/USD, USD/JPY, GBP/USD.

getNetPL

Gets the current profit/loss of all positions (both long and short). It includes commissions and interests.

getOfferID

Gets the unique identification number of the traded instrument.

getSellAmount

Gets the amount of short (sell) positions.

getSellAvgOpen

Gets the average open price of short (sell) positions.

getSellClose

Gets the current market price at which long (buy) positions can be closed.

getSellNetPL

Gets the current profit/loss of all short (sell) positions.

getTableType

Gets the type of the table.

isCellChanged

Gets a flag indicating whether the value of the cell is changed.

back