All URIs are relative to https://api.gateio.ws/api/v4
Method | HTTP request | Description |
---|---|---|
list_unified_accounts | GET /unified/accounts | Get unified account information |
list_unified_account_mode | GET /unified/account_mode | Inquire about unified account mode (deprecated) |
set_unified_account_mode | POST /unified/account_mode | Set unified account mode (deprecated) |
get_unified_borrowable | GET /unified/borrowable | Query about the maximum borrowing for the unified account |
get_unified_transferable | GET /unified/transferable | Query about the maximum transferable for the unified account |
list_unified_loans | GET /unified/loans | List loans |
create_unified_loan | POST /unified/loans | Borrow or repay |
list_unified_loan_records | GET /unified/loan_records | Get load records |
list_unified_loan_interest_records | GET /unified/interest_records | List interest records |
get_unified_risk_units | GET /unified/risk_units | Retrieve user risk unit details, only valid in portfolio margin mode |
get_unified_mode | GET /unified/unified_mode | Query mode of the unified account |
set_unified_mode | PUT /unified/unified_mode | Set mode of the unified account |
get_unified_estimate_rate | GET /unified/estimate_rate | Get unified estimate rate |
list_currency_discount_tiers | GET /unified/currency_discount_tiers | List currency discount tiers |
list_loan_margin_tiers | GET /unified/loan_margin_tiers | List loan margin tiers |
calculate_portfolio_margin | POST /unified/portfolio_calculator | Portfolio margin calculator |
get_user_leverage_currency_config | GET /unified/leverage/user_currency_config | The maximum and minimum leverage multiples that users can set for a currency type are: |
get_user_leverage_currency_setting | GET /unified/leverage/user_currency_setting | Get the user's currency leverage. If currency is not passed, query all currencies. |
set_user_leverage_currency_setting | POST /unified/leverage/user_currency_setting | Set the currency leverage ratio |
UnifiedAccount list_unified_accounts(currency=currency)
Get unified account information
The assets of each currency in the account will be adjusted according to their liquidity, defined by corresponding adjustment coefficients, and then uniformly converted to USD to calculate the total asset value and position value of the account. You can refer to the Formula in the documentation
- 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.UnifiedApi(api_client)
currency = 'BTC' # str | Retrieve data of the specified currency (optional)
try:
# Get unified account information
api_response = api_instance.list_unified_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 UnifiedApi->list_unified_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]
dict(str, bool) list_unified_account_mode()
Inquire about unified account mode (deprecated)
cross_margin - Spot full-margin trading, usdt_futures - USDT perpetual futures
- 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.UnifiedApi(api_client)
try:
# Inquire about unified account mode (deprecated)
api_response = api_instance.list_unified_account_mode()
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 UnifiedApi->list_unified_account_mode: %s\n" % e)
This endpoint does not need any parameter.
dict(str, bool)
- 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, bool) set_unified_account_mode(unified_mode)
Set unified account mode (deprecated)
- 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.UnifiedApi(api_client)
unified_mode = gate_api.UnifiedMode() # UnifiedMode |
try:
# Set unified account mode (deprecated)
api_response = api_instance.set_unified_account_mode(unified_mode)
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 UnifiedApi->set_unified_account_mode: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
unified_mode | UnifiedMode |
dict(str, bool)
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UnifiedBorrowable get_unified_borrowable(currency)
Query about the maximum borrowing for the unified 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.UnifiedApi(api_client)
currency = 'BTC' # str | Retrieve data of the specified currency
try:
# Query about the maximum borrowing for the unified account
api_response = api_instance.get_unified_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 UnifiedApi->get_unified_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]
UnifiedTransferable get_unified_transferable(currency)
Query about the maximum transferable for the unified 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.UnifiedApi(api_client)
currency = 'BTC' # str | Retrieve data of the specified currency
try:
# Query about the maximum transferable for the unified account
api_response = api_instance.get_unified_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 UnifiedApi->get_unified_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]
list[UniLoan] list_unified_loans(currency=currency, page=page, limit=limit, type=type)
List loans
- 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.UnifiedApi(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)
type = 'platform' # str | Loan type, platform - platform, margin - margin (optional)
try:
# List loans
api_response = api_instance.list_unified_loans(currency=currency, 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 UnifiedApi->list_unified_loans: %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] |
type | str | Loan type, platform - platform, margin - margin | [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]
create_unified_loan(unified_loan)
Borrow or repay
When borrowing, it is essential to ensure that the borrowed amount is not below the minimum borrowing threshold for the specific cryptocurrency and does not exceed the maximum borrowing limit set by the platform and the user. The interest on the loan will be automatically deducted from the account at regular intervals. It is the user's responsibility to manage the repayment of the borrowed amount. For repayment, the option to repay the entire borrowed amount is available by setting the parameter repaid_all=true
- 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.UnifiedApi(api_client)
unified_loan = gate_api.UnifiedLoan() # UnifiedLoan |
try:
# Borrow or repay
api_instance.create_unified_loan(unified_loan)
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 UnifiedApi->create_unified_loan: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
unified_loan | UnifiedLoan |
void (empty response body)
- Content-Type: application/json
- Accept: Not defined
Status code | Description | Response headers |
---|---|---|
204 | Operated successfully | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[UnifiedLoanRecord] list_unified_loan_records(type=type, currency=currency, page=page, limit=limit)
Get load records
- 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.UnifiedApi(api_client)
type = 'type_example' # str | The types of lending records, borrow - indicates the action of borrowing funds, repay - indicates the action of repaying the borrowed funds (optional)
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)
try:
# Get load records
api_response = api_instance.list_unified_loan_records(type=type, currency=currency, 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 UnifiedApi->list_unified_loan_records: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
type | str | The types of lending records, borrow - indicates the action of borrowing funds, repay - indicates the action of repaying the borrowed funds | [optional] |
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] |
- 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[UniLoanInterestRecord] list_unified_loan_interest_records(currency=currency, page=page, limit=limit, _from=_from, to=to, type=type)
List interest records
- 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.UnifiedApi(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 = 1627706330 # int | Start timestamp of the query (optional)
to = 1635329650 # int | Time range ending, default to current time (optional)
type = 'platform' # str | Loan type, platform loan - platform, leverage loan - margin, if not passed, defaults to margin (optional)
try:
# List interest records
api_response = api_instance.list_unified_loan_interest_records(currency=currency, page=page, limit=limit, _from=_from, to=to, 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 UnifiedApi->list_unified_loan_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 of the query | [optional] |
to | int | Time range ending, default to current time | [optional] |
type | str | Loan type, platform loan - platform, leverage loan - margin, if not passed, defaults to margin | [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]
UnifiedRiskUnits get_unified_risk_units()
Retrieve user risk unit details, only valid in portfolio margin mode
- 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.UnifiedApi(api_client)
try:
# Retrieve user risk unit details, only valid in portfolio margin mode
api_response = api_instance.get_unified_risk_units()
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 UnifiedApi->get_unified_risk_units: %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]
UnifiedModeSet get_unified_mode()
Query mode of the unified account
Unified account mode: - classic
: Classic account mode - multi_currency
: Multi-currency margin mode - portfolio
: Portfolio margin mode
- 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.UnifiedApi(api_client)
try:
# Query mode of the unified account
api_response = api_instance.get_unified_mode()
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 UnifiedApi->get_unified_mode: %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]
set_unified_mode(unified_mode_set)
Set mode of the unified account
Switching between different account modes requires only passing the parameters n\corresponding to the target account mode. It also supports opening or closing configuration switches for the corresponding account mode when switching- When enabling classic account mode,mode=classic PUT /unified/unified_mode { \"mode\": \"classic\" }
- When enabling multi-currency margin mode, mode=multi_currency PUT /unified/unified_mode { \"mode\": \"multi_currency\", \"settings\": { \"usdt_futures\": true } }
- When enabling portfolio margin mode,mode=portfolio PUT /unified/unified_mode { \"mode\": \"portfolio\", \"settings\": { \"spot_hedge\": true } }
- 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.UnifiedApi(api_client)
unified_mode_set = gate_api.UnifiedModeSet() # UnifiedModeSet |
try:
# Set mode of the unified account
api_instance.set_unified_mode(unified_mode_set)
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 UnifiedApi->set_unified_mode: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
unified_mode_set | UnifiedModeSet |
void (empty response body)
- Content-Type: application/json
- Accept: Not defined
Status code | Description | Response headers |
---|---|---|
204 | Success | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
dict(str, str) get_unified_estimate_rate(currencies)
Get unified estimate rate
Due to fluctuations in lending depth, hourly interest rates may vary, and thus, I cannot provide exact rates. When a currency is not supported, the interest rate returned will be an empty string.
- 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.UnifiedApi(api_client)
currencies = ['[\"BTC\",\"GT\"]'] # list[str] | Specify the currency names for querying in an array, separated by commas, with a maximum of 10 currencies.
try:
# Get unified estimate rate
api_response = api_instance.get_unified_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 UnifiedApi->get_unified_estimate_rate: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
currencies | list[str] | Specify the currency names for querying in an array, separated by commas, with a maximum of 10 currencies. |
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]
list[UnifiedDiscount] list_currency_discount_tiers()
List currency discount tiers
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.UnifiedApi(api_client)
try:
# List currency discount tiers
api_response = api_instance.list_currency_discount_tiers()
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 UnifiedApi->list_currency_discount_tiers: %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 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[UnifiedMarginTiers] list_loan_margin_tiers()
List loan margin tiers
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.UnifiedApi(api_client)
try:
# List loan margin tiers
api_response = api_instance.list_loan_margin_tiers()
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 UnifiedApi->list_loan_margin_tiers: %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 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UnifiedPortfolioOutput calculate_portfolio_margin(unified_portfolio_input)
Portfolio margin calculator
Portfolio Margin Calculator When inputting a simulated position portfolio, each position includes the position name and quantity held, supporting markets within the range of BTC and ETH perpetual contracts, options, and spot markets. When inputting simulated orders, each order includes the market identifier, order price, and order quantity, supporting markets within the range of BTC and ETH perpetual contracts, options, and spot markets. Market orders are not included.
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.UnifiedApi(api_client)
unified_portfolio_input = gate_api.UnifiedPortfolioInput() # UnifiedPortfolioInput |
try:
# Portfolio margin calculator
api_response = api_instance.calculate_portfolio_margin(unified_portfolio_input)
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 UnifiedApi->calculate_portfolio_margin: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
unified_portfolio_input | UnifiedPortfolioInput |
No authorization required
- Content-Type: application/json
- 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]
UnifiedLeverageConfig get_user_leverage_currency_config(currency)
The maximum and minimum leverage multiples that users can set for a currency type are:
- 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.UnifiedApi(api_client)
currency = 'BTC' # str | Currency
try:
# The maximum and minimum leverage multiples that users can set for a currency type are:
api_response = api_instance.get_user_leverage_currency_config(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 UnifiedApi->get_user_leverage_currency_config: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
currency | str | 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]
UnifiedLeverageSetting get_user_leverage_currency_setting(currency=currency)
Get the user's currency leverage. If currency is not passed, query all currencies.
- 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.UnifiedApi(api_client)
currency = 'BTC' # str | Currency (optional)
try:
# Get the user's currency leverage. If currency is not passed, query all currencies.
api_response = api_instance.get_user_leverage_currency_setting(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 UnifiedApi->get_user_leverage_currency_setting: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
currency | str | Currency | [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]
set_user_leverage_currency_setting(unified_leverage_setting=unified_leverage_setting)
Set the currency leverage ratio
- 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.UnifiedApi(api_client)
unified_leverage_setting = gate_api.UnifiedLeverageSetting() # UnifiedLeverageSetting | (optional)
try:
# Set the currency leverage ratio
api_instance.set_user_leverage_currency_setting(unified_leverage_setting=unified_leverage_setting)
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 UnifiedApi->set_user_leverage_currency_setting: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
unified_leverage_setting | UnifiedLeverageSetting | [optional] |
void (empty response body)
- Content-Type: application/json
- Accept: Not defined
Status code | Description | Response headers |
---|---|---|
204 | Success | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]