class IO2GClosedTradeTableRow

Parents
IO2GClosedTradeRow

Brief

The class provides access to the closed position information.

Details

The class represents a single row of the Closed Trades table.

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 IO2GClosedTradesTable class. For example,

O2GClosedTradesTable closedTradesTable = (O2GClosedTradesTable)tableManager.getTable(O2GTable::ClosedTrades);

Instantiating the class

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

IO2GClosedTradesTable method

Syntax example

getRow

IO2GClosedTradeTableRow *closedTrade = closedTradesTable->getRow(i);

findRow

IO2GClosedTradeTableRow *closedTrade = NULL;
bool bFound = closedTradesTable->findRow(mTradeID, closedTrade);

getNextRow

IO2GClosedTradeTableRow *closedTrade = NULL;
bool bFound = closedTradesTable->getNextRow(mIterator, closedTrade);

getNextRowByColumnValue

IO2GClosedTradeTableRow *closedTrade = NULL;
bool bFound = closedTradesTable->getNextRowByColumnValue("OfferID", (void *)mOfferID, mIterator, closedTrade);

getNextRowByColumnValues

IO2GClosedTradeTableRow *closedTrade = NULL;
const void *values[] = {(void *)"12345", (void *)"23456"};
bool bFound = closedTradesTable->getNextRowByColumnValues("AccountID", 2, values, mIterator, closedTrade);

getNextRowByMultiColumnValues

IO2GClosedTradeTableRow *closedTrade = NULL;
const char *names[] = {"AccountID", "OfferID"};
const void *values[] = {(void *)mAccountID, (void *)mOfferID};
bool bFound = closedTradesTable->getNextRowByMultiColumnValues(2, names, values, mIterator, closedTrade);

If you want to track the Closed Trades 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 to 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

closedTradesTable.subscribeUpdate(O2GTableUpdateType.INSERT, tableListener);

closedTradesTable.unsubscribeUpdate(O2GTableUpdate Type.INSERT, tableListener);

onChanged

closedTradesTable.subscribeUpdate(O2GTableUpdateType.UPDATE, tableListener);

closedTradesTable.unsubscribeUpdate(O2GTableUpdateType.UPDATE, tableListener);

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

O2GClosedTradeTableRow row = (O2GClosedTradeTableRow)(rowData);

Example

Get Trade ID, close rate and gross profit/loss [show]

Public Methods

columns

Gets the columns of the table.

getAccountID

Gets the unique identification number of the position account.

getAccountKind

Gets the type of the position account.

getAccountName

Gets the unique name of the position account.

getAmount

Gets the amount of a closed position.

getBuySell

Gets the trade operation the position is opened by.

getCell

Gets value of a table cell.

getCloseOrderID

Gets the unique identification number of the order the position is closed by.

getCloseOrderParties

Gets the unique identifier of the environment that is used to close the position.

getCloseOrderReqID

Gets the unique identifier of the order the position is closed by.

getCloseOrderRequestTXT

Gets the custom identifier of the order the position is closed by.

getCloseQuoteID

Gets the unique identifier of the pair of prices (bid and ask) the position is closed at.

getCloseRate

Gets the price the position is closed at.

getCloseTime

Gets the date and time when the position is closed.

getCommission

Gets the amount of funds subtracted from the account balance to pay for the broker's service in accordance with the terms and conditions of the account trading agreement.

getGrossPL

Gets the profit/loss of the position.

getOfferID

Gets the unique identification number of a traded instrument.

getOpenOrderID

Gets the unique identification number of the order the position is opened by.

getOpenOrderParties

Gets the unique identifier of the environment that was used to open the position.

getOpenOrderReqID

Gets the unique identifier of the order request the position is opened by.

getOpenOrderRequestTXT

Gets the custom identifier of the order the position is opened by.

getOpenQuoteID

Gets the unique identifier of the pair of prices (bid and ask) the position is opened at.

getOpenRate

Gets the price the position is opened at.

getOpenTime

Gets the date and time when the position is opened.

getPL

Gets the current profit/loss per one lot of the position.

getRolloverInterest

Gets the cumulative amount of funds added to the account balance for holding a position opened overnight.

getTableType

Gets the type of the table.

getTradeID

Gets the unique identification number of the position.

getTradeIDOrigin

Gets the unique identification number of the position, partial closing of which results in opening of the current position.

getTradeIDRemain

Gets the unique identification number of the position opened as a result of the current position partial closing.

getValueDate

Gets the simulated delivery date.

isCellChanged

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

back