class IO2GTradeTableRow

Parents
IO2GTradeRow

Brief

The class provides access to the open position information and calculated fields.

Details

The class represents a single row of the Trades table. In addition to the methods of its parent class, the O2GTradeTableRow class provides methods to access calculated fields, such as current profit/loss for a position, current profit/loss per one lot, prices of associated stop/limit orders, and current close price.

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

O2GTradesTable tradesTable = (O2GTradesTable)tableManager.getTable(O2GTable::Trades);

Instantiating the class

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

IO2GTradesTable method

Syntax example

getRow

IO2GTradeTableRow *trade = tradesTable->getRow(i);

findRow

IO2GTradeTableRow *trade = NULL;
bool bFound = tradesTable->findRow(mTradeID, trade);

getNextRow

IO2GTradeTableRow *trade = NULL;
bool bFound = tradesTable->getNextRow(mIterator, trade);

getNextRowByColumnValue

IO2GTradeTableRow *trade = NULL;
bool bFound = tradesTable->getNextRowByColumnValue("OfferID", (void *)mOfferID, mIterator, trade);

getNextRowByColumnValues

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

getNextRowByMultiColumnValues

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

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

tradesTable.subscribeUpdate(O2GTableUpdateType.INSERT, tableListener);

tradesTable.unsubscribeUpdate(O2GTableUpdateType.INSERT, tableListener);

onChanged

tradesTable.subscribeUpdate(O2GTableUpdateType.UPDATE, tableListener);

tradesTable.unsubscribeUpdate(O2GTableUpdateType.UPDATE, tableListener);

onDeleted

tradesTable.subscribeUpdate(O2GTableUpdateType.DELETE, tableListener);

tradesTable.unsubscribeUpdate(O2GTableUpdateType.DELETE, tableListener);

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

O2GTradeTableRow row = (O2GTradeTableRow)(rowData);

Example

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

Public Methods

columns

Gets the columns of the table.

getAccountID

Gets the unique identification number of the account the position is opened on.

getAccountKind

Gets the type of the account the position is opened on.

getAccountName

Gets the unique name of the account the position is opened on.

getAmount

Gets the amount of the position.

getBuySell

Gets the trade operation the position is opened by.

getCell

Gets value of a table cell.

getClose

Gets the price at which a position can be closed at the moment.

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 current profit/loss of a position.

getLimit

Gets the price of the associated limit order (profit limit level).

getOfferID

Gets the unique identification number of the traded instrument.

getOpenOrderID

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

getOpenOrderReqID

Gets the 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.

getParties

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

getPL

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

getRolloverInterest

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

getStop

Gets the price of an associated stop order (loss limit level).

getTableType

Gets the type of the table.

getTradeID

Gets the unique identification number of the open position.

getTradeIDOrigin

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

getUsedMargin

Gets the amount of funds currently committed to maintain the position.

getValueDate

Gets the simulated delivery date.

isCellChanged

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

back