Skip to content

Latest commit

 

History

History
760 lines (569 loc) · 24.7 KB

SubAccountApi.md

File metadata and controls

760 lines (569 loc) · 24.7 KB

gate_api.SubAccountApi

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 the sub-account
list_sub_account_keys GET /sub_accounts/{user_id}/keys List all API Key of the sub-account
create_sub_account_keys POST /sub_accounts/{user_id}/keys Create API Key of the sub-account
get_sub_account_key GET /sub_accounts/{user_id}/keys/{key} Get the API Key of the sub-account
update_sub_account_keys PUT /sub_accounts/{user_id}/keys/{key} Update API key of the sub-account
delete_sub_account_keys DELETE /sub_accounts/{user_id}/keys/{key} Delete API key of the sub-account
lock_sub_account POST /sub_accounts/{user_id}/lock Lock the sub-account
unlock_sub_account POST /sub_accounts/{user_id}/unlock Unlock the sub-account
list_unified_mode GET /sub_accounts/unified_mode Get sub-account mode

list_sub_accounts

list[SubAccount] list_sub_accounts(type=type)

List sub-accounts

Example

  • 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 | `0` to list all types of sub-accounts (currently supporting cross margin accounts and sub-accounts).  `1` to list sub-accounts only. If no parameter is passed, only sub-accounts will be listed 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)

Parameters

Name Type Description Notes
type str `0` to list all types of sub-accounts (currently supporting cross margin accounts and sub-accounts). `1` to list sub-accounts only. If no parameter is passed, only sub-accounts will be listed by default. [optional]

Return type

list[SubAccount]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 List retrieved -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_sub_accounts

SubAccount create_sub_accounts(sub_account)

Create a new sub-account

Example

  • 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)

Parameters

Name Type Description Notes
sub_account SubAccount

Return type

SubAccount

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Created Successfully -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_sub_account

SubAccount get_sub_account(user_id)

Get the sub-account

Example

  • 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 the 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)

Parameters

Name Type Description Notes
user_id int Sub-account user id

Return type

SubAccount

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_sub_account_keys

list[SubAccountKey] list_sub_account_keys(user_id)

List all API Key of the sub-account

Example

  • 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 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)

Parameters

Name Type Description Notes
user_id int Sub-account user id

Return type

list[SubAccountKey]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 List retrieved -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_sub_account_keys

list[SubAccountKey] create_sub_account_keys(user_id, sub_account_key)

Create API Key of the sub-account

Example

  • 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 API Key of the sub-account
    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)

Parameters

Name Type Description Notes
user_id int Sub-account user id
sub_account_key SubAccountKey

Return type

list[SubAccountKey]

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Created Successfully -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_sub_account_key

SubAccountKey get_sub_account_key(user_id, key)

Get the API Key of the sub-account

Example

  • 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 | The API Key of the sub-account

try:
    # Get the API Key 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)

Parameters

Name Type Description Notes
user_id int Sub-account user id
key str The API Key of the sub-account

Return type

SubAccountKey

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_sub_account_keys

update_sub_account_keys(user_id, key, sub_account_key)

Update API key of the sub-account

Example

  • 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 | The API Key of the sub-account
sub_account_key = gate_api.SubAccountKey() # SubAccountKey | 

try:
    # Update API key of the sub-account
    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)

Parameters

Name Type Description Notes
user_id int Sub-account user id
key str The API Key of the sub-account
sub_account_key SubAccountKey

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 Updated -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_sub_account_keys

delete_sub_account_keys(user_id, key)

Delete API key of the sub-account

Example

  • 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 | The API Key of the sub-account

try:
    # Delete API key of the sub-account
    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)

Parameters

Name Type Description Notes
user_id int Sub-account user id
key str The API Key of the sub-account

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 Delete successfully -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

lock_sub_account

lock_sub_account(user_id)

Lock the sub-account

Example

  • 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 | The user id of the sub-account

try:
    # Lock the 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)

Parameters

Name Type Description Notes
user_id int The user id of the sub-account

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 Lock successfully -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

unlock_sub_account

unlock_sub_account(user_id)

Unlock the sub-account

Example

  • 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 | The user id of the sub-account

try:
    # Unlock the 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)

Parameters

Name Type Description Notes
user_id int The user id of the sub-account

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 Unlock successfully -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_unified_mode

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

Example

  • 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)

Parameters

This endpoint does not need any parameter.

Return type

list[SubUserMode]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successfully retrieved -

[Back to top] [Back to API list] [Back to Model list] [Back to README]