Skip to main content
The GroupApi class provides methods for retrieving and managing trading group configurations.

Constructor

public function __construct(
    ClientInterface $client = null,
    Configuration $config = null,
    HeaderSelector $selector = null
)
Creates a new GroupApi 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

groupsGet

Retrieves a list of all available trading groups.
public function groupsGet(): string[]
string[]
array
Array of group names (strings) available on the MT5 server
Throws:
  • \D4T\MT5Sdk\ApiException - On non-2xx response (200 success, 400 error)
  • \InvalidArgumentException - On invalid arguments
Example:
use D4T\MT5Sdk\MT5Manager\GroupApi;

$groupApi = new GroupApi();

try {
    $groups = $groupApi->groupsGet();
    
    foreach ($groups as $groupName) {
        echo "Group: " . $groupName . "\n";
    }
} catch (\D4T\MT5Sdk\ApiException $e) {
    echo "Error: " . $e->getMessage();
}

groupsGetWithHttpInfo

Retrieves all groups with HTTP response details.
public function groupsGetWithHttpInfo(): array
array
array
Array containing:
  • [0]: string[] - Array of group names
  • [1]: int - HTTP status code
  • [2]: array - HTTP response headers
Throws:
  • \D4T\MT5Sdk\ApiException - On non-2xx response
  • \InvalidArgumentException - On invalid arguments
Example:
list($groups, $statusCode, $headers) = $groupApi->groupsGetWithHttpInfo();

echo "Status: " . $statusCode . "\n";
echo "Total groups: " . count($groups);

groupsGetAsync

Asynchronously retrieves all trading groups.
public function groupsGetAsync(): \GuzzleHttp\Promise\PromiseInterface
PromiseInterface
\GuzzleHttp\Promise\PromiseInterface
Promise that resolves to an array of group names (string[])
Throws:
  • \InvalidArgumentException - On invalid arguments
Example:
$promise = $groupApi->groupsGetAsync();

$promise->then(
    function ($groups) {
        foreach ($groups as $group) {
            echo "Group: " . $group . "\n";
        }
    },
    function ($exception) {
        echo "Error: " . $exception->getMessage();
    }
);

groupsGetAsyncWithHttpInfo

Asynchronously retrieves all groups with HTTP details.
public function groupsGetAsyncWithHttpInfo(): \GuzzleHttp\Promise\PromiseInterface
PromiseInterface
\GuzzleHttp\Promise\PromiseInterface
Promise that resolves to an array containing groups, status code, and headers
Throws:
  • \InvalidArgumentException - On invalid arguments

groupGroupNameGet

Retrieves detailed configuration for a specific trading group.
public function groupGroupNameGet(string $group_name): \D4T\MT5Sdk\Models\Group
group_name
string
required
The name of the group to retrieve
Group
\D4T\MT5Sdk\Models\Group
Group object containing detailed group configuration including:
  • Trading settings
  • Margin requirements
  • Commissions
  • Permissions
  • And other group-specific parameters
Throws:
  • \D4T\MT5Sdk\ApiException - On non-2xx response (200 success, 400 error)
  • \InvalidArgumentException - When group_name is missing or empty
Example:
try {
    $group = $groupApi->groupGroupNameGet('demo\\demoforex');
    
    echo "Group Name: " . $group->getName() . "\n";
    echo "Currency: " . $group->getCurrency() . "\n";
    echo "Leverage: " . $group->getLeverage() . "\n";
    echo "Margin Call: " . $group->getMarginCall() . "%\n";
    echo "Stop Out: " . $group->getStopOut() . "%\n";
} catch (\D4T\MT5Sdk\ApiException $e) {
    echo "Group not found: " . $e->getMessage();
}

groupGroupNameGetWithHttpInfo

Retrieves group details with HTTP response information.
public function groupGroupNameGetWithHttpInfo(string $group_name): array
group_name
string
required
The name of the group to retrieve
array
array
Array containing:
  • [0]: \D4T\MT5Sdk\Models\Group - The group object
  • [1]: int - HTTP status code
  • [2]: array - HTTP response headers
Throws:
  • \D4T\MT5Sdk\ApiException - On non-2xx response
  • \InvalidArgumentException - When group_name is missing
Example:
list($group, $statusCode, $headers) = $groupApi->groupGroupNameGetWithHttpInfo('demo\\demoforex');

echo "Status: " . $statusCode . "\n";
echo "Group: " . $group->getName();

groupGroupNameGetAsync

Asynchronously retrieves group configuration.
public function groupGroupNameGetAsync(string $group_name): \GuzzleHttp\Promise\PromiseInterface
group_name
string
required
The name of the group to retrieve
PromiseInterface
\GuzzleHttp\Promise\PromiseInterface
Promise that resolves to \D4T\MT5Sdk\Models\Group
Throws:
  • \InvalidArgumentException - When group_name is missing
Example:
$promise = $groupApi->groupGroupNameGetAsync('demo\\demoforex');

$promise->then(
    function ($group) {
        echo "Group: " . $group->getName() . "\n";
        echo "Leverage: " . $group->getLeverage();
    },
    function ($exception) {
        echo "Error: " . $exception->getMessage();
    }
);

groupGroupNameGetAsyncWithHttpInfo

Asynchronously retrieves group configuration with HTTP details.
public function groupGroupNameGetAsyncWithHttpInfo(string $group_name): \GuzzleHttp\Promise\PromiseInterface
group_name
string
required
The name of the group to retrieve
PromiseInterface
\GuzzleHttp\Promise\PromiseInterface
Promise that resolves to an array containing the group object, HTTP status code, and response headers
Throws:
  • \InvalidArgumentException - When group_name is missing
Example:
$promise = $groupApi->groupGroupNameGetAsyncWithHttpInfo('demo\\demoforex');

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

Build docs developers (and LLMs) love