class IO2GTableManager
Parents | |
IAddRef |
Brief
The class creates and maintains trading tables in the ForexConnect memory.
Details
The IO2GTableManager
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
IO2GRequestFactory
.createRefreshTableRequest
or
the IO2GLoginRules
.getTableRefreshResponse
methods.
Capture the TablesUpdates responses.
Maintain the received data in user-created structures.
Advantages of the IO2GTableManager usage
The following list summarizes the advantages that the IO2GTableManager
usage provides:
In-memory representation of the trading tables with up-to-date values by the descendants of the IO2GTable class.
Access to the calculated fields (i.e. PipCost in the Offers table is accessible through the getPipCost method, UsableMargin in the Accounts table is accessible through the getUsableMargin method, etc.). All calculated fields are updated automatically.
Access to the Summary table information through the methods of the IO2GSummaryTableRow 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 decreased performance. It 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 indicate that your session uses the table manager by calling the
IO2GSession
.useTableManager
method. For example,
mSession.useTableManager(Yes, NULL);
After indicating the usage of the table manager for your session, you must log in to the trading server by calling the
IO2GSession
.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 IO2GSession 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 IO2GSession
.getTableManager
method. For example,
IO2GTableManager *tableManager = mSession->getTableManager();
To get an instance of the class that tracks the data for a specific account, call the IO2GSession
.getTableManagerByAccount
method. For example,
IO2GTableManager *tableManager = mSession->getTableManagerByAccount(mAccountID);
In order to use the trading tables data, an instance of the IO2GTableManager
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 IO2GTableManager
class.
In case restoration of a connection fails, the session status changes to Disconnected and you must log in and create a new instance of the IO2GTableManager
class.
In case the ForexConnect API restores the connection successfully, you can use the existing instance of the IO2GTableManager
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]
Public Methods | |
Gets a table manager status. |
|
Gets an instance of a trading table. |
|
Locks tables updates. |
|
Unlocks tables updates. |