class O2GTradeTableRow

Parents
O2GTradeRow

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

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

O2GTradesTable method

Syntax example

getRow

O2GTradeTableRow trade = tradesTable.getRow(i);

findRow

O2GTradeTableRow trade = tradesTable.findRow(mTradeID);

getNextRow

O2GTradeTableRow trade = tradesTable.getNextRow(mIterator);

getNextRowByColumnValue

O2GTradeTableRow trade = tradesTable.getNextRowByColumnValue("OfferID", mOfferID, mIterator);

getNextRowByColumnValues

O2GTradeTableRow trade = tradesTable.getNextRowByColumnValues("AccountID", new Object[] { "12345", "23456" }, mIterator);

getNextRowByMultiColumnValues

O2GTradeTableRow trade = tradesTable.getNextRowByMultiColumnValues(new String[] { "AccountID", "OfferID" }, new Object[] { mAccountID, mOfferID }, mIterator);

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 individually. 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]

The namespace is com.fxcore2.

Public Methods

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 a cell of the table.

getClose

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

getColumns

Gets the columns of the table.

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 an associated limit order (profit limit level).

getOfferID

Gets the unique identification number of the instrument traded.

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 what 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, the partial closing of which has resulted in the 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