All URIs are relative to https://api.gateio.ws/api/v4
Method | HTTP request | Description |
---|---|---|
list_margin_accounts | GET /margin/accounts | Margin account list |
list_margin_account_book | GET /margin/account_book | List margin account balance change history |
list_funding_accounts | GET /margin/funding_accounts | Funding account list |
get_auto_repay_status | GET /margin/auto_repay | Retrieve user auto repayment setting |
set_auto_repay | POST /margin/auto_repay | Update user's auto repayment setting |
get_margin_transferable | GET /margin/transferable | Get the max transferable amount for a specific margin currency |
list_cross_margin_currencies | GET /margin/cross/currencies | Currencies supported by cross margin. |
get_cross_margin_currency | GET /margin/cross/currencies/{currency} | Retrieve detail of one single currency supported by cross margin |
get_cross_margin_account | GET /margin/cross/accounts | Retrieve cross margin account |
list_cross_margin_account_book | GET /margin/cross/account_book | Retrieve cross margin account change history |
list_cross_margin_loans | GET /margin/cross/loans | List cross margin borrow history |
create_cross_margin_loan | POST /margin/cross/loans | Create a cross margin borrow loan |
get_cross_margin_loan | GET /margin/cross/loans/{loan_id} | Retrieve single borrow loan detail |
list_cross_margin_repayments | GET /margin/cross/repayments | Retrieve cross margin repayments |
repay_cross_margin_loan | POST /margin/cross/repayments | Cross margin repayments |
get_cross_margin_interest_records | GET /margin/cross/interest_records | Interest records for the cross margin account |
get_cross_margin_transferable | GET /margin/cross/transferable | Get the max transferable amount for a specific cross margin currency |
get_cross_margin_estimate_rate | GET /margin/cross/estimate_rate | Estimated interest rates |
get_cross_margin_borrowable | GET /margin/cross/borrowable | Get the max borrowable amount for a specific cross margin currency |
list[MarginAccount] list_margin_accounts(currency_pair=currency_pair)
Margin account list
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
currency_pair = 'BTC_USDT' # str | Currency pair (optional)
try:
# Margin account list
api_response = api_instance.list_margin_accounts(currency_pair=currency_pair)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->list_margin_accounts: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
currency_pair | str | Currency pair | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[MarginAccountBook] list_margin_account_book(currency=currency, currency_pair=currency_pair, type=type, _from=_from, to=to, page=page, limit=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
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
currency = 'currency_example' # str | List records related to specified currency only. If specified, `currency_pair` is also required. (optional)
currency_pair = 'currency_pair_example' # str | List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided (optional)
type = 'lend' # str | Only retrieve changes of the specified type. All types will be returned if not specified. (optional)
_from = 1627706330 # int | Start timestamp of the query (optional)
to = 1635329650 # int | Time range ending, default to current time (optional)
page = 1 # int | Page number (optional) (default to 1)
limit = 100 # int | Maximum number of records to be returned in a single list (optional) (default to 100)
try:
# List margin account balance change history
api_response = api_instance.list_margin_account_book(currency=currency, currency_pair=currency_pair, type=type, _from=_from, to=to, page=page, limit=limit)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->list_margin_account_book: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
currency | str | List records related to specified currency only. If specified, `currency_pair` is also required. | [optional] |
currency_pair | str | List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided | [optional] |
type | str | Only retrieve changes of the specified type. All types will be returned if not specified. | [optional] |
_from | int | Start timestamp of the query | [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 to be returned in a single list | [optional] [default to 100] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[FundingAccount] list_funding_accounts(currency=currency)
Funding account list
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
currency = 'BTC' # str | Retrieve data of the specified currency (optional)
try:
# Funding account list
api_response = api_instance.list_funding_accounts(currency=currency)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->list_funding_accounts: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
currency | str | Retrieve data of the specified currency | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
AutoRepaySetting get_auto_repay_status()
Retrieve user auto repayment setting
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
try:
# Retrieve user auto repayment setting
api_response = api_instance.get_auto_repay_status()
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->get_auto_repay_status: %s\n" % e)
This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Current auto repayment setting | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
AutoRepaySetting set_auto_repay(status)
Update user's auto repayment setting
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
status = 'on' # str | New auto repayment status. `on` - enabled, `off` - disabled
try:
# Update user's auto repayment setting
api_response = api_instance.set_auto_repay(status)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->set_auto_repay: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
status | str | New auto repayment status. `on` - enabled, `off` - disabled |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Current auto repayment setting | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
MarginTransferable get_margin_transferable(currency, currency_pair=currency_pair)
Get the max transferable amount for a specific margin currency
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
currency = 'BTC' # str | Retrieve data of the specified currency
currency_pair = 'BTC_USDT' # str | Currency pair (optional)
try:
# Get the max transferable amount for a specific margin currency
api_response = api_instance.get_margin_transferable(currency, currency_pair=currency_pair)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->get_margin_transferable: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
currency | str | Retrieve data of the specified currency | |
currency_pair | str | Currency pair | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[CrossMarginCurrency] list_cross_margin_currencies()
Currencies supported by cross margin.
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
try:
# Currencies supported by cross margin.
api_response = api_instance.list_cross_margin_currencies()
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->list_cross_margin_currencies: %s\n" % e)
This endpoint does not need any parameter.
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CrossMarginCurrency get_cross_margin_currency(currency)
Retrieve detail of one single currency supported by cross margin
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
currency = 'BTC' # str | Currency name
try:
# Retrieve detail of one single currency supported by cross margin
api_response = api_instance.get_cross_margin_currency(currency)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->get_cross_margin_currency: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
currency | str | Currency name |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CrossMarginAccount get_cross_margin_account()
Retrieve cross margin account
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
try:
# Retrieve cross margin account
api_response = api_instance.get_cross_margin_account()
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->get_cross_margin_account: %s\n" % e)
This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[CrossMarginAccountBook] list_cross_margin_account_book(currency=currency, _from=_from, to=to, page=page, limit=limit, type=type)
Retrieve cross margin account change history
The record query time range is not allowed to exceed 30 days. When using the limit&page paging function to retrieve data, the maximum number of pages is 100,000, that is, (limit page - 1) <= 100000.
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
currency = 'currency_example' # str | Filter by currency (optional)
_from = 1627706330 # int | Start timestamp of the query (optional)
to = 1635329650 # int | Time range ending, default to current time (optional)
page = 1 # int | Page number (optional) (default to 1)
limit = 100 # int | Maximum number of records to be returned in a single list (optional) (default to 100)
type = 'borrow' # str | Only retrieve changes of the specified type. All types will be returned if not specified. (optional)
try:
# Retrieve cross margin account change history
api_response = api_instance.list_cross_margin_account_book(currency=currency, _from=_from, to=to, page=page, limit=limit, type=type)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->list_cross_margin_account_book: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
currency | str | Filter by currency | [optional] |
_from | int | Start timestamp of the query | [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 to be returned in a single list | [optional] [default to 100] |
type | str | Only retrieve changes of the specified type. All types will be returned if not specified. | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[CrossMarginLoan] list_cross_margin_loans(status, currency=currency, limit=limit, offset=offset, reverse=reverse)
List cross margin borrow history
Sort by creation time in descending order by default. Set reverse=false
to return ascending results.
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
status = 56 # int | Filter by status. Supported values are 2 and 3. (deprecated.)
currency = 'currency_example' # str | Filter by currency (optional)
limit = 100 # int | Maximum number of records to be returned in a single list (optional) (default to 100)
offset = 0 # int | List offset, starting from 0 (optional) (default to 0)
reverse = True # bool | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional) (default to True)
try:
# List cross margin borrow history
api_response = api_instance.list_cross_margin_loans(status, currency=currency, limit=limit, offset=offset, reverse=reverse)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->list_cross_margin_loans: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
status | int | Filter by status. Supported values are 2 and 3. (deprecated.) | |
currency | str | Filter by currency | [optional] |
limit | int | Maximum number of records to be returned in a single 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] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CrossMarginLoan create_cross_margin_loan(cross_margin_loan)
Create a cross margin borrow loan
Borrow amount cannot be less than currency minimum borrow amount
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
cross_margin_loan = gate_api.CrossMarginLoan() # CrossMarginLoan |
try:
# Create a cross margin borrow loan
api_response = api_instance.create_cross_margin_loan(cross_margin_loan)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->create_cross_margin_loan: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
cross_margin_loan | CrossMarginLoan |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully borrowed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CrossMarginLoan get_cross_margin_loan(loan_id)
Retrieve single borrow loan detail
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
loan_id = '12345' # str | Borrow loan ID
try:
# Retrieve single borrow loan detail
api_response = api_instance.get_cross_margin_loan(loan_id)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->get_cross_margin_loan: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
loan_id | str | Borrow loan ID |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[CrossMarginRepayment] list_cross_margin_repayments(currency=currency, loan_id=loan_id, limit=limit, offset=offset, reverse=reverse)
Retrieve cross margin repayments
Sort by creation time in descending order by default. Set reverse=false
to return ascending results.
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
currency = 'BTC' # str | (optional)
loan_id = '12345' # str | (optional)
limit = 100 # int | Maximum number of records to be returned in a single list (optional) (default to 100)
offset = 0 # int | List offset, starting from 0 (optional) (default to 0)
reverse = True # bool | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional) (default to True)
try:
# Retrieve cross margin repayments
api_response = api_instance.list_cross_margin_repayments(currency=currency, loan_id=loan_id, limit=limit, offset=offset, reverse=reverse)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->list_cross_margin_repayments: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
currency | str | [optional] | |
loan_id | str | [optional] | |
limit | int | Maximum number of records to be returned in a single 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] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[CrossMarginLoan] repay_cross_margin_loan(cross_margin_repay_request)
Cross margin repayments
When the liquidity of the currency is insufficient and the transaction risk is high, the currency will be disabled, and funds cannot be transferred.When the available balance of cross-margin is insufficient, the balance of the spot account can be used for repayment. Please ensure that the balance of the spot account is sufficient, and system uses cross-margin account for repayment first
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
cross_margin_repay_request = gate_api.CrossMarginRepayRequest() # CrossMarginRepayRequest |
try:
# Cross margin repayments
api_response = api_instance.repay_cross_margin_loan(cross_margin_repay_request)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->repay_cross_margin_loan: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
cross_margin_repay_request | CrossMarginRepayRequest |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Loan repaid | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[UniLoanInterestRecord] get_cross_margin_interest_records(currency=currency, page=page, limit=limit, _from=_from, to=to)
Interest records for the cross margin account
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
currency = 'BTC' # str | Retrieve data of the specified currency (optional)
page = 1 # int | Page number (optional) (default to 1)
limit = 100 # int | Maximum response items. Default: 100, minimum: 1, Maximum: 100 (optional) (default to 100)
_from = 1547706332 # int | Start timestamp (optional)
to = 1547706332 # int | End timestamp (optional)
try:
# Interest records for the cross margin account
api_response = api_instance.get_cross_margin_interest_records(currency=currency, page=page, limit=limit, _from=_from, to=to)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->get_cross_margin_interest_records: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
currency | str | Retrieve data of the specified currency | [optional] |
page | int | Page number | [optional] [default to 1] |
limit | int | Maximum response items. Default: 100, minimum: 1, Maximum: 100 | [optional] [default to 100] |
_from | int | Start timestamp | [optional] |
to | int | End timestamp | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CrossMarginTransferable get_cross_margin_transferable(currency)
Get the max transferable amount for a specific cross margin currency
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
currency = 'BTC' # str | Retrieve data of the specified currency
try:
# Get the max transferable amount for a specific cross margin currency
api_response = api_instance.get_cross_margin_transferable(currency)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->get_cross_margin_transferable: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
currency | str | Retrieve data of the specified currency |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
dict(str, str) get_cross_margin_estimate_rate(currencies)
Estimated interest rates
Please note that the interest rates are subject to change based on the borrowing and lending demand, and therefore, the provided rates may not be entirely accurate.
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
currencies = ['[\"BTC\",\"GT\"]'] # list[str] | An array of up to 10 specifying the currency name
try:
# Estimated interest rates
api_response = api_instance.get_cross_margin_estimate_rate(currencies)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->get_cross_margin_estimate_rate: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
currencies | list[str] | An array of up to 10 specifying the currency name |
dict(str, str)
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UnifiedBorrowable get_cross_margin_borrowable(currency)
Get the max borrowable amount for a specific cross margin currency
- Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure APIv4 key authorization
configuration = gate_api.Configuration(
host = "https://api.gateio.ws/api/v4",
key = "YOU_API_KEY",
secret = "YOUR_API_SECRET"
)
api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.MarginApi(api_client)
currency = 'BTC' # str | Retrieve data of the specified currency
try:
# Get the max borrowable amount for a specific cross margin currency
api_response = api_instance.get_cross_margin_borrowable(currency)
print(api_response)
except GateApiException as ex:
print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
print("Exception when calling MarginApi->get_cross_margin_borrowable: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
currency | str | Retrieve data of the specified currency |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]