All URIs are relative to https://api.gateio.ws/api/v4
Method | HTTP request | Description |
---|---|---|
listMarginCurrencyPairs | GET /margin/currency_pairs | List all supported currency pairs supported in margin trading |
getMarginCurrencyPair | GET /margin/currency_pairs/{currency_pair} | Query one single margin currency pair |
listFundingBook | GET /margin/funding_book | Order book of lending loans |
listMarginAccounts | GET /margin/accounts | Margin account list |
listMarginAccountBook | GET /margin/account_book | List margin account balance change history |
listFundingAccounts | GET /margin/funding_accounts | Funding account list |
listLoans | GET /margin/loans | List all loans |
createLoan | POST /margin/loans | Lend or borrow |
mergeLoans | POST /margin/merged_loans | Merge multiple lending loans |
getLoan | GET /margin/loans/{loan_id} | Retrieve one single loan detail |
cancelLoan | DELETE /margin/loans/{loan_id} | Cancel lending loan |
updateLoan | PATCH /margin/loans/{loan_id} | Modify a loan |
listLoanRepayments | GET /margin/loans/{loan_id}/repayment | List loan repayment records |
repayLoan | POST /margin/loans/{loan_id}/repayment | Repay a loan |
listLoanRecords | GET /margin/loan_records | List repayment records of specified loan |
getLoanRecord | GET /margin/loan_records/{loan_record_id} | Get one single loan record |
updateLoanRecord | PATCH /margin/loan_records/{loan_record_id} | Modify a loan record |
getAutoRepayStatus | GET /margin/auto_repay | Retrieve user auto repayment setting |
setAutoRepay | POST /margin/auto_repay | Update user's auto repayment setting |
getMarginTransferable | GET /margin/transferable | Max transferable amount for specified margin currency |
listCrossMarginCurrencies | GET /margin/cross/currencies | Currencies supported by cross margin. |
getCrossMarginCurrency | GET /margin/cross/currencies/{currency} | Retrieve detail of one single currency supported by cross margin |
getCrossMarginAccount | GET /margin/cross/accounts | Retrieve cross margin account |
listCrossMarginAccountBook | GET /margin/cross/account_book | Retrieve cross margin account change history |
listCrossMarginLoans | GET /margin/cross/loans | List cross margin borrow history |
createCrossMarginLoan | POST /margin/cross/loans | Create a cross margin borrow loan |
getCrossMarginLoan | GET /margin/cross/loans/{loan_id} | Retrieve single borrow loan detail |
listCrossMarginRepayments | GET /margin/cross/repayments | Retrieve cross margin repayments |
repayCrossMarginLoan | POST /margin/cross/repayments | Repay cross margin loan |
getCrossMarginTransferable | GET /margin/cross/transferable | Max transferable amount for specified cross margin currency |
\GateApi\Model\MarginCurrencyPair[] listMarginCurrencyPairs()
List all supported currency pairs supported in margin trading
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new GateApi\Api\MarginApi(
// 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->listMarginCurrencyPairs();
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 MarginApi->listMarginCurrencyPairs: ', $e->getMessage(), PHP_EOL;
}
?>
This endpoint does not need any parameter.
\GateApi\Model\MarginCurrencyPair[]
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\MarginCurrencyPair getMarginCurrencyPair($currency_pair)
Query one single margin currency pair
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new GateApi\Api\MarginApi(
// 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 = 'BTC_USDT'; // string | Margin currency pair
try {
$result = $apiInstance->getMarginCurrencyPair($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 MarginApi->getMarginCurrencyPair: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
currency_pair | string | Margin currency pair |
\GateApi\Model\MarginCurrencyPair
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\FundingBookItem[] listFundingBook($currency)
Order book of lending loans
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new GateApi\Api\MarginApi(
// 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 = 'BTC'; // string | Retrieved specified currency related data
try {
$result = $apiInstance->listFundingBook($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 MarginApi->listFundingBook: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
currency | string | Retrieved specified currency related data |
\GateApi\Model\FundingBookItem[]
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\MarginAccount[] listMarginAccounts($currency_pair)
Margin account list
<?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\MarginApi(
// 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
try {
$result = $apiInstance->listMarginAccounts($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 MarginApi->listMarginAccounts: ', $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_pair | string | Currency pair | [optional] |
\GateApi\Model\MarginAccount[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\MarginAccountBook[] listMarginAccountBook($currency, $currency_pair, $from, $to, $page, $limit)
List margin account balance change history
Only transferals from and to margin account are provided for now. Time range allows 30 days at most
<?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\MarginApi(
// 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'] = 'currency_example'; // string | List records related to specified currency only. If specified, `currency_pair` is also required.
$associate_array['currency_pair'] = 'currency_pair_example'; // string | List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided
$associate_array['from'] = 56; // int | Time range beginning, default to 7 days before current time
$associate_array['to'] = 56; // int | Time range ending, default to current time
$associate_array['page'] = 1; // int | Page number
$associate_array['limit'] = 100; // int | Maximum number of records returned in one list
try {
$result = $apiInstance->listMarginAccountBook($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 MarginApi->listMarginAccountBook: ', $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 | List records related to specified currency only. If specified, `currency_pair` is also required. | [optional] |
currency_pair | string | List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided | [optional] |
from | int | Time range beginning, default to 7 days before current time | [optional] |
to | int | Time range ending, default to current time | [optional] |
page | int | Page number | [optional] [default to 1] |
limit | int | Maximum number of records returned in one list | [optional] [default to 100] |
\GateApi\Model\MarginAccountBook[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\FundingAccount[] listFundingAccounts($currency)
Funding account list
<?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\MarginApi(
// 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 | Retrieved specified currency related data
try {
$result = $apiInstance->listFundingAccounts($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 MarginApi->listFundingAccounts: ', $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 | Retrieved specified currency related data | [optional] |
\GateApi\Model\FundingAccount[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\Loan[] listLoans($status, $side, $currency, $currency_pair, $sort_by, $reverse_sort, $page, $limit)
List all 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\MarginApi(
// 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['status'] = 'open'; // string | Loan status
$associate_array['side'] = 'lend'; // string | Lend or borrow
$associate_array['currency'] = 'BTC'; // string | Retrieved specified currency related data
$associate_array['currency_pair'] = 'BTC_USDT'; // string | Currency pair
$associate_array['sort_by'] = 'rate'; // string | Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time`
$associate_array['reverse_sort'] = false; // bool | Whether to sort in descending order. Default to `true`
$associate_array['page'] = 1; // int | Page number
$associate_array['limit'] = 100; // int | Maximum number of records returned in one list
try {
$result = $apiInstance->listLoans($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 MarginApi->listLoans: ', $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 |
---|---|---|---|
status | string | Loan status | |
side | string | Lend or borrow | |
currency | string | Retrieved specified currency related data | [optional] |
currency_pair | string | Currency pair | [optional] |
sort_by | string | Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` | [optional] |
reverse_sort | bool | Whether to sort in descending order. Default to `true` | [optional] |
page | int | Page number | [optional] [default to 1] |
limit | int | Maximum number of records returned in one list | [optional] [default to 100] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\Loan createLoan($loan)
Lend or borrow
<?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\MarginApi(
// 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
);
$loan = new \GateApi\Model\Loan(); // \GateApi\Model\Loan |
try {
$result = $apiInstance->createLoan($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 MarginApi->createLoan: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
loan | \GateApi\Model\Loan |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\Loan mergeLoans($currency, $ids)
Merge multiple lending 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\MarginApi(
// 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 | Retrieved specified currency related data
$ids = '123,234,345'; // string | Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request
try {
$result = $apiInstance->mergeLoans($currency, $ids);
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 MarginApi->mergeLoans: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
currency | string | Retrieved specified currency related data | |
ids | string | Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\Loan getLoan($loan_id, $side)
Retrieve one single loan detail
<?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\MarginApi(
// 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
);
$loan_id = '12345'; // string | Loan ID
$side = 'lend'; // string | Lend or borrow
try {
$result = $apiInstance->getLoan($loan_id, $side);
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 MarginApi->getLoan: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
loan_id | string | Loan ID | |
side | string | Lend or borrow |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\Loan cancelLoan($loan_id, $currency)
Cancel lending loan
Only lending loans can be cancelled
<?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\MarginApi(
// 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
);
$loan_id = '12345'; // string | Loan ID
$currency = 'BTC'; // string | Retrieved specified currency related data
try {
$result = $apiInstance->cancelLoan($loan_id, $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 MarginApi->cancelLoan: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
loan_id | string | Loan ID | |
currency | string | Retrieved specified currency related data |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\Loan updateLoan($loan_id, $loan_patch)
Modify a loan
Only auto_renew
modification is supported currently
<?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\MarginApi(
// 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
);
$loan_id = '12345'; // string | Loan ID
$loan_patch = new \GateApi\Model\LoanPatch(); // \GateApi\Model\LoanPatch |
try {
$result = $apiInstance->updateLoan($loan_id, $loan_patch);
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 MarginApi->updateLoan: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
loan_id | string | Loan ID | |
loan_patch | \GateApi\Model\LoanPatch |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\Repayment[] listLoanRepayments($loan_id)
List loan repayment 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\MarginApi(
// 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
);
$loan_id = '12345'; // string | Loan ID
try {
$result = $apiInstance->listLoanRepayments($loan_id);
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 MarginApi->listLoanRepayments: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
loan_id | string | Loan ID |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\Loan repayLoan($loan_id, $repay_request)
Repay a loan
<?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\MarginApi(
// 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
);
$loan_id = '12345'; // string | Loan ID
$repay_request = new \GateApi\Model\RepayRequest(); // \GateApi\Model\RepayRequest |
try {
$result = $apiInstance->repayLoan($loan_id, $repay_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 MarginApi->repayLoan: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
loan_id | string | Loan ID | |
repay_request | \GateApi\Model\RepayRequest |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\LoanRecord[] listLoanRecords($loan_id, $status, $page, $limit)
List repayment records of specified loan
<?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\MarginApi(
// 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['loan_id'] = '12345'; // string | Loan ID
$associate_array['status'] = 'loaned'; // string | Loan record status
$associate_array['page'] = 1; // int | Page number
$associate_array['limit'] = 100; // int | Maximum number of records returned in one list
try {
$result = $apiInstance->listLoanRecords($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 MarginApi->listLoanRecords: ', $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 |
---|---|---|---|
loan_id | string | Loan ID | |
status | string | Loan record status | [optional] |
page | int | Page number | [optional] [default to 1] |
limit | int | Maximum number of records returned in one list | [optional] [default to 100] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\LoanRecord getLoanRecord($loan_record_id, $loan_id)
Get one single loan record
<?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\MarginApi(
// 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
);
$loan_record_id = '12345'; // string | Loan record ID
$loan_id = '12345'; // string | Loan ID
try {
$result = $apiInstance->getLoanRecord($loan_record_id, $loan_id);
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 MarginApi->getLoanRecord: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
loan_record_id | string | Loan record ID | |
loan_id | string | Loan ID |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\LoanRecord updateLoanRecord($loan_record_id, $loan_patch)
Modify a loan record
Only auto_renew
modification is supported currently
<?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\MarginApi(
// 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
);
$loan_record_id = '12345'; // string | Loan record ID
$loan_patch = new \GateApi\Model\LoanPatch(); // \GateApi\Model\LoanPatch |
try {
$result = $apiInstance->updateLoanRecord($loan_record_id, $loan_patch);
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 MarginApi->updateLoanRecord: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
loan_record_id | string | Loan record ID | |
loan_patch | \GateApi\Model\LoanPatch |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\AutoRepaySetting getAutoRepayStatus()
Retrieve user auto repayment 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\MarginApi(
// 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->getAutoRepayStatus();
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 MarginApi->getAutoRepayStatus: ', $e->getMessage(), PHP_EOL;
}
?>
This endpoint does not need any parameter.
\GateApi\Model\AutoRepaySetting
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\AutoRepaySetting setAutoRepay($status)
Update user's auto repayment 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\MarginApi(
// 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
);
$status = 'on'; // string | New auto repayment status. `on` - enabled, `off` - disabled
try {
$result = $apiInstance->setAutoRepay($status);
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 MarginApi->setAutoRepay: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
status | string | New auto repayment status. `on` - enabled, `off` - disabled |
\GateApi\Model\AutoRepaySetting
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\MarginTransferable getMarginTransferable($currency, $currency_pair)
Max transferable amount for specified margin 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\MarginApi(
// 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 | Retrieved specified currency related data
$associate_array['currency_pair'] = 'BTC_USDT'; // string | Currency pair
try {
$result = $apiInstance->getMarginTransferable($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 MarginApi->getMarginTransferable: ', $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 | Retrieved specified currency related data | |
currency_pair | string | Currency pair | [optional] |
\GateApi\Model\MarginTransferable
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\CrossMarginCurrency[] listCrossMarginCurrencies()
Currencies supported by cross margin.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new GateApi\Api\MarginApi(
// 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->listCrossMarginCurrencies();
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 MarginApi->listCrossMarginCurrencies: ', $e->getMessage(), PHP_EOL;
}
?>
This endpoint does not need any parameter.
\GateApi\Model\CrossMarginCurrency[]
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\CrossMarginCurrency getCrossMarginCurrency($currency)
Retrieve detail of one single currency supported by cross margin
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new GateApi\Api\MarginApi(
// 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 = 'BTC'; // string | Currency name
try {
$result = $apiInstance->getCrossMarginCurrency($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 MarginApi->getCrossMarginCurrency: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
currency | string | Currency name |
\GateApi\Model\CrossMarginCurrency
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\CrossMarginAccount getCrossMarginAccount()
Retrieve cross margin 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\MarginApi(
// 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->getCrossMarginAccount();
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 MarginApi->getCrossMarginAccount: ', $e->getMessage(), PHP_EOL;
}
?>
This endpoint does not need any parameter.
\GateApi\Model\CrossMarginAccount
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\CrossMarginAccountBook[] listCrossMarginAccountBook($currency, $from, $to, $page, $limit, $type)
Retrieve cross margin account change history
Record time range cannot exceed 30 days
<?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\MarginApi(
// 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'] = 'currency_example'; // string | Filter by currency
$associate_array['from'] = 56; // int | Time range beginning, default to 7 days before current time
$associate_array['to'] = 56; // int | Time range ending, default to current time
$associate_array['page'] = 1; // int | Page number
$associate_array['limit'] = 100; // int | Maximum number of records returned in one list
$associate_array['type'] = 'borrow'; // string | Filter by account change type. All types are returned if not specified.
try {
$result = $apiInstance->listCrossMarginAccountBook($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 MarginApi->listCrossMarginAccountBook: ', $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 | Filter by currency | [optional] |
from | int | Time range beginning, default to 7 days before current time | [optional] |
to | int | Time range ending, default to current time | [optional] |
page | int | Page number | [optional] [default to 1] |
limit | int | Maximum number of records returned in one list | [optional] [default to 100] |
type | string | Filter by account change type. All types are returned if not specified. | [optional] |
\GateApi\Model\CrossMarginAccountBook[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\CrossMarginLoan[] listCrossMarginLoans($status, $currency, $limit, $offset, $reverse)
List cross margin borrow history
Sort by creation time in descending order by default. Set reverse=false
to return ascending results.
<?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\MarginApi(
// 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['status'] = 56; // int | Filter by status. Supported values are 2 and 3.
$associate_array['currency'] = 'currency_example'; // string | Filter by currency
$associate_array['limit'] = 100; // int | Maximum number of records returned in one list
$associate_array['offset'] = 0; // int | List offset, starting from 0
$associate_array['reverse'] = true; // bool | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results
try {
$result = $apiInstance->listCrossMarginLoans($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 MarginApi->listCrossMarginLoans: ', $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 |
---|---|---|---|
status | int | Filter by status. Supported values are 2 and 3. | |
currency | string | Filter by currency | [optional] |
limit | int | Maximum number of records returned in one list | [optional] [default to 100] |
offset | int | List offset, starting from 0 | [optional] [default to 0] |
reverse | bool | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results | [optional] [default to true] |
\GateApi\Model\CrossMarginLoan[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\CrossMarginLoan createCrossMarginLoan($cross_margin_loan)
Create a cross margin borrow loan
Borrow amount cannot be less than currency minimum borrow 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\MarginApi(
// 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
);
$cross_margin_loan = new \GateApi\Model\CrossMarginLoan(); // \GateApi\Model\CrossMarginLoan |
try {
$result = $apiInstance->createCrossMarginLoan($cross_margin_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 MarginApi->createCrossMarginLoan: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
cross_margin_loan | \GateApi\Model\CrossMarginLoan |
\GateApi\Model\CrossMarginLoan
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\CrossMarginLoan getCrossMarginLoan($loan_id)
Retrieve single borrow loan detail
<?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\MarginApi(
// 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
);
$loan_id = '12345'; // string | Borrow loan ID
try {
$result = $apiInstance->getCrossMarginLoan($loan_id);
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 MarginApi->getCrossMarginLoan: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
loan_id | string | Borrow loan ID |
\GateApi\Model\CrossMarginLoan
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\CrossMarginRepayment[] listCrossMarginRepayments($currency, $loan_id, $limit, $offset, $reverse)
Retrieve cross margin repayments
Sort by creation time in descending order by default. Set reverse=false
to return ascending results.
<?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\MarginApi(
// 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 |
$associate_array['loan_id'] = '12345'; // string |
$associate_array['limit'] = 100; // int | Maximum number of records returned in one list
$associate_array['offset'] = 0; // int | List offset, starting from 0
$associate_array['reverse'] = true; // bool | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results
try {
$result = $apiInstance->listCrossMarginRepayments($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 MarginApi->listCrossMarginRepayments: ', $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 | [optional] | |
loan_id | string | [optional] | |
limit | int | Maximum number of records returned in one list | [optional] [default to 100] |
offset | int | List offset, starting from 0 | [optional] [default to 0] |
reverse | bool | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results | [optional] [default to true] |
\GateApi\Model\CrossMarginRepayment[]
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\CrossMarginLoan[] repayCrossMarginLoan($cross_margin_repay_request)
Repay cross margin loan
<?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\MarginApi(
// 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
);
$cross_margin_repay_request = new \GateApi\Model\CrossMarginRepayRequest(); // \GateApi\Model\CrossMarginRepayRequest |
try {
$result = $apiInstance->repayCrossMarginLoan($cross_margin_repay_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 MarginApi->repayCrossMarginLoan: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
cross_margin_repay_request | \GateApi\Model\CrossMarginRepayRequest |
\GateApi\Model\CrossMarginLoan[]
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\GateApi\Model\CrossMarginTransferable getCrossMarginTransferable($currency)
Max transferable amount for specified cross margin 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\MarginApi(
// 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 | Retrieved specified currency related data
try {
$result = $apiInstance->getCrossMarginTransferable($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 MarginApi->getCrossMarginTransferable: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
currency | string | Retrieved specified currency related data |
\GateApi\Model\CrossMarginTransferable
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]