All URIs are relative to https://api.gateio.ws/api/v4
| Method | HTTP request | Description |
|---|---|---|
| listUnifiedAccounts | GET /unified/accounts | Get unified account information |
| getUnifiedBorrowable | GET /unified/borrowable | Query maximum borrowable amount for unified account |
| getUnifiedTransferable | GET /unified/transferable | Query maximum transferable amount for unified account |
| getUnifiedTransferables | GET /unified/transferables | Get maximum transferable amounts for multiple unified-account currencies |
| getUnifiedBorrowableList | GET /unified/batch_borrowable | Batch query unified account maximum borrowable amount |
| listUnifiedLoans | GET /unified/loans | Query loans |
| createUnifiedLoan | POST /unified/loans | Borrow or repay |
| listUnifiedLoanRecords | GET /unified/loan_records | Query loan records |
| listUnifiedLoanInterestRecords | GET /unified/interest_records | Query interest deduction records |
| getUnifiedRiskUnits | GET /unified/risk_units | Get user risk unit details |
| getUnifiedMode | GET /unified/unified_mode | Query mode of the unified account |
| setUnifiedMode | PUT /unified/unified_mode | Set unified account mode |
| getUnifiedEstimateRate | GET /unified/estimate_rate | Query unified account estimated interest rate |
| listCurrencyDiscountTiers | GET /unified/currency_discount_tiers | Get currency margin discount tiers for unified accounts |
| listLoanMarginTiers | GET /unified/loan_margin_tiers | Query unified account tiered loan margin |
| calculatePortfolioMargin | POST /unified/portfolio_calculator | Portfolio margin calculator |
| setUserLeverage | POST /unified/leverage/user_setting | Set leverage for all of the user's borrowed currencies |
| getUserLeverageCurrencyConfig | GET /unified/leverage/user_currency_config | Maximum and minimum currency leverage that can be set |
| getUserLeverageCurrencySetting | GET /unified/leverage/user_currency_setting | Get user currency leverage |
| setUserLeverageCurrencySetting | POST /unified/leverage/user_currency_setting | Set loan currency leverage |
| listUnifiedCurrencies | GET /unified/currencies | List of loan currencies supported by unified account |
| getHistoryLoanRate | GET /unified/history_loan_rate | Get historical lending rates |
| setUnifiedCollateral | POST /unified/collateral_currencies | Set collateral currency |
| getEstimatedQuickRepayment | GET /unified/estimated_quick_repayment | Estimated quick repayment details |
| createQuickRepayment | POST /unified/quick_repayment | Quick repayment |
| getUnifiedDeltaNeutral | GET /unified/delta_neutral | Query the account Delta-neutral strategy mode setting |
| setUnifiedDeltaNeutral | POST /unified/delta_neutral | Set the account Delta-neutral strategy mode |
\GateApi\Model\UnifiedAccount listUnifiedAccounts($currency, $sub_uid)
Get unified account information
The assets of each currency in the account are assigned adjustment coefficients according to their liquidity and uniformly converted to USD to calculate the account's asset and position values. For details, see Margin Formula.
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $associate_array['currency'] = 'BTC'; // string | Query by specified currency name $associate_array['sub_uid'] = '10001'; // string | Sub account user ID try { $result = $apiInstance->listUnifiedAccounts($associate_array); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->listUnifiedAccounts: ', $e->getMessage(), PHP_EOL; } ?>
Note: the input parameter is an associative array with the keys listed as the parameter name below.
| Name | Type | Description | Notes |
|---|---|---|---|
| currency | string | Query by specified currency name | [optional] |
| sub_uid | string | Sub account user ID | [optional] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedBorrowable getUnifiedBorrowable($currency)
Query maximum borrowable amount for unified account
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $currency = 'BTC'; // string | Query by specified currency name try { $result = $apiInstance->getUnifiedBorrowable($currency); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->getUnifiedBorrowable: ', $e->getMessage(), PHP_EOL; } ?>
| Name | Type | Description | Notes |
|---|---|---|---|
| currency | string | Query by specified currency name |
\GateApi\Model\UnifiedBorrowable
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedTransferable getUnifiedTransferable($currency)
Query maximum transferable amount for unified account
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $currency = 'BTC'; // string | Query by specified currency name try { $result = $apiInstance->getUnifiedTransferable($currency); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->getUnifiedTransferable: ', $e->getMessage(), PHP_EOL; } ?>
| Name | Type | Description | Notes |
|---|---|---|---|
| currency | string | Query by specified currency name |
\GateApi\Model\UnifiedTransferable
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\TransferablesResult[] getUnifiedTransferables($currencies)
Get maximum transferable amounts for multiple unified-account currencies
Each currency’s value is its maximum transferable amount. After a user withdrawal, the transferable amounts for all currencies will change.
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $currencies = 'BTC,ETH'; // string | Specify the currency name to query in batches, and support up to 100 pass parameters at a time try { $result = $apiInstance->getUnifiedTransferables($currencies); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->getUnifiedTransferables: ', $e->getMessage(), PHP_EOL; } ?>
| Name | Type | Description | Notes |
|---|---|---|---|
| currencies | string | Specify the currency name to query in batches, and support up to 100 pass parameters at a time |
\GateApi\Model\TransferablesResult[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedBorrowable[] getUnifiedBorrowableList($currencies)
Batch query unified account maximum borrowable amount
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $currencies = array('[\"BTC\",\"GT\"]'); // string[] | Specify currency names for querying in an array, separated by commas, maximum 10 currencies try { $result = $apiInstance->getUnifiedBorrowableList($currencies); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->getUnifiedBorrowableList: ', $e->getMessage(), PHP_EOL; } ?>
| Name | Type | Description | Notes |
|---|---|---|---|
| currencies | string[] | Specify currency names for querying in an array, separated by commas, maximum 10 currencies |
\GateApi\Model\UnifiedBorrowable[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UniLoan[] listUnifiedLoans($currency, $page, $limit, $type)
Query loans
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $associate_array['currency'] = 'BTC'; // string | Query by specified currency name $associate_array['page'] = 1; // int | Page number $associate_array['limit'] = 100; // int | Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 $associate_array['type'] = 'platform'; // string | Loan type: platform borrowing - platform, margin borrowing - margin try { $result = $apiInstance->listUnifiedLoans($associate_array); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->listUnifiedLoans: ', $e->getMessage(), PHP_EOL; } ?>
Note: the input parameter is an associative array with the keys listed as the parameter name below.
| Name | Type | Description | Notes |
|---|---|---|---|
| currency | string | Query by specified currency name | [optional] |
| page | int | Page number | [optional] [default to 1] |
| limit | int | Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 | [optional] [default to 100] |
| type | string | Loan type: platform borrowing - platform, margin borrowing - margin | [optional] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedLoanResult createUnifiedLoan($unified_loan)
Borrow or repay
When borrowing, ensure the borrowed amount is not below the minimum borrowing threshold for the specific cryptocurrency and does not exceed the maximum borrowing limit set by the platform and user. Loan interest will be automatically deducted from the account at regular intervals. Users are responsible for managing repayment of borrowed amounts. For repayment, use repaid_all=true to repay all available amounts
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $unified_loan = new \GateApi\Model\UnifiedLoan(); // \GateApi\Model\UnifiedLoan | try { $result = $apiInstance->createUnifiedLoan($unified_loan); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->createUnifiedLoan: ', $e->getMessage(), PHP_EOL; } ?>
| Name | Type | Description | Notes |
|---|---|---|---|
| unified_loan | \GateApi\Model\UnifiedLoan |
\GateApi\Model\UnifiedLoanResult
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedLoanRecord[] listUnifiedLoanRecords($type, $currency, $page, $limit)
Query loan records
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $associate_array['type'] = 'type_example'; // string | Loan record type: borrow - borrowing, repay - repayment $associate_array['currency'] = 'BTC'; // string | Query by specified currency name $associate_array['page'] = 1; // int | Page number $associate_array['limit'] = 100; // int | Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 try { $result = $apiInstance->listUnifiedLoanRecords($associate_array); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->listUnifiedLoanRecords: ', $e->getMessage(), PHP_EOL; } ?>
Note: the input parameter is an associative array with the keys listed as the parameter name below.
| Name | Type | Description | Notes |
|---|---|---|---|
| type | string | Loan record type: borrow - borrowing, repay - repayment | [optional] |
| currency | string | Query by specified currency name | [optional] |
| page | int | Page number | [optional] [default to 1] |
| limit | int | Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 | [optional] [default to 100] |
\GateApi\Model\UnifiedLoanRecord[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UniLoanInterestRecord[] listUnifiedLoanInterestRecords($currency, $page, $limit, $from, $to, $type)
Query interest deduction records
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $associate_array['currency'] = 'BTC'; // string | Query by specified currency name $associate_array['page'] = 1; // int | Page number $associate_array['limit'] = 100; // int | Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 $associate_array['from'] = 1627706330; // int | Start timestamp for the query $associate_array['to'] = 1635329650; // int | End timestamp for the query, defaults to current time if not specified $associate_array['type'] = 'platform'; // string | Loan type: platform borrowing - platform, margin borrowing - margin. Defaults to margin if not specified try { $result = $apiInstance->listUnifiedLoanInterestRecords($associate_array); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->listUnifiedLoanInterestRecords: ', $e->getMessage(), PHP_EOL; } ?>
Note: the input parameter is an associative array with the keys listed as the parameter name below.
| Name | Type | Description | Notes |
|---|---|---|---|
| currency | string | Query by specified currency name | [optional] |
| page | int | Page number | [optional] [default to 1] |
| limit | int | Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 | [optional] [default to 100] |
| from | int | Start timestamp for the query | [optional] |
| to | int | End timestamp for the query, defaults to current time if not specified | [optional] |
| type | string | Loan type: platform borrowing - platform, margin borrowing - margin. Defaults to margin if not specified | [optional] |
\GateApi\Model\UniLoanInterestRecord[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedRiskUnits getUnifiedRiskUnits()
Get user risk unit details
Get user risk unit details, only valid in portfolio margin mode
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); try { $result = $apiInstance->getUnifiedRiskUnits(); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->getUnifiedRiskUnits: ', $e->getMessage(), PHP_EOL; } ?>
This endpoint does not need any parameter.
\GateApi\Model\UnifiedRiskUnits
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedModeSet getUnifiedMode()
Query mode of the unified account
Unified account mode: - classic: Classic account mode - multi_currency: Cross-currency margin mode - portfolio: Portfolio margin mode - single_currency: Single-currency margin mode
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); try { $result = $apiInstance->getUnifiedMode(); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->getUnifiedMode: ', $e->getMessage(), PHP_EOL; } ?>
This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
setUnifiedMode($unified_mode_set)
Set unified account mode
Each account mode switch only requires passing the corresponding account mode parameter, and also supports turning on or off the configuration switches under the corresponding account mode during the switch. - When enabling the classic account mode, mode=classic PUT /unified/unified_mode { \"mode\": \"classic\" } - When enabling the cross-currency margin mode, mode=multi_currency PUT /unified/unified_mode { \"mode\": \"multi_currency\", \"settings\": { \"usdt_futures\": true } } - When enabling the portfolio margin mode, mode=portfolio PUT /unified/unified_mode { \"mode\": \"portfolio\", \"settings\": { \"spot_hedge\": true } } - When enabling the single-currency margin mode, mode=single_currency PUT /unified/unified_mode { \"mode\": \"single_currency\" }
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $unified_mode_set = new \GateApi\Model\UnifiedModeSet(); // \GateApi\Model\UnifiedModeSet | try { $apiInstance->setUnifiedMode($unified_mode_set); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->setUnifiedMode: ', $e->getMessage(), PHP_EOL; } ?>
| Name | Type | Description | Notes |
|---|---|---|---|
| unified_mode_set | \GateApi\Model\UnifiedModeSet |
void (empty response body)
- Content-Type: application/json
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
map[string,string] getUnifiedEstimateRate($currencies)
Query unified account estimated interest rate
Interest rates fluctuate hourly based on lending depth, so exact rates cannot be provided. When a currency is not supported, the interest rate returned will be an empty string
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $currencies = array('[\"BTC\",\"GT\"]'); // string[] | Specify currency names for querying in an array, separated by commas, maximum 10 currencies try { $result = $apiInstance->getUnifiedEstimateRate($currencies); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->getUnifiedEstimateRate: ', $e->getMessage(), PHP_EOL; } ?>
| Name | Type | Description | Notes |
|---|---|---|---|
| currencies | string[] | Specify currency names for querying in an array, separated by commas, maximum 10 currencies |
map[string,string]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedDiscount[] listCurrencyDiscountTiers()
Get currency margin discount tiers for unified accounts
<?php require_once(__DIR__ . '/vendor/autoload.php'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); try { $result = $apiInstance->listCurrencyDiscountTiers(); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->listCurrencyDiscountTiers: ', $e->getMessage(), PHP_EOL; } ?>
This endpoint does not need any parameter.
\GateApi\Model\UnifiedDiscount[]
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedMarginTiers[] listLoanMarginTiers()
Query unified account tiered loan margin
<?php require_once(__DIR__ . '/vendor/autoload.php'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); try { $result = $apiInstance->listLoanMarginTiers(); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->listLoanMarginTiers: ', $e->getMessage(), PHP_EOL; } ?>
This endpoint does not need any parameter.
\GateApi\Model\UnifiedMarginTiers[]
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedPortfolioOutput calculatePortfolioMargin($unified_portfolio_input)
Portfolio margin calculator
Portfolio Margin Calculator This interface calculates maintenance and initial margin requirements under the portfolio margin model for custom simulated position and order portfolios. It currently supports all underlying currencies with active options trading. Each simulated position requires a name and holding quantity; each simulated pending order requires a market identifier, price, and quantity. Market orders are not supported.
<?php require_once(__DIR__ . '/vendor/autoload.php'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); $unified_portfolio_input = new \GateApi\Model\UnifiedPortfolioInput(); // \GateApi\Model\UnifiedPortfolioInput | try { $result = $apiInstance->calculatePortfolioMargin($unified_portfolio_input); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->calculatePortfolioMargin: ', $e->getMessage(), PHP_EOL; } ?>
| Name | Type | Description | Notes |
|---|---|---|---|
| unified_portfolio_input | \GateApi\Model\UnifiedPortfolioInput |
\GateApi\Model\UnifiedPortfolioOutput
No authorization required
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\LeverageFailedCurrencies[] setUserLeverage($user_leverage_setting)
Set leverage for all of the user's borrowed currencies
Note the following: - Leverage cannot be changed for currencies with outstanding loans. - A leverage value above a currency's limit is capped at that limit. - Failures are not rolled back and affect only the currencies that failed. For example, if USDT has an outstanding loan, only the USDT leverage remains unchanged.
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $user_leverage_setting = new \GateApi\Model\UserLeverageSetting(); // \GateApi\Model\UserLeverageSetting | try { $result = $apiInstance->setUserLeverage($user_leverage_setting); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->setUserLeverage: ', $e->getMessage(), PHP_EOL; } ?>
| Name | Type | Description | Notes |
|---|---|---|---|
| user_leverage_setting | \GateApi\Model\UserLeverageSetting |
\GateApi\Model\LeverageFailedCurrencies[]
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedLeverageConfig getUserLeverageCurrencyConfig($currency)
Maximum and minimum currency leverage that can be set
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $currency = 'BTC'; // string | Currency try { $result = $apiInstance->getUserLeverageCurrencyConfig($currency); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->getUserLeverageCurrencyConfig: ', $e->getMessage(), PHP_EOL; } ?>
| Name | Type | Description | Notes |
|---|---|---|---|
| currency | string | Currency |
\GateApi\Model\UnifiedLeverageConfig
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedLeverageSetting[] getUserLeverageCurrencySetting($currency)
Get user currency leverage
Get user currency leverage. If currency is not specified, query all currencies
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $associate_array['currency'] = 'BTC'; // string | Currency try { $result = $apiInstance->getUserLeverageCurrencySetting($associate_array); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->getUserLeverageCurrencySetting: ', $e->getMessage(), PHP_EOL; } ?>
Note: the input parameter is an associative array with the keys listed as the parameter name below.
| Name | Type | Description | Notes |
|---|---|---|---|
| currency | string | Currency | [optional] |
\GateApi\Model\UnifiedLeverageSetting[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
setUserLeverageCurrencySetting($unified_leverage_setting)
Set loan currency leverage
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $unified_leverage_setting = new \GateApi\Model\UnifiedLeverageSetting(); // \GateApi\Model\UnifiedLeverageSetting | try { $apiInstance->setUserLeverageCurrencySetting($unified_leverage_setting); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->setUserLeverageCurrencySetting: ', $e->getMessage(), PHP_EOL; } ?>
| Name | Type | Description | Notes |
|---|---|---|---|
| unified_leverage_setting | \GateApi\Model\UnifiedLeverageSetting |
void (empty response body)
- Content-Type: application/json
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedCurrency[] listUnifiedCurrencies($currency)
List of loan currencies supported by unified account
<?php require_once(__DIR__ . '/vendor/autoload.php'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); $associate_array['currency'] = 'BTC'; // string | Currency try { $result = $apiInstance->listUnifiedCurrencies($associate_array); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->listUnifiedCurrencies: ', $e->getMessage(), PHP_EOL; } ?>
Note: the input parameter is an associative array with the keys listed as the parameter name below.
| Name | Type | Description | Notes |
|---|---|---|---|
| currency | string | Currency | [optional] |
\GateApi\Model\UnifiedCurrency[]
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedHistoryLoanRate getHistoryLoanRate($currency, $tier, $page, $limit)
Get historical lending rates
<?php require_once(__DIR__ . '/vendor/autoload.php'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); $associate_array['currency'] = 'USDT'; // string | Currency $associate_array['tier'] = '1'; // string | VIP level for the floating rate to be queried $associate_array['page'] = 1; // int | Page number $associate_array['limit'] = 100; // int | Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 try { $result = $apiInstance->getHistoryLoanRate($associate_array); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->getHistoryLoanRate: ', $e->getMessage(), PHP_EOL; } ?>
Note: the input parameter is an associative array with the keys listed as the parameter name below.
| Name | Type | Description | Notes |
|---|---|---|---|
| currency | string | Currency | |
| tier | string | VIP level for the floating rate to be queried | [optional] |
| page | int | Page number | [optional] [default to 1] |
| limit | int | Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 | [optional] [default to 100] |
\GateApi\Model\UnifiedHistoryLoanRate
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\UnifiedCollateralRes setUnifiedCollateral($unified_collateral_req)
Set collateral currency
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $unified_collateral_req = new \GateApi\Model\UnifiedCollateralReq(); // \GateApi\Model\UnifiedCollateralReq | try { $result = $apiInstance->setUnifiedCollateral($unified_collateral_req); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->setUnifiedCollateral: ', $e->getMessage(), PHP_EOL; } ?>
| Name | Type | Description | Notes |
|---|---|---|---|
| unified_collateral_req | \GateApi\Model\UnifiedCollateralReq |
\GateApi\Model\UnifiedCollateralRes
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\QuickEstimatedRepayment getEstimatedQuickRepayment()
Estimated quick repayment details
Available for unified account cross-currency margin mode and portfolio margin mode
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); try { $result = $apiInstance->getEstimatedQuickRepayment(); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->getEstimatedQuickRepayment: ', $e->getMessage(), PHP_EOL; } ?>
This endpoint does not need any parameter.
\GateApi\Model\QuickEstimatedRepayment
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\QuickRepaymentResponse createQuickRepayment($quick_repayment_request)
Quick repayment
Available for unified account cross-currency margin mode and portfolio margin mode. Use GET /unified/estimated_quick_repayment to query liabilities and pending repayment information.
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $quick_repayment_request = new \GateApi\Model\QuickRepaymentRequest(); // \GateApi\Model\QuickRepaymentRequest | try { $result = $apiInstance->createQuickRepayment($quick_repayment_request); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->createQuickRepayment: ', $e->getMessage(), PHP_EOL; } ?>
| Name | Type | Description | Notes |
|---|---|---|---|
| quick_repayment_request | \GateApi\Model\QuickRepaymentRequest |
\GateApi\Model\QuickRepaymentResponse
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\DeltaNeutralEnabled getUnifiedDeltaNeutral()
Query the account Delta-neutral strategy mode setting
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); try { $result = $apiInstance->getUnifiedDeltaNeutral(); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->getUnifiedDeltaNeutral: ', $e->getMessage(), PHP_EOL; } ?>
This endpoint does not need any parameter.
\GateApi\Model\DeltaNeutralEnabled
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\DeltaNeutralEnabled setUnifiedDeltaNeutral($delta_neutral_enabled)
Set the account Delta-neutral strategy mode
Enable or disable the account Delta-neutral strategy mode. Requirements for enabling: VIP level >= 4 and the account is in cross-currency margin mode; otherwise 403 is returned. Returns the enabled status after the setting takes effect.
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Gate APIv4 authorization: apiv4 $config = GateApi\Configuration::getDefaultConfiguration()->setKey('YOUR_API_KEY')->setSecret('YOUR_API_SECRET'); $apiInstance = new GateApi\Api\UnifiedApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $delta_neutral_enabled = new \GateApi\Model\DeltaNeutralEnabled(); // \GateApi\Model\DeltaNeutralEnabled | try { $result = $apiInstance->setUnifiedDeltaNeutral($delta_neutral_enabled); print_r($result); } catch (GateApi\GateApiException $e) { echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL; } catch (Exception $e) { echo 'Exception when calling UnifiedApi->setUnifiedDeltaNeutral: ', $e->getMessage(), PHP_EOL; } ?>
| Name | Type | Description | Notes |
|---|---|---|---|
| delta_neutral_enabled | \GateApi\Model\DeltaNeutralEnabled |
\GateApi\Model\DeltaNeutralEnabled
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]