TradeApi class provides methods for retrieving trading information and managing open positions.
Constructor
Guzzle HTTP client instance. If not provided, a new Client will be created.
SDK configuration object. If not provided, a new Configuration will be created.
Header selector instance. If not provided, a new HeaderSelector will be created.
Methods
getConfig
Retrieves the current configuration object.The current SDK configuration object
positionsUserLoginGet
Retrieves all open positions for a specific user.The user login ID to fetch positions for
Array of Position objects representing all open positions for the user
\D4T\MT5Sdk\ApiException- On non-2xx response (200 success, 400 error)\InvalidArgumentException- When user_login is missing
positionsUserLoginGetWithHttpInfo
Retrieves open positions with HTTP response details.The user login ID to fetch positions for
Array containing:
- [0]:
\D4T\MT5Sdk\Models\Position[]- Array of position objects - [1]:
int- HTTP status code - [2]:
array- HTTP response headers
\D4T\MT5Sdk\ApiException- On non-2xx response\InvalidArgumentException- When user_login is missing
ordersUserLoginGet
Retrieves orders for a specific user.The user login ID to fetch orders for
Number of days to look back for historical orders
Order types to retrieve (comma-separated or specific type identifier)
Array of Order objects matching the specified criteria
\D4T\MT5Sdk\ApiException- On non-2xx response (200 success, 400 error)\InvalidArgumentException- When required parameters are missing
ordersUserLoginGetWithHttpInfo
Retrieves orders with HTTP response details.The user login ID to fetch orders for
Number of days to look back
Order types to retrieve
Array containing:
- [0]:
\D4T\MT5Sdk\Models\Order[]- Array of order objects - [1]:
int- HTTP status code - [2]:
array- HTTP response headers
\D4T\MT5Sdk\ApiException- On non-2xx response\InvalidArgumentException- When required parameters are missing
dealsUserLoginGet
Retrieves deal history for a specific user.The user login ID to fetch deals for
Number of days to look back for historical deals
Array of Deal objects representing completed trades and transactions
\D4T\MT5Sdk\ApiException- On non-2xx response (200 success, 400 error)\InvalidArgumentException- When required parameters are missing
dealsUserLoginGetWithHttpInfo
Retrieves deal history with HTTP response details.The user login ID to fetch deals for
Number of days to look back
Array containing:
- [0]:
\D4T\MT5Sdk\Models\Deal[]- Array of deal objects - [1]:
int- HTTP status code - [2]:
array- HTTP response headers
\D4T\MT5Sdk\ApiException- On non-2xx response\InvalidArgumentException- When required parameters are missing
closeAllUserLoginDelete
Closes all open positions for a specific user (flatten account).The user login ID whose positions should be closed
\D4T\MT5Sdk\ApiException- On non-2xx response (400 error)\InvalidArgumentException- When user_login is missing
closeAllUserLoginDeleteWithHttpInfo
Closes all open positions with HTTP response details.The user login ID whose positions should be closed
Array containing:
- [0]:
null- No response body - [1]:
int- HTTP status code - [2]:
array- HTTP response headers
\D4T\MT5Sdk\ApiException- On non-2xx response\InvalidArgumentException- When user_login is missing
Async Method Variants
All methods have async variants with the following naming patterns:methodNameAsync()- Returns a Promise resolving to the response objectmethodNameAsyncWithHttpInfo()- Returns a Promise resolving to [response, statusCode, headers]