Skip to content

Latest commit

 

History

History
516 lines (352 loc) · 16.4 KB

File metadata and controls

516 lines (352 loc) · 16.4 KB

GateApi\MarginUniApi

All URIs are relative to https://api.gateio.ws/api/v4

Method HTTP request Description
listUniCurrencyPairs GET /margin/uni/currency_pairs List lending markets
getUniCurrencyPair GET /margin/uni/currency_pairs/{currency_pair} Get lending market details
getMarginUniEstimateRate GET /margin/uni/estimate_rate Estimate interest rate for isolated margin currencies
listUniLoans GET /margin/uni/loans Query loans
createUniLoan POST /margin/uni/loans Borrow or repay
listUniLoanRecords GET /margin/uni/loan_records Query loan records
listUniLoanInterestRecords GET /margin/uni/interest_records Query interest deduction records
getUniBorrowable GET /margin/uni/borrowable Query maximum borrowable amount by currency

listUniCurrencyPairs

\GateApi\Model\UniCurrencyPair[] listUniCurrencyPairs()

List lending markets

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


$apiInstance = new GateApi\Api\MarginUniApi(
    // 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->listUniCurrencyPairs();
    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 MarginUniApi->listUniCurrencyPairs: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

This endpoint does not need any parameter.

Return type

\GateApi\Model\UniCurrencyPair[]

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]

getUniCurrencyPair

\GateApi\Model\UniCurrencyPair getUniCurrencyPair($currency_pair)

Get lending market details

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


$apiInstance = new GateApi\Api\MarginUniApi(
    // 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()
);
$currency_pair = 'AE_USDT'; // string | Currency pair

try {
    $result = $apiInstance->getUniCurrencyPair($currency_pair);
    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 MarginUniApi->getUniCurrencyPair: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
currency_pair string Currency pair

Return type

\GateApi\Model\UniCurrencyPair

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]

getMarginUniEstimateRate

map[string,string] getMarginUniEstimateRate($currencies)

Estimate interest rate for isolated margin currencies

Interest rates change hourly based on lending depth, so completely accurate rates cannot be provided.

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\MarginUniApi(
    // 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[] | Array of currency names to query, maximum 10

try {
    $result = $apiInstance->getMarginUniEstimateRate($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 MarginUniApi->getMarginUniEstimateRate: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
currencies string[] Array of currency names to query, maximum 10

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]

listUniLoans

\GateApi\Model\UniLoan[] listUniLoans($currency_pair, $currency, $page, $limit)

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\MarginUniApi(
    // 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_pair'] = 'BTC_USDT'; // string | Currency pair
$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->listUniLoans($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 MarginUniApi->listUniLoans: ', $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_pair string Currency pair [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\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]

createUniLoan

createUniLoan($create_uni_loan)

Borrow or repay

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\MarginUniApi(
    // 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
);
$create_uni_loan = new \GateApi\Model\CreateUniLoan(); // \GateApi\Model\CreateUniLoan | 

try {
    $apiInstance->createUniLoan($create_uni_loan);
} catch (GateApi\GateApiException $e) {
    echo "Gate API Exception: label: {$e->getLabel()}, message: {$e->getMessage()}" . PHP_EOL;
} catch (Exception $e) {
    echo 'Exception when calling MarginUniApi->createUniLoan: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
create_uni_loan \GateApi\Model\CreateUniLoan

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]

listUniLoanRecords

\GateApi\Model\UniLoanRecord[] listUniLoanRecords($type, $currency, $currency_pair, $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\MarginUniApi(
    // 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 | Type: `borrow` - borrow, `repay` - repay
$associate_array['currency'] = 'BTC'; // string | Query by specified currency name
$associate_array['currency_pair'] = 'BTC_USDT'; // string | Currency pair
$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->listUniLoanRecords($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 MarginUniApi->listUniLoanRecords: ', $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 Type: `borrow` - borrow, `repay` - repay [optional]
currency string Query by specified currency name [optional]
currency_pair string Currency pair [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\UniLoanRecord[]

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]

listUniLoanInterestRecords

\GateApi\Model\UniLoanInterestRecord[] listUniLoanInterestRecords($currency_pair, $currency, $page, $limit, $from, $to)

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\MarginUniApi(
    // 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_pair'] = 'BTC_USDT'; // string | Currency pair
$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 records returned in a single list
$associate_array['from'] = 1547706332; // int | Start timestamp  Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)
$associate_array['to'] = 1547706332; // int | Termination Timestamp  Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp

try {
    $result = $apiInstance->listUniLoanInterestRecords($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 MarginUniApi->listUniLoanInterestRecords: ', $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_pair string Currency pair [optional]
currency string Query by specified currency name [optional]
page int Page number [optional] [default to 1]
limit int Maximum number of records returned in a single list [optional] [default to 100]
from int Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) [optional]
to int Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp [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]

getUniBorrowable

\GateApi\Model\MaxUniBorrowable getUniBorrowable($currency, $currency_pair)

Query maximum borrowable amount by 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\MarginUniApi(
    // 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
$currency_pair = 'BTC_USDT'; // string | Currency pair

try {
    $result = $apiInstance->getUniBorrowable($currency, $currency_pair);
    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 MarginUniApi->getUniBorrowable: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
currency string Query by specified currency name
currency_pair string Currency pair

Return type

\GateApi\Model\MaxUniBorrowable

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]