Skip to main content
The AccountApi class provides methods for retrieving and managing trading account information.

Constructor

public function __construct(
    ClientInterface $client = null,
    Configuration $config = null,
    HeaderSelector $selector = null
)
Creates a new AccountApi instance.
client
ClientInterface
Guzzle HTTP client instance. If not provided, a new Client will be created.
config
Configuration
SDK configuration object. If not provided, a new Configuration will be created.
selector
HeaderSelector
Header selector instance. If not provided, a new HeaderSelector will be created.

Methods

getConfig

Retrieves the current configuration object.
public function getConfig(): Configuration
Configuration
Configuration
The current SDK configuration object

accountLoginGet

Retrieves account information by user login.
public function accountLoginGet(string $login): \D4T\MT5Sdk\Models\Account
login
string
required
User login ID to retrieve account information for
Account
\D4T\MT5Sdk\Models\Account
Account object containing account details including balance, equity, margin, and other account metrics
Throws:
  • \D4T\MT5Sdk\ApiException - On non-2xx response (200 success, 400 error)
  • \InvalidArgumentException - When login parameter is missing or empty
Example:
use D4T\MT5Sdk\MT5Manager\AccountApi;

$accountApi = new AccountApi();

try {
    $account = $accountApi->accountLoginGet('12345');
    
    echo "Balance: " . $account->getBalance() . "\n";
    echo "Equity: " . $account->getEquity() . "\n";
    echo "Margin: " . $account->getMargin() . "\n";
} catch (\D4T\MT5Sdk\ApiException $e) {
    echo "Error: " . $e->getMessage();
}

accountLoginGetWithHttpInfo

Retrieves account information with HTTP response details.
public function accountLoginGetWithHttpInfo(string $login): array
login
string
required
User login ID to retrieve account information for
array
array
Array containing:
  • [0]: \D4T\MT5Sdk\Models\Account - The account object
  • [1]: int - HTTP status code
  • [2]: array - HTTP response headers
Throws:
  • \D4T\MT5Sdk\ApiException - On non-2xx response (200 success, 400 error)
  • \InvalidArgumentException - When login parameter is missing or empty
Example:
list($account, $statusCode, $headers) = $accountApi->accountLoginGetWithHttpInfo('12345');

echo "Status: " . $statusCode . "\n";
echo "Balance: " . $account->getBalance();

accountLoginGetAsync

Asynchronously retrieves account information by user login.
public function accountLoginGetAsync(string $login): \GuzzleHttp\Promise\PromiseInterface
login
string
required
User login ID to retrieve account information for
PromiseInterface
\GuzzleHttp\Promise\PromiseInterface
Promise that resolves to \D4T\MT5Sdk\Models\Account
Throws:
  • \InvalidArgumentException - When login parameter is missing or empty
Example:
$promise = $accountApi->accountLoginGetAsync('12345');

$promise->then(
    function ($account) {
        echo "Balance: " . $account->getBalance();
    },
    function ($exception) {
        echo "Error: " . $exception->getMessage();
    }
);

accountLoginGetAsyncWithHttpInfo

Asynchronously retrieves account information with HTTP details.
public function accountLoginGetAsyncWithHttpInfo(string $login): \GuzzleHttp\Promise\PromiseInterface
login
string
required
User login ID to retrieve account information for
PromiseInterface
\GuzzleHttp\Promise\PromiseInterface
Promise that resolves to an array containing the account object, HTTP status code, and response headers
Throws:
  • \InvalidArgumentException - When login parameter is missing or empty
Example:
$promise = $accountApi->accountLoginGetAsyncWithHttpInfo('12345');

$promise->then(
    function ($response) {
        list($account, $statusCode, $headers) = $response;
        echo "Status: " . $statusCode . "\n";
        echo "Balance: " . $account->getBalance();
    }
);

Build docs developers (and LLMs) love