All URIs are relative to https://api.gateio.ws/api/v4
| Method | HTTP request | Description |
|---|---|---|
| query_stock_user_assets | GET /stock/users/assets | Query user assets |
| query_stock_symbols | GET /stock/symbols | Query symbol list |
| query_stock_symbol_detail | GET /stock/symbols/detail | Query symbol details |
| query_stock_order_book | GET /stock/market/{symbol}/orderbook | Query market order book |
| query_stock_order_list | GET /stock/orders | Query open order list |
| create_stock_order | POST /stock/orders | Create order |
| delete_all_stock_orders | DELETE /stock/orders | Cancel all open orders |
| query_stock_order_history | GET /stock/orders/history | Query historical order list |
| update_stock_order | PUT /stock/orders/{order_id} | Modify order |
| delete_stock_order | DELETE /stock/orders/{order_id} | Cancel order |
| query_stock_positions | GET /stock/positions | Query current position list |
| close_stock_position | POST /stock/positions/close | Close position |
| query_stock_transactions | GET /stock/transactions | Query transaction records |
| create_stock_transaction | POST /stock/transactions | Fund transfer |
| query_stock_exchanges | GET /stock/exchanges | Query supported exchanges |
| query_stock_fee_rate | GET /stock/fee-rate | Query fee rates for Japanese and Korean stocks |
UserAssetResp2 query_stock_user_assets(pnl_calc_type=pnl_calc_type, pnl_calc_price=pnl_calc_price)
Query user assets
Rate limit: 5 qps.
- Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.StockApi(api_client)
pnl_calc_type=1# int | PnL calculation cost type. Defaults to average cost price when omitted (1 = average cost price, 2 = diluted cost price) (optional)pnl_calc_price=1# int | PnL calculation price type. Defaults to intraday price when omitted (1 = intraday price, 2 = latest extended-hours price) (optional)try:
# Query user assetsapi_response=api_instance.query_stock_user_assets(pnl_calc_type=pnl_calc_type, pnl_calc_price=pnl_calc_price)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->query_stock_user_assets: %s\n"%e)| Name | Type | Description | Notes |
|---|---|---|---|
| pnl_calc_type | int | PnL calculation cost type. Defaults to average cost price when omitted (1 = average cost price, 2 = diluted cost price) | [optional] |
| pnl_calc_price | int | PnL calculation price type. Defaults to intraday price when omitted (1 = intraday price, 2 = latest extended-hours price) | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
Symbols2 query_stock_symbols(symbols=symbols, exchange=exchange, with_desc_i18n=with_desc_i18n, page=page, page_size=page_size)
Query symbol list
Rate limit: 5 qps.
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.StockApi(api_client)
symbols='AAPL,TSLA'# str | Symbol list, multiple separated by commas (optional)exchange='us'# str | Exchange, supports us, hk, and kr (optional)with_desc_i18n=true# bool | Whether to return multilingual symbol description (optional)page=1# int | Page number, defaults to 1 (optional)page_size=100# int | Page size, defaults to 10, max 500; server caps at 500 (optional)try:
# Query symbol listapi_response=api_instance.query_stock_symbols(symbols=symbols, exchange=exchange, with_desc_i18n=with_desc_i18n, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->query_stock_symbols: %s\n"%e)| Name | Type | Description | Notes |
|---|---|---|---|
| symbols | str | Symbol list, multiple separated by commas | [optional] |
| exchange | str | Exchange, supports us, hk, and kr | [optional] |
| with_desc_i18n | bool | Whether to return multilingual symbol description | [optional] |
| page | int | Page number, defaults to 1 | [optional] |
| page_size | int | Page size, defaults to 10, max 500; server caps at 500 | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
SymbolDetail query_stock_symbol_detail(symbols=symbols, exchange=exchange, page=page, page_size=page_size)
Query symbol details
Rate limit: 5 qps.
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.StockApi(api_client)
symbols='AAPL,TSLA'# str | Symbol list, multiple separated by commas (optional)exchange='us'# str | Exchange, supports us, hk, and kr (optional)page=1# int | Page number, defaults to 1 (optional)page_size=100# int | Page size, defaults to 10, max 500; server caps at 500 (optional)try:
# Query symbol detailsapi_response=api_instance.query_stock_symbol_detail(symbols=symbols, exchange=exchange, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->query_stock_symbol_detail: %s\n"%e)| Name | Type | Description | Notes |
|---|---|---|---|
| symbols | str | Symbol list, multiple separated by commas | [optional] |
| exchange | str | Exchange, supports us, hk, and kr | [optional] |
| page | int | Page number, defaults to 1 | [optional] |
| page_size | int | Page size, defaults to 10, max 500; server caps at 500 | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
OrderBook2 query_stock_order_book(symbol)
Query market order book
Rate limit: 5 qps.
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.StockApi(api_client)
symbol='AAPL'# str | Symboltry:
# Query market order bookapi_response=api_instance.query_stock_order_book(symbol)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->query_stock_order_book: %s\n"%e)| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | str | Symbol |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
OrderList2 query_stock_order_list(symbol=symbol)
Query open order list
Rate limit: 5 qps.
- Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.StockApi(api_client)
symbol='AAPL'# str | Symbol (optional)try:
# Query open order listapi_response=api_instance.query_stock_order_list(symbol=symbol)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->query_stock_order_list: %s\n"%e)| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | str | Symbol | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
CreateOrder2 create_stock_order(trad_fi_spot_order_request)
Create order
Rate limit: 5 qps.
- Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.StockApi(api_client)
trad_fi_spot_order_request=gate_api.TradFiSpotOrderRequest() # TradFiSpotOrderRequest | try:
# Create orderapi_response=api_instance.create_stock_order(trad_fi_spot_order_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->create_stock_order: %s\n"%e)| Name | Type | Description | Notes |
|---|---|---|---|
| trad_fi_spot_order_request | TradFiSpotOrderRequest |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Order placed successfully | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
DeleteOrder delete_all_stock_orders()
Cancel all open orders
Rate limit: 5 qps.
- Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.StockApi(api_client)
try:
# Cancel all open ordersapi_response=api_instance.delete_all_stock_orders()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->delete_all_stock_orders: %s\n"%e)This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
OrderHistoryList2 query_stock_order_history(symbol=symbol, order_ids=order_ids, begin_time=begin_time, end_time=end_time, side=side, page=page, page_size=page_size)
Query historical order list
Rate limit: 5 qps.
- Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.StockApi(api_client)
symbol='AAPL'# str | Symbol (optional)order_ids='123456,123457'# str | Order ID list, multiple separated by commas; max 20, each must be a positive integer (optional)begin_time=1769378400# int | Start time (Unix timestamp, seconds). When both begin_time and end_time are provided, end_time must be >= begin_time, query range must not exceed 3 months. (optional)end_time=1769464800# int | End time (Unix timestamp, seconds). When both begin_time and end_time are provided, end_time must be >= begin_time, query range must not exceed 3 months. (optional)side=2# int | Side (1=sell, 2=buy) (optional)page=1# int | Page number, defaults to 1 (optional)page_size=100# int | Page size, defaults to 10, max 500; server caps at 500 (optional)try:
# Query historical order listapi_response=api_instance.query_stock_order_history(symbol=symbol, order_ids=order_ids, begin_time=begin_time, end_time=end_time, side=side, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->query_stock_order_history: %s\n"%e)| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | str | Symbol | [optional] |
| order_ids | str | Order ID list, multiple separated by commas; max 20, each must be a positive integer | [optional] |
| begin_time | int | Start time (Unix timestamp, seconds). When both begin_time and end_time are provided, end_time must be >= begin_time, query range must not exceed 3 months. | [optional] |
| end_time | int | End time (Unix timestamp, seconds). When both begin_time and end_time are provided, end_time must be >= begin_time, query range must not exceed 3 months. | [optional] |
| side | int | Side (1=sell, 2=buy) | [optional] |
| page | int | Page number, defaults to 1 | [optional] |
| page_size | int | Page size, defaults to 10, max 500; server caps at 500 | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
UpdateOrder2 update_stock_order(order_id, trad_fi_spot_order_update_request)
Modify order
Rate limit: 5 qps.
- Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.StockApi(api_client)
order_id=123456# int | Order IDtrad_fi_spot_order_update_request=gate_api.TradFiSpotOrderUpdateRequest() # TradFiSpotOrderUpdateRequest | try:
# Modify orderapi_response=api_instance.update_stock_order(order_id, trad_fi_spot_order_update_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->update_stock_order: %s\n"%e)| Name | Type | Description | Notes |
|---|---|---|---|
| order_id | int | Order ID | |
| trad_fi_spot_order_update_request | TradFiSpotOrderUpdateRequest |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
DeleteOrder delete_stock_order(order_id)
Cancel order
Rate limit: 5 qps.
- Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.StockApi(api_client)
order_id=123456# int | Order IDtry:
# Cancel orderapi_response=api_instance.delete_stock_order(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->delete_stock_order: %s\n"%e)| Name | Type | Description | Notes |
|---|---|---|---|
| order_id | int | Order ID |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
PositionList2 query_stock_positions(pnl_calc_type=pnl_calc_type, pnl_calc_price=pnl_calc_price, symbol=symbol, exchange=exchange)
Query current position list
Rate limit: 5 qps.
- Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.StockApi(api_client)
pnl_calc_type=1# int | PnL calculation cost type. Defaults to average cost price when omitted (1 = average cost price, 2 = diluted cost price) (optional)pnl_calc_price=1# int | PnL calculation price type. Defaults to intraday price when omitted (1 = intraday price, 2 = latest extended-hours price) (optional)symbol='AAPL'# str | Symbol (optional)exchange='us'# str | Exchange, supports us, hk, and kr (optional)try:
# Query current position listapi_response=api_instance.query_stock_positions(pnl_calc_type=pnl_calc_type, pnl_calc_price=pnl_calc_price, symbol=symbol, exchange=exchange)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->query_stock_positions: %s\n"%e)| Name | Type | Description | Notes |
|---|---|---|---|
| pnl_calc_type | int | PnL calculation cost type. Defaults to average cost price when omitted (1 = average cost price, 2 = diluted cost price) | [optional] |
| pnl_calc_price | int | PnL calculation price type. Defaults to intraday price when omitted (1 = intraday price, 2 = latest extended-hours price) | [optional] |
| symbol | str | Symbol | [optional] |
| exchange | str | Exchange, supports us, hk, and kr | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
ClosePosition close_stock_position(trad_fi_spot_close_position_request)
Close position
Rate limit: 5 qps.
- Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.StockApi(api_client)
trad_fi_spot_close_position_request=gate_api.TradFiSpotClosePositionRequest() # TradFiSpotClosePositionRequest | try:
# Close positionapi_response=api_instance.close_stock_position(trad_fi_spot_close_position_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->close_stock_position: %s\n"%e)| Name | Type | Description | Notes |
|---|---|---|---|
| trad_fi_spot_close_position_request | TradFiSpotClosePositionRequest |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
TransactionList2 query_stock_transactions(begin_time=begin_time, end_time=end_time, ref_id=ref_id, type=type, page=page, page_size=page_size)
Query transaction records
Rate limit: 5 qps.
- Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.StockApi(api_client)
begin_time=1769378400# int | Start time (Unix timestamp, seconds). When both begin_time and end_time are provided, end_time must be >= begin_time, query range must not exceed 3 months. (optional)end_time=1769464800# int | End time (Unix timestamp, seconds). When both begin_time and end_time are provided, end_time must be >= begin_time, query range must not exceed 3 months. (optional)ref_id='transfer-202607070001'# str | Business idempotent ID. When ref_id is provided, the server queries by ref_id, ignoring other parameters such as begin_time, end_time, type, page, page_size (optional)type='deposit'# str | Transaction type (optional)page=1# int | Page number, defaults to 1 (optional)page_size=100# int | Page size, defaults to 10, max 500; server caps at 500 (optional)try:
# Query transaction recordsapi_response=api_instance.query_stock_transactions(begin_time=begin_time, end_time=end_time, ref_id=ref_id, type=type, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->query_stock_transactions: %s\n"%e)| Name | Type | Description | Notes |
|---|---|---|---|
| begin_time | int | Start time (Unix timestamp, seconds). When both begin_time and end_time are provided, end_time must be >= begin_time, query range must not exceed 3 months. | [optional] |
| end_time | int | End time (Unix timestamp, seconds). When both begin_time and end_time are provided, end_time must be >= begin_time, query range must not exceed 3 months. | [optional] |
| ref_id | str | Business idempotent ID. When ref_id is provided, the server queries by ref_id, ignoring other parameters such as begin_time, end_time, type, page, page_size | [optional] |
| type | str | Transaction type | [optional] |
| page | int | Page number, defaults to 1 | [optional] |
| page_size | int | Page size, defaults to 10, max 500; server caps at 500 | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
CreateTransaction2 create_stock_transaction(trad_fi_spot_transaction_request)
Fund transfer
Rate limit: 5 qps.
- Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.StockApi(api_client)
trad_fi_spot_transaction_request=gate_api.TradFiSpotTransactionRequest() # TradFiSpotTransactionRequest | try:
# Fund transferapi_response=api_instance.create_stock_transaction(trad_fi_spot_transaction_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->create_stock_transaction: %s\n"%e)| Name | Type | Description | Notes |
|---|---|---|---|
| trad_fi_spot_transaction_request | TradFiSpotTransactionRequest |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
Exchanges query_stock_exchanges()
Query supported exchanges
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.StockApi(api_client)
try:
# Query supported exchangesapi_response=api_instance.query_stock_exchanges()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->query_stock_exchanges: %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 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]
FeeRate query_stock_fee_rate()
Query fee rates for Japanese and Korean stocks
Query fee rates for Japanese and Korean stocks. Rate limit: 5 qps.
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.StockApi(api_client)
try:
# Query fee rates for Japanese and Korean stocksapi_response=api_instance.query_stock_fee_rate()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling StockApi->query_stock_fee_rate: %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 | Request success | - |
| 400 | Request failed | - |
[Back to top][Back to API list][Back to Model list][Back to README]