class O2GSummaryTableRow

Parents
O2GSummaryRow

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 O2GTableManager. An O2GTableManager object must have the O2GTableManagerStatus.TABLES_LOADED 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 O2GSummaryTable class. For example,

O2GSummaryTable summaryTable = (O2GSummaryTable)tableManager.getTable(O2GTableType.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 O2GSummaryTable class:

O2GSummaryTable method

Syntax example

getRow

O2GSummaryTableRow summary = summaryTable.getRow(i);

findRow

O2GSummaryTableRow summary = summaryTable.findRow(mOfferID);

getNextRow

O2GSummaryTableRow summary = summaryTable.getNextRow(mIterator);

getNextRowByColumnValue

O2GSummaryTableRow summary = summaryTable.getNextRowByColumnValue("OfferID", "1", mIterator);

getNextRowByColumnValues

O2GSummaryTableRow summary = summaryTable.getNextRowByColumnValues("OfferID", new Object[] { "1", "2" }, mIterator);

getNextRowByMultiColumnValues

O2GSummaryTableRow summary = summaryTable.getNextRowByMultiColumnValues(new String[] { "OfferID", "Amount" }, new Object[] { mOfferID, mAmount }, mIterator);

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 individually. 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 methods above to the O2GSummaryTableRow type. For example,

O2GSummaryTableRow row = (O2GSummaryTableRow)(rowData);

Example

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

The namespace is com.fxcore2.

Public Methods

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 short (sell) positions can be closed.

getBuyNetPL

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

getCell

Gets a cell of the table.

getColumns

Gets the columns of the table.

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 traded. 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 instrument traded.

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