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.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 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;
bool bFound = tradesTable.findRow(mTradeID, out trade);

getNextRow

O2GTradeTableRow trade;
bool bFound = tradesTable.getNextRow(mIterator, out trade);

getNextRowByColumnValue

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

getNextRowByColumnValues

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

getNextRowByMultiColumnValues

O2GTradeTableRow trade;
bool bFound = tradesTable.getNextRowByMultiColumnValues(new string[] { "AccountID", "OfferID" }, new object[] { mAccountID, mOfferID }, mIterator, out 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 the 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 above methods to the O2GTradeTableRow type. For example,

O2GTradeTableRow row = (O2GTradeTableRow)(rowData);

Example

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

The type defined in the fxcore2.dll assembly. The namespace is fxcore2.

Public Properties

AccountID

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

AccountKind

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

AccountName

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

Amount

Gets the amount of the position.

BuySell

Gets the trade operation the position is opened by.

Close

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

Columns

The columns of the table.

Commission

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.

GrossPL

Gets the current profit/loss of a position.

Limit

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

OfferID

Gets the unique identification number of the instrument traded.

OpenOrderID

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

OpenOrderReqID

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

OpenOrderRequestTXT

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

OpenQuoteID

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

OpenRate

Gets the price the position is opened at.

OpenTime

Gets the date and time when the position is opened.

Parties

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

PL

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

RolloverInterest

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

Stop

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

TableType

The type of the table.

TradeID

Gets the unique identification number of the open position.

TradeIDOrigin

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

UsedMargin

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

ValueDate

Gets the simulated delivery date.

Public Methods

getCell

Gets a cell of the table.

isCellChanged

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

back