All URIs are relative to https://api.gateio.ws/api/v4
| Method | HTTP request | Description |
|---|---|---|
| list_sub_accounts | GET /sub_accounts | List sub-accounts |
| create_sub_accounts | POST /sub_accounts | Create a new sub-account |
| get_sub_account | GET /sub_accounts/{user_id} | Get sub-account |
| list_sub_account_keys | GET /sub_accounts/{user_id}/keys | List all API key pairs of the sub-account |
| create_sub_account_keys | POST /sub_accounts/{user_id}/keys | Create new sub-account API key pair |
| get_sub_account_key | GET /sub_accounts/{user_id}/keys/{key} | Get specific API key pair of the sub-account |
| update_sub_account_keys | PUT /sub_accounts/{user_id}/keys/{key} | Update sub-account API key pair |
| delete_sub_account_keys | DELETE /sub_accounts/{user_id}/keys/{key} | Delete sub-account API key pair |
| lock_sub_account | POST /sub_accounts/{user_id}/lock | Lock sub-account |
| unlock_sub_account | POST /sub_accounts/{user_id}/unlock | Unlock sub-account |
| list_unified_mode | GET /sub_accounts/unified_mode | Get sub-account mode |
list[SubAccount] list_sub_accounts(type=type)
List sub-accounts
- 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.SubAccountApi(api_client)
type = '0' # str | Enter `0` to list all types of sub-accounts (currently supporting cross-margin sub-accounts and regular sub-accounts). Enter `1` to query regular sub-accounts only. If no parameter is passed, only regular sub-accounts will be queried by default. (optional)
try:
# List sub-accounts
api_response = api_instance.list_sub_accounts(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 SubAccountApi->list_sub_accounts: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| type | str | Enter `0` to list all types of sub-accounts (currently supporting cross-margin sub-accounts and regular sub-accounts). Enter `1` to query regular sub-accounts only. If no parameter is passed, only regular sub-accounts will be queried by default. | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved successfully | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SubAccount create_sub_accounts(sub_account)
Create a new sub-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.SubAccountApi(api_client)
sub_account = gate_api.SubAccount() # SubAccount |
try:
# Create a new sub-account
api_response = api_instance.create_sub_accounts(sub_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 SubAccountApi->create_sub_accounts: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| sub_account | SubAccount |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 201 | Created successfully | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SubAccount get_sub_account(user_id)
Get sub-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.SubAccountApi(api_client)
user_id = 56 # int | Sub-account user ID
try:
# Get sub-account
api_response = api_instance.get_sub_account(user_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 SubAccountApi->get_sub_account: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| user_id | int | Sub-account user 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[SubAccountKey] list_sub_account_keys(user_id)
List all API key pairs of the sub-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.SubAccountApi(api_client)
user_id = 56 # int | Sub-account user ID
try:
# List all API key pairs of the sub-account
api_response = api_instance.list_sub_account_keys(user_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 SubAccountApi->list_sub_account_keys: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| user_id | int | Sub-account user ID |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved successfully | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SubAccountKey create_sub_account_keys(user_id, sub_account_key)
Create new sub-account API key pair
- 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.SubAccountApi(api_client)
user_id = 56 # int | Sub-account user ID
sub_account_key = gate_api.SubAccountKey() # SubAccountKey |
try:
# Create new sub-account API key pair
api_response = api_instance.create_sub_account_keys(user_id, sub_account_key)
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 SubAccountApi->create_sub_account_keys: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| user_id | int | Sub-account user ID | |
| sub_account_key | SubAccountKey |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Created successfully | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SubAccountKey get_sub_account_key(user_id, key)
Get specific API key pair of the sub-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.SubAccountApi(api_client)
user_id = 56 # int | Sub-account user ID
key = 'key_example' # str | Sub-account API key
try:
# Get specific API key pair of the sub-account
api_response = api_instance.get_sub_account_key(user_id, key)
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 SubAccountApi->get_sub_account_key: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| user_id | int | Sub-account user ID | |
| key | str | Sub-account API key |
- 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]
update_sub_account_keys(user_id, key, sub_account_key)
Update sub-account API key pair
- 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.SubAccountApi(api_client)
user_id = 56 # int | Sub-account user ID
key = 'key_example' # str | Sub-account API key
sub_account_key = gate_api.SubAccountKey() # SubAccountKey |
try:
# Update sub-account API key pair
api_instance.update_sub_account_keys(user_id, key, sub_account_key)
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 SubAccountApi->update_sub_account_keys: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| user_id | int | Sub-account user ID | |
| key | str | Sub-account API key | |
| sub_account_key | SubAccountKey |
void (empty response body)
- Content-Type: application/json
- Accept: Not defined
| Status code | Description | Response headers |
|---|---|---|
| 204 | Updated successfully | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
delete_sub_account_keys(user_id, key)
Delete sub-account API key pair
- 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.SubAccountApi(api_client)
user_id = 56 # int | Sub-account user ID
key = 'key_example' # str | Sub-account API key
try:
# Delete sub-account API key pair
api_instance.delete_sub_account_keys(user_id, key)
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 SubAccountApi->delete_sub_account_keys: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| user_id | int | Sub-account user ID | |
| key | str | Sub-account API key |
void (empty response body)
- Content-Type: Not defined
- Accept: Not defined
| Status code | Description | Response headers |
|---|---|---|
| 204 | Deleted successfully | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
lock_sub_account(user_id)
Lock sub-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.SubAccountApi(api_client)
user_id = 56 # int | Sub-account user ID
try:
# Lock sub-account
api_instance.lock_sub_account(user_id)
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 SubAccountApi->lock_sub_account: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| user_id | int | Sub-account user ID |
void (empty response body)
- Content-Type: Not defined
- Accept: Not defined
| Status code | Description | Response headers |
|---|---|---|
| 204 | Locked successfully | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
unlock_sub_account(user_id)
Unlock sub-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.SubAccountApi(api_client)
user_id = 56 # int | Sub-account user ID
try:
# Unlock sub-account
api_instance.unlock_sub_account(user_id)
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 SubAccountApi->unlock_sub_account: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| user_id | int | Sub-account user ID |
void (empty response body)
- Content-Type: Not defined
- Accept: Not defined
| Status code | Description | Response headers |
|---|---|---|
| 204 | Unlocked successfully | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
list[SubUserMode] list_unified_mode()
Get sub-account mode
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.SubAccountApi(api_client)
try:
# Get sub-account mode
api_response = api_instance.list_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 SubAccountApi->list_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 | Query successful | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]