class O2GTableManager
Brief
The class creates and maintains trading tables in the ForexConnect memory.
Details
The O2GTableManager
allows creating and maintaining in-memory representations of the trading tables.
The tables updates are handled by the ForexConnect API automatically.
For implementation details, refer to the ForexConnect API Class Hierarchy section.
Alternatively, you can:
Request the initial data from the trading server by calling the
O2GRequestFactory
.createRefreshTableRequest
or the
O2GLoginRules
.getTableRefreshResponse
methods.
Capture the TablesUpdates responses.
Maintain the received data in user-created structures.
Advantages of the O2GTableManager usage
The following list summarizes the advantages that the O2GTableManager
usage provides:
In-memory representation of the trading tables with up-to-date values by the descendants of the O2GTable class.
Access to the calculated fields (i.e. PipCost in the Offers table is accessible through the use of the PipCost method, UsableMargin in the Accounts table is accessible through the use of the UsableMargin method, etc.). All calculated fields are updated automatically.
Access to the Summary table information through the use of the methods of the O2GSummaryTableRow class.
Separate subscriptions to trading table events. The events are described in the IO2GTableListener interface documentation.
Note: The disadvantage of the table manager usage is the decrease in performance. The performance decreases because the values of the calculated fields are computed with every price change. If your application does not need the values of the calculated fields, the table manager usage is not recommended.
Prerequisites
Before the login, you must specify that your session uses the table manager by calling the
O2GSession
.useTableManager
method. For example,
mSession.useTableManager(O2GTableManagerMode.YES, null);
After specifying the usage of the table manager for your session, you must log in to the trading server by calling the
O2GSession
.login
method. For example,
mSession.login(mUserID, mPassword, mURL, mConnection);
Instantiating the class
An instance of the table manager can be obtained only after an O2GSession object gets the Connected status.
You can track the trading tables data for all your accounts or for each account individually.
To get an instance of the class that tracks the data for all accounts, call the O2GSession
.getTableManager
method. For example,
O2GTableManager tableManager = mSession.getTableManager();
To get an instance of the class that tracks the data for a specific account, call the O2GSession
.getTableManagerByAccount
method. For example,
O2GTableManager tableManager = mSession.getTableManagerByAccount(mAccountID);
In order to use the trading tables data, an instance of the O2GTableManager
class must have the TablesLoaded status.
Note: If the connection between the ForexConnect API and the trading server is lost, you may need to re-create an instance of the O2GTableManager
class.
In case the restoration of the connection fails, the session status changes to Disconnected and you must log in and create a new instance of the O2GTableManager
class.
In case the ForexConnect API restores the connection successfully, you can use the existing instance of the O2GTableManager
class.
For a detailed explanation of the session statuses, refer to the Session Statuses section.
For complete details of the table manager usage, refer to the How to use a table manager in ForexConnect API section.
Example
Get close price and current profit/loss [show]
The type defined in the fxcore2.dll
assembly.
The namespace is fxcore2
.
Public Methods | |
Gets a table manager status. |
|
Gets an instance of a trading table. |
|
Locks tables updates. |
|
Unlocks tables updates. |