Skip to content

Latest commit

 

History

History
1371 lines (922 loc) · 44.1 KB

File metadata and controls

1371 lines (922 loc) · 44.1 KB

GateApi\UnifiedApi

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 Batch query maximum transferable amount for unified accounts. Each currency shows the maximum value. After user withdrawal, the transferable amount for all currencies will change
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 Query unified account tiered
listLoanMarginTiers GET /unified/loan_margin_tiers Query unified account tiered loan margin
calculatePortfolioMargin POST /unified/portfolio_calculator Portfolio margin calculator
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

listUnifiedAccounts

\GateApi\Model\UnifiedAccount listUnifiedAccounts($currency, $sub_uid)

Get unified account information

The assets of each currency in the account will be adjusted according to their liquidity, defined by corresponding adjustment coefficients, and then uniformly converted to USD to calculate the total asset value and position value of the account. For specific formulas, please refer to Margin Formula

Example

<?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;
}
?>

Parameters

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]

Return type

\GateApi\Model\UnifiedAccount

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getUnifiedBorrowable

\GateApi\Model\UnifiedBorrowable getUnifiedBorrowable($currency)

Query maximum borrowable amount for unified account

Example

<?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;
}
?>

Parameters

Name Type Description Notes
currency string Query by specified currency name

Return type

\GateApi\Model\UnifiedBorrowable

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getUnifiedTransferable

\GateApi\Model\UnifiedTransferable getUnifiedTransferable($currency)

Query maximum transferable amount for unified account

Example

<?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;
}
?>

Parameters

Name Type Description Notes
currency string Query by specified currency name

Return type

\GateApi\Model\UnifiedTransferable

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getUnifiedTransferables

\GateApi\Model\TransferablesResult[] getUnifiedTransferables($currencies)

Batch query maximum transferable amount for unified accounts. Each currency shows the maximum value. After user withdrawal, the transferable amount for all currencies will change

Example

<?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;
}
?>

Parameters

Name Type Description Notes
currencies string Specify the currency name to query in batches, and support up to 100 pass parameters at a time

Return type

\GateApi\Model\TransferablesResult[]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getUnifiedBorrowableList

\GateApi\Model\UnifiedBorrowable[] getUnifiedBorrowableList($currencies)

Batch query unified account maximum borrowable amount

Example

<?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;
}
?>

Parameters

Name Type Description Notes
currencies string[] Specify currency names for querying in an array, separated by commas, maximum 10 currencies

Return type

\GateApi\Model\UnifiedBorrowable[]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listUnifiedLoans

\GateApi\Model\UniLoan[] listUnifiedLoans($currency, $page, $limit, $type)

Query loans

Example

<?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;
}
?>

Parameters

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]

Return type

\GateApi\Model\UniLoan[]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

createUnifiedLoan

\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

Example

<?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;
}
?>

Parameters

Name Type Description Notes
unified_loan \GateApi\Model\UnifiedLoan

Return type

\GateApi\Model\UnifiedLoanResult

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listUnifiedLoanRecords

\GateApi\Model\UnifiedLoanRecord[] listUnifiedLoanRecords($type, $currency, $page, $limit)

Query loan records

Example

<?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;
}
?>

Parameters

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]

Return type

\GateApi\Model\UnifiedLoanRecord[]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listUnifiedLoanInterestRecords

\GateApi\Model\UniLoanInterestRecord[] listUnifiedLoanInterestRecords($currency, $page, $limit, $from, $to, $type)

Query interest deduction records

Example

<?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;
}
?>

Parameters

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]

Return type

\GateApi\Model\UniLoanInterestRecord[]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getUnifiedRiskUnits

\GateApi\Model\UnifiedRiskUnits getUnifiedRiskUnits()

Get user risk unit details

Get user risk unit details, only valid in portfolio margin mode

Example

<?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;
}
?>

Parameters

This endpoint does not need any parameter.

Return type

\GateApi\Model\UnifiedRiskUnits

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getUnifiedMode

\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

Example

<?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;
}
?>

Parameters

This endpoint does not need any parameter.

Return type

\GateApi\Model\UnifiedModeSet

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

setUnifiedMode

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 "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" } ```

Example

<?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;
}
?>

Parameters

Name Type Description Notes
unified_mode_set \GateApi\Model\UnifiedModeSet

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getUnifiedEstimateRate

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

Example

<?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;
}
?>

Parameters

Name Type Description Notes
currencies string[] Specify currency names for querying in an array, separated by commas, maximum 10 currencies

Return type

map[string,string]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listCurrencyDiscountTiers

\GateApi\Model\UnifiedDiscount[] listCurrencyDiscountTiers()

Query unified account tiered

Example

<?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;
}
?>

Parameters

This endpoint does not need any parameter.

Return type

\GateApi\Model\UnifiedDiscount[]

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listLoanMarginTiers

\GateApi\Model\UnifiedMarginTiers[] listLoanMarginTiers()

Query unified account tiered loan margin

Example

<?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;
}
?>

Parameters

This endpoint does not need any parameter.

Return type

\GateApi\Model\UnifiedMarginTiers[]

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

calculatePortfolioMargin

\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.

Example

<?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;
}
?>

Parameters

Name Type Description Notes
unified_portfolio_input \GateApi\Model\UnifiedPortfolioInput

Return type

\GateApi\Model\UnifiedPortfolioOutput

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getUserLeverageCurrencyConfig

\GateApi\Model\UnifiedLeverageConfig getUserLeverageCurrencyConfig($currency)

Maximum and minimum currency leverage that can be set

Example

<?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;
}
?>

Parameters

Name Type Description Notes
currency string Currency

Return type

\GateApi\Model\UnifiedLeverageConfig

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getUserLeverageCurrencySetting

\GateApi\Model\UnifiedLeverageSetting[] getUserLeverageCurrencySetting($currency)

Get user currency leverage

Get user currency leverage. If currency is not specified, query all currencies

Example

<?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;
}
?>

Parameters

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]

Return type

\GateApi\Model\UnifiedLeverageSetting[]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

setUserLeverageCurrencySetting

setUserLeverageCurrencySetting($unified_leverage_setting)

Set loan currency leverage

Example

<?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;
}
?>

Parameters

Name Type Description Notes
unified_leverage_setting \GateApi\Model\UnifiedLeverageSetting

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listUnifiedCurrencies

\GateApi\Model\UnifiedCurrency[] listUnifiedCurrencies($currency)

List of loan currencies supported by unified account

Example

<?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;
}
?>

Parameters

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]

Return type

\GateApi\Model\UnifiedCurrency[]

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getHistoryLoanRate

\GateApi\Model\UnifiedHistoryLoanRate getHistoryLoanRate($currency, $tier, $page, $limit)

Get historical lending rates

Example

<?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;
}
?>

Parameters

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]

Return type

\GateApi\Model\UnifiedHistoryLoanRate

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

setUnifiedCollateral

\GateApi\Model\UnifiedCollateralRes setUnifiedCollateral($unified_collateral_req)

Set collateral currency

Example

<?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;
}
?>

Parameters

Name Type Description Notes
unified_collateral_req \GateApi\Model\UnifiedCollateralReq

Return type

\GateApi\Model\UnifiedCollateralRes

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]