The class provides access to account information.
Method/Use |
Prerequisites |
IO2GAccountsTableResponseReader .getRow
This method is used to get the initial account information after a session with the trading server is established.
This method provides access to a single account. If you have multiple accounts, call this method in a loop.
|
Depending on the trading server settings, the Accounts table may or may not be loaded by the server automatically during the login process.
To determine whether the table is loaded or not and what follow-up action is required to get the account information, use the returned value of the IO2GLoginRules ::isTableLoadedByDefault method:
If the table is loaded, you can get the account information by using the IO2GLoginRules .getTableRefreshResponse method;
Otherwise, you must create a request to load the table by using the IO2GRequestFactory .createRefreshTableRequest method.
You must obtain a response to this request in your implementation of the IO2GResponseListener .onRequestCompleted method.
Both methods use the IO2GResponse object of the O2GResponseType .GetAccounts type.
You must parse this object by using the IO2GAccountsTableResponseReader object.
For details, see the example below. |
IO2GTablesUpdatesReader .getAccountRow
This method is used to get account information updates.
This method provides access to a single account. If you have multiple accounts, call this method in a loop. |
To receive the account information updates, you must implement the IO2GResponseListener .onTablesUpdates method.
The received IO2GResponse object is of the O2GResponseType .TablesUpdates type.
You must parse this object by using the IO2GTablesUpdatesReader object.
For details, see the example below. |
Get Account ID, Balance and Used margin [hide]
// Get accounts information
void getAccounts(IO2GSession *session)
{
O2G2Ptr<IO2GLoginRules> loginRules = session->getLoginRules();
// Check if Accounts table is loaded automatically
if (loginRules && loginRules->isTableLoadedByDefault(Accounts))
{
// If table is loaded, use getTableRefreshResponse method
O2G2Ptr<IO2GResponse> accountsResponse = loginRules->getTableRefreshResponse(Accounts);
O2G2Ptr<IO2GResponseReaderFactory> responseFactory = session->getResponseReaderFactory();
if (responseFactory)
{
O2G2Ptr<IO2GAccountsTableResponseReader> accountsReader = responseFactory->createAccountsTableReader(accountsResponse);
for (int i = 0; i < accountsReader->size(); i++)
{
O2G2Ptr<IO2GAccountRow> account = accountsReader->getRow(i);
std::cout << " AccountID = " << account->getAccountID() <<
" Balance = " << account->getBalance() <<
" UsedMargin = " << account->getUsedMargin() << std::endl;
}
}
}
}
// Implementation of IO2GResponseListener interface public method onRequestCompleted
void onRequestCompleted(const char *requestID, IO2GResponse *response)
{
if (mRequestID == requestID)
{
O2G2Ptr<IO2GResponseReaderFactory> readerFactory = mSession->getResponseReaderFactory();
if (readerFactory)
{
O2G2Ptr<IO2GAccountsTableResponseReader> reader = readerFactory->createAccountsTableReader(response);
for (int i = 0; i < reader->size(); i++)
{
O2G2Ptr<IO2GAccountRow> account = reader->getRow(i);
std::cout << " This is a response to your request: \n AccountID = " << account->getAccountID() <<
" Balance = " << account->getBalance() <<
" UsedMargin = " << account->getUsedMargin() << std::endl;
}
}
}
}
// Implementation of IO2GResponseListener interface public method onTablesUpdates
void onTablesUpdates(IO2GResponse *response)
{
O2G2Ptr<IO2GResponseReaderFactory> factory = mSession->getResponseReaderFactory();
if (factory)
{
O2G2Ptr<IO2GTablesUpdatesReader> updatesReader = factory->createTablesUpdatesReader(response);
for (int i = 0; i < updatesReader->size(); i++)
{
if (updatesReader->getUpdateTable(i) == Accounts)
{
O2G2Ptr<IO2GAccountRow> account = updatesReader->getAccountRow(i);
std::cout << " This is a live update: \n AccountID = " << account->getAccountID() <<
" Balance = " << account->getBalance() <<
" UsedMargin = " << account->getUsedMargin() << std::endl;
}
}
}
}
Public Methods |
columns
|
Gets the columns of the table.
|
getAccountID
|
Gets the unique identification number of the account.
|
getAccountKind
|
Gets the type of the account.
|
getAccountName
|
Gets the unique name of the account as it is displayed in the FX Trading Station.
|
getAmountLimit
|
Gets the maximum amount of an order that is allowed on the account.
|
getBalance
|
Gets the amount of funds on the account.
|
getBaseUnitSize
|
Gets the size of one lot.
|
getCell
|
Gets value of a table cell.
|
getLastMarginCallDate
|
Gets the date and time of the last occurrence of a Margin Call.
|
getLeverageProfileID
|
Gets the unique identification number of an account leverage profile which defines the margin requirements.
|
getM2MEquity
|
Gets the equity balance of the account at the beginning of a trading day.
|
getMaintenanceFlag
|
Gets a rollover maintenance flag.
|
getMaintenanceType
|
Gets the type of a position maintenance.
|
getManagerAccountID
|
Gets the unique identification number of the funds manager account.
|
getMarginCallFlag
|
Gets the limitation state of the account.
|
getNonTradeEquity
|
Gets the amount of accounting transactions that is applied to the account during the current trading day.
|
getTableType
|
Gets the type of the table.
|
getUsedMargin
|
Gets the amount of funds used to maintain all open positions on the account.
|
getUsedMargin3
|
Gets the amount of funds used to maintain all open positions on the account with the three-level margin policy.
|
isCellChanged
|
Gets a flag indicating whether the value of the cell is changed.
|