Skip to content

# Stock

The Stock API provides traditional financial stock spot trading. Responses are compatible with APIv4: successful responses contain data and timestamp; error responses contain label, message, data, and timestamp.

  • REST API production BaseURL: https://api.gateio.ws/api/v4/
  • Documentation route prefix: /stock
  • For lead trading via APIv4, add the request header x-gate-trader-copy-type: stock_copy (fund transfers and transaction history endpoints are excluded from lead trading).

# Query user assets

Code samples

# coding: utf-8
import requests
import time
import hashlib
import hmac

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/users/assets'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())

key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/stock/users/assets"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')

full_url="$host$prefix$url"
curl -X $method $full_url \
    -H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"

GET /stock/users/assets

Query user assets

Rate limit: 5 qps.

Parameters

Name In Type Required Description
pnl_calc_type query integer false PnL calculation cost type. Defaults to average cost price when omitted (1 = average cost price, 2 = diluted cost price)
pnl_calc_price query integer false PnL calculation price type. Defaults to intraday price when omitted (1 = intraday price, 2 = latest extended-hours price)

# Enumerated Values

Parameter Value
pnl_calc_type 1
pnl_calc_type 2
pnl_calc_price 1
pnl_calc_price 2

Example responses

200 Response

{
  "data": {
    "equity": "10000.12",
    "balance": "8000",
    "available": "6500.5",
    "position_market_value": "1500.25",
    "position_pnl": "12.5",
    "today_pnl": "3.2",
    "option_position_market_value": "0",
    "option_position_pnl": "0",
    "option_today_pnl": "0",
    "user_exists": true
  },
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success TradfiSpotUserAssetResp
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object none
»» equity string Account equity
»» balance string Account Balance
»» available string Available Balance
»» position_market_value string Position market value
»» position_pnl string Position P&L
»» today_pnl string Today's P&L
»» option_position_market_value string Option position market value
»» option_position_pnl string Option position PnL
»» option_today_pnl string Option today's PnL
»» user_exists boolean Whether the user has activated the service
» timestamp integer(int64) Server timestamp (milliseconds)

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

WARNING

To perform this operation, you must be authenticated by API key and secret

# Query symbol list

Code samples

# coding: utf-8
import requests

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/symbols'
query_param = ''
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())


curl -X GET https://api.gateio.ws/api/v4/stock/symbols \
  -H 'Accept: application/json'

GET /stock/symbols

Query symbol list

Rate limit: 5 qps.

Parameters

Name In Type Required Description
symbols query string false Symbol list, multiple separated by commas
exchange query string false Exchange, supports us, hk, kr, and jp
with_desc_i18n query boolean false Whether to return multilingual symbol description
page query integer false Page number, defaults to 1
page_size query integer false Page size, defaults to 10, max 500; server caps at 500

# Enumerated Values

Parameter Value
exchange us
exchange hk
exchange kr
exchange jp

Example responses

200 Response

{
  "data": {
    "total": 1,
    "total_page": 1,
    "list": [
      {
        "symbol": "AAPL",
        "exchange": "us",
        "exchange_desc": "United States",
        "quote_currency": "USD",
        "quote_currency_precision": 2,
        "fx_rate": "1",
        "symbol_desc": "Apple Inc.",
        "category": "CS",
        "asset_type": "STOCK",
        "trade_status": "open",
        "trade_mode": 3,
        "order_fill_timing": 1,
        "icon_link": "https://static.gate.com/aapl.png",
        "quote_currency_symbol": "$",
        "price_precision": 2,
        "volume_precision": 4,
        "is_ipo": false,
        "sell_price_protection": "0.1",
        "buy_price_protection": "0.1",
        "symbol_descs": [
          {
            "lang": "en",
            "value": "Apple Inc."
          }
        ]
      }
    ]
  },
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success TradfiSpotSymbols
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object none
»» total integer(int64) Total quantity
»» total_page integer Total pages
»» list array Symbol list
»»» symbol string Symbol
»»» exchange string Exchange, supports us, hk, kr, and jp
»»» exchange_desc string Exchange description
»»» quote_currency string Quote currency
»»» quote_currency_precision integer Quote currency precision
»»» fx_rate string Quote currency to USD exchange rate
»»» symbol_desc string Symbol description
»»» category string Symbol category.
- CS: Common stock.
- ETF: Exchange-traded funds.
- ADRC, ADR: Depositary receipts for foreign companies listed in the U.S.
- ETV: Exchange-traded products.
- PFD: Preferred stock.
- ETS: Exchange-traded securities.
- ETN: Exchange-traded notes.
- FUND: Funds.
»»» asset_type string Asset type.
- STOCK: Stock.
- ETF: Exchange-traded fund.
»»» trade_status string Trading status.
- pre_market: Pre-market.
- open: Regular trading session.
- post_market: Post-market.
- closed: Market closed.
- gt_lp: GT LP session.
»»» trade_mode integer Current session trading mode.
- 0: Trading disabled.
- 1: Buy only.
- 2: Sell only.
- 4: Buy and sell supported.
»»» order_fill_timing integer Order fill timing (1=immediate, 2=after pre-market opens, 3=after regular session opens)
»»» icon_link string Icon URL
»»» quote_currency_symbol string Quote currency symbol
»»» price_precision integer Price precision
»»» volume_precision integer Quantity precision
»»» is_ipo boolean Whether it is an IPO symbol
»»» ipo_price string IPO price
»»» sell_price_protection string Sell price protection rate
»»» buy_price_protection string Buy price protection rate
»»» symbol_descs array Multilingual symbol description
»»»» lang string Language
»»»» value string Localized description
»»» timestamp integer(int64) none

# Enumerated Values

Property Value
exchange us
exchange hk
exchange kr
exchange jp
category CS
category ETF
category ADRC
category ADR
category ETV
category PFD
category ETS
category ETN
category FUND
asset_type STOCK
asset_type ETF
trade_status pre_market
trade_status open
trade_status post_market
trade_status closed
trade_status gt_lp
trade_mode 0
trade_mode 1
trade_mode 2
trade_mode 4
order_fill_timing 1
order_fill_timing 2
order_fill_timing 3

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

# Query symbol details

Code samples

# coding: utf-8
import requests

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/symbols/detail'
query_param = ''
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())


curl -X GET https://api.gateio.ws/api/v4/stock/symbols/detail \
  -H 'Accept: application/json'

GET /stock/symbols/detail

Query symbol details

Rate limit: 5 qps.

Parameters

Name In Type Required Description
symbols query string false Symbol list, multiple separated by commas
exchange query string false Exchange, supports us, hk, kr, and jp
page query integer false Page number, defaults to 1
page_size query integer false Page size, defaults to 10, max 500; server caps at 500

# Enumerated Values

Parameter Value
exchange us
exchange hk
exchange kr
exchange jp

Example responses

200 Response

{
  "data": {
    "total": 1,
    "total_page": 1,
    "list": [
      {
        "symbol": "AAPL",
        "exchange": "us",
        "exchange_desc": "United States",
        "quote_currency": "USD",
        "quote_currency_precision": 2,
        "fx_rate": "1",
        "symbol_desc": "Apple Inc.",
        "category": "CS",
        "asset_type": "STOCK",
        "settlement_currency": "USD",
        "max_order_volume": "10000",
        "step_order_volume": "1",
        "min_order_volume": "1",
        "price_precision": 2,
        "volume_precision": 4,
        "is_ipo": false,
        "ipo_price": "15",
        "price_protection": "0.1",
        "sell_price_protection": "0.1",
        "buy_price_protection": "0.1",
        "slippage_rate": "0.001",
        "commission_rate": "0.001",
        "trade_status": "open",
        "trade_mode": 3,
        "order_fill_timing": 1,
        "symbol_descs": [
          {
            "lang": "en",
            "value": "Apple Inc."
          }
        ],
        "icon_link": "https://static.gate.com/aapl.png"
      }
    ]
  },
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success SymbolDetail
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object none
»» total integer(int64) Total quantity
»» total_page integer Total pages
»» list array none
»»» symbol string Symbol
»»» exchange string Exchange, supports us, hk, kr, and jp
»»» exchange_desc string Exchange description
»»» quote_currency string Quote currency
»»» quote_currency_precision integer Quote currency precision
»»» fx_rate string Quote currency to USD exchange rate
»»» symbol_desc string Symbol description
»»» category string Symbol category.
- CS: Common stock.
- ETF: Exchange-traded funds.
- ADRC, ADR: Depositary receipts for foreign companies listed in the U.S.
- ETV: Exchange-traded products.
- PFD: Preferred stock.
- ETS: Exchange-traded securities.
- ETN: Exchange-traded notes.
- FUND: Funds.
»»» asset_type string Asset type.
- STOCK: Stock.
- ETF: Exchange-traded fund.
»»» settlement_currency string Settlement currency
»»» max_order_volume string Maximum order quantity
»»» step_order_volume string Order step size
»»» min_order_volume string Minimum order quantity
»»» price_precision integer Price precision
»»» volume_precision integer Quantity precision
»»» is_ipo boolean Whether it is an IPO symbol
»»» ipo_price string IPO price
»»» price_protection string Price protection range
»»» sell_price_protection string Sell price protection rate
»»» buy_price_protection string Buy price protection rate
»»» slippage_rate string Slippage
»»» commission_rate string Fee Rate
»»» trade_status string Trading status.
- pre_market: Pre-market.
- open: Regular trading session.
- post_market: Post-market.
- closed: Market closed.
- gt_lp: GT LP session.
»»» trade_mode integer Current session trading mode.
- 0: Trading disabled.
- 1: Buy only.
- 2: Sell only.
- 4: Buy and sell supported.
»»» order_fill_timing integer Order fill timing (1=immediate, 2=after pre-market opens, 3=after regular session opens)
»»» symbol_descs array Multilingual symbol description
»»»» lang string Language
»»»» value string Localized description
»»» icon_link string Icon URL
»» timestamp integer(int64) none

# Enumerated Values

Property Value
exchange us
exchange hk
exchange kr
exchange jp
category CS
category ETF
category ADRC
category ADR
category ETV
category PFD
category ETS
category ETN
category FUND
asset_type STOCK
asset_type ETF
trade_status pre_market
trade_status open
trade_status post_market
trade_status closed
trade_status gt_lp
trade_mode 0
trade_mode 1
trade_mode 2
trade_mode 4
order_fill_timing 1
order_fill_timing 2
order_fill_timing 3

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

# Query market order book

Code samples

# coding: utf-8
import requests

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/market/AAPL/orderbook'
query_param = ''
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())


curl -X GET https://api.gateio.ws/api/v4/stock/market/AAPL/orderbook \
  -H 'Accept: application/json'

GET /stock/market/{symbol}/orderbook

Query market order book

Rate limit: 5 qps.

Parameters

Name In Type Required Description
symbol path string true Symbol

Example responses

200 Response

{
  "data": {
    "symbol": "AAPL",
    "bids": [
      {
        "p": "200.11",
        "user_order": false
      }
    ],
    "asks": [
      {
        "p": "200.12",
        "user_order": false
      }
    ]
  },
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success TradfiSpotOrderBook
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object none
»» symbol string Symbol
»» bids array Bid orders
»»» p string Price
»»» user_order boolean Whether it is the user's own order
»» asks array Ask orders
»»» p string Price
»»» user_order boolean Whether it is the user's own order
»» timestamp integer(int64) none

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

# Query open order list

Code samples

# coding: utf-8
import requests
import time
import hashlib
import hmac

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/orders'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())

key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/stock/orders"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')

full_url="$host$prefix$url"
curl -X $method $full_url \
    -H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"

GET /stock/orders

Query open order list

Rate limit: 5 qps.

Parameters

Name In Type Required Description
symbol query string false Symbol

Example responses

200 Response

{
  "data": {
    "list": [
      {
        "order_id": "123456",
        "symbol": "AAPL",
        "exchange": "us",
        "quote_currency": "USD",
        "fx_rate": "1",
        "symbol_desc": "Apple Inc.",
        "trade_status": "open",
        "trade_mode": 3,
        "price_type": "limit",
        "side": 2,
        "status": 1,
        "volume": "10",
        "fill_volume": "2",
        "price": "200.12",
        "time_setup": 1769378400,
        "time_update": 1769378500,
        "max_order_volume": "10000",
        "step_order_volume": "1",
        "min_order_volume": "1",
        "price_precision": 2,
        "price_protection": "0.1",
        "sell_price_protection": "0.1",
        "buy_price_protection": "0.1",
        "commission_rate": "0.001",
        "slippage_rate": "0.001"
      }
    ]
  },
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success TradfiSpotOrderList
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object none
»» list array Query active order list
»»» order_id string Order ID
»»» symbol string Symbol
»»» exchange string Exchange, supports us, hk, kr, and jp
»»» quote_currency string Quote currency
»»» fx_rate string Quote currency to USD exchange rate
»»» symbol_desc string Symbol description
»»» trade_status string Trading status.
- pre_market: Pre-market.
- open: Regular trading session.
- post_market: Post-market.
- closed: Market closed.
- gt_lp: GT LP session.
»»» trade_mode integer Current session trading mode.
- 0: Trading disabled.
- 1: Buy only.
- 2: Sell only.
- 4: Buy and sell supported.
»»» price_type string Price type (market = market order, limit = limit order)
»»» side integer Side (1=sell, 2=buy)
»»» status integer Order status
»»» volume string Order quantity
»»» fill_volume string Trading size
»»» price string Order price
»»» time_setup integer(int64) Order creation time (Unix timestamp, seconds)
»»» time_update integer(int64) Order update time (Unix timestamp, seconds)
»»» max_order_volume string Maximum order quantity
»»» step_order_volume string Order step size
»»» min_order_volume string Minimum order quantity
»»» price_precision integer Price precision
»»» price_protection string Price protection range
»»» sell_price_protection string Sell price protection rate
»»» buy_price_protection string Buy price protection rate
»»» commission_rate string Fee Rate
»»» slippage_rate string Slippage
»» timestamp integer(int64) none

# Enumerated Values

Property Value
exchange us
exchange hk
exchange kr
exchange jp
trade_status pre_market
trade_status open
trade_status post_market
trade_status closed
trade_status gt_lp
trade_mode 0
trade_mode 1
trade_mode 2
trade_mode 4
price_type market
price_type limit
side 1
side 2

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

WARNING

To perform this operation, you must be authenticated by API key and secret

# Create order

Code samples

# coding: utf-8
import requests
import time
import hashlib
import hmac

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/orders'
query_param = ''
body='{"volume":"10","symbol":"AAPL","side":2,"price_type":"limit","trading_session":"all","time_in_force":"day","price":"200.12","client_order_id":"client-202607070001"}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('POST', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('POST', host + prefix + url, headers=headers, data=body)
print(r.json())

key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="POST"
url="/stock/orders"
query_param=""
body_param='{"volume":"10","symbol":"AAPL","side":2,"price_type":"limit","trading_session":"all","time_in_force":"day","price":"200.12","client_order_id":"client-202607070001"}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')

full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
    -H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"

POST /stock/orders

Create order

Rate limit: 5 qps.

Body parameter

{
  "volume": "10",
  "symbol": "AAPL",
  "side": 2,
  "price_type": "limit",
  "trading_session": "all",
  "time_in_force": "day",
  "price": "200.12",
  "client_order_id": "client-202607070001"
}

Parameters

Name In Type Required Description
body body TradFiSpotOrderRequest true none
» volume body string true Order quantity
» symbol body string true Symbol
» side body integer true Side (1=sell, 2=buy)
» price_type body string true Price type (market = market order, limit = limit order)
» trading_session body string true Trading session.
Limit orders support only all, while market orders support only regular.
» time_in_force body string true Time in force.
- day: Day order.
» price body string false Order price, used for limit orders
» client_order_id body string false Client-defined order ID

# Detailed descriptions

» trading_session: Trading session.
Limit orders support only all, while market orders support only regular.

» time_in_force: Time in force.
- day: Day order.

# Enumerated Values

Parameter Value
» side 1
» side 2
» price_type market
» price_type limit
» trading_session regular
» trading_session all
» time_in_force day

Example responses

200 Response

{
  "data": {
    "id": "123456"
  },
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Order placed successfully TradfiSpotCreateOrder
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object none
»» id string Order ID
» timestamp integer(int64) none

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

WARNING

To perform this operation, you must be authenticated by API key and secret

# Cancel all open orders

Code samples

# coding: utf-8
import requests
import time
import hashlib
import hmac

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/orders'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('DELETE', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('DELETE', host + prefix + url, headers=headers)
print(r.json())

key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="DELETE"
url="/stock/orders"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')

full_url="$host$prefix$url"
curl -X $method $full_url \
    -H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"

DELETE /stock/orders

Cancel all open orders

Rate limit: 5 qps.

Example responses

200 Response

{
  "data": {},
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success DeleteOrder
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object Returns empty object on success
» timestamp integer(int64) none

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

WARNING

To perform this operation, you must be authenticated by API key and secret

# Query historical order list

Code samples

# coding: utf-8
import requests
import time
import hashlib
import hmac

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/orders/history'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())

key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/stock/orders/history"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')

full_url="$host$prefix$url"
curl -X $method $full_url \
    -H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"

GET /stock/orders/history

Query historical order list

Rate limit: 5 qps.

Parameters

Name In Type Required Description
symbol query string false Symbol
order_ids query string false Order ID list, multiple separated by commas; max 20, each must be a positive integer
begin_time query integer(int32) false 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.
end_time query integer(int32) false 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.
side query integer false Side (1=sell, 2=buy)
page query integer false Page number, defaults to 1
page_size query integer false Page size, defaults to 10, max 500; server caps at 500

# Enumerated Values

Parameter Value
side 1
side 2

Example responses

200 Response

{
  "data": {
    "total": 1,
    "total_page": 1,
    "list": [
      {
        "order_id": "123456",
        "symbol": "AAPL",
        "exchange": "us",
        "quote_currency": "USD",
        "fx_rate": "1",
        "symbol_desc": "Apple Inc.",
        "price_type": "limit",
        "status": 3,
        "status_desc": "filled",
        "status_detail": {
          "title": "Filled",
          "message": "Order filled"
        },
        "finish_as": 0,
        "side": 2,
        "time_in_force": "day",
        "volume": "10",
        "fill_volume": "10",
        "price": "200.12",
        "avg_fill_price": "200.10",
        "commission": "2.001",
        "time_setup": 1769378400,
        "time_done": 1769378500
      }
    ]
  },
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success TradfiSpotOrderHistoryList
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object none
»» total integer(int64) Total quantity
»» total_page integer Total pages
»» list array Query historical order list
»»» order_id string Order ID
»»» symbol string Symbol
»»» exchange string Exchange, supports us, hk, kr, and jp
»»» quote_currency string Quote currency
»»» fx_rate string Quote currency to USD exchange rate
»»» symbol_desc string Symbol description
»»» price_type string Price type (market = market order, limit = limit order)
»»» status integer Order status
»»» status_desc string Order status description
»»» status_detail object|null Order status details
»»»» title string Status title
»»»» message string Status message
»»» finish_as integer Order completion reason
»»» side integer Side (1=sell, 2=buy)
»»» time_in_force string Time in force.
- day: Day order.
»»» volume string Order quantity
»»» fill_volume string Trading size
»»» price string Order price
»»» avg_fill_price string|null Average fill price
»»» commission string fee
»»» time_setup integer(int64) Order creation time (Unix timestamp, seconds)
»»» time_done integer(int64) Order completion time (Unix timestamp in seconds)
»» timestamp integer(int64) none

# Enumerated Values

Property Value
exchange us
exchange hk
exchange kr
exchange jp
price_type market
price_type limit
side 1
side 2
time_in_force day

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

WARNING

To perform this operation, you must be authenticated by API key and secret

# Modify order

Code samples

# coding: utf-8
import requests
import time
import hashlib
import hmac

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/orders/123456'
query_param = ''
body='{"volume":"8","price":"201.23"}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('PUT', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('PUT', host + prefix + url, headers=headers, data=body)
print(r.json())

key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="PUT"
url="/stock/orders/123456"
query_param=""
body_param='{"volume":"8","price":"201.23"}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')

full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
    -H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"

PUT /stock/orders/{order_id}

Modify order

Rate limit: 5 qps.

Body parameter

{
  "volume": "8",
  "price": "201.23"
}

Parameters

Name In Type Required Description
body body TradFiSpotOrderUpdateRequest true none
» volume body string true Modified order quantity
» price body string true Modified order price
order_id path integer(int64) true Order ID

Example responses

200 Response

{
  "data": {
    "order_id": 123456
  },
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success TradfiSpotUpdateOrder
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object none
»» order_id integer(int64) Order ID
» timestamp integer(int64) none

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

WARNING

To perform this operation, you must be authenticated by API key and secret

# Cancel order

Code samples

# coding: utf-8
import requests
import time
import hashlib
import hmac

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/orders/123456'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('DELETE', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('DELETE', host + prefix + url, headers=headers)
print(r.json())

key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="DELETE"
url="/stock/orders/123456"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')

full_url="$host$prefix$url"
curl -X $method $full_url \
    -H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"

DELETE /stock/orders/{order_id}

Cancel order

Rate limit: 5 qps.

Parameters

Name In Type Required Description
order_id path integer(int64) true Order ID

Example responses

200 Response

{
  "data": {},
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success DeleteOrder
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object Returns empty object on success
» timestamp integer(int64) none

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

WARNING

To perform this operation, you must be authenticated by API key and secret

# Query current position list

Code samples

# coding: utf-8
import requests
import time
import hashlib
import hmac

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/positions'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())

key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/stock/positions"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')

full_url="$host$prefix$url"
curl -X $method $full_url \
    -H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"

GET /stock/positions

Query current position list

Rate limit: 5 qps.

Parameters

Name In Type Required Description
pnl_calc_type query integer false PnL calculation cost type. Defaults to average cost price when omitted (1 = average cost price, 2 = diluted cost price)
pnl_calc_price query integer false PnL calculation price type. Defaults to intraday price when omitted (1 = intraday price, 2 = latest extended-hours price)
symbol query string false Symbol
exchange query string false Exchange, supports us, hk, kr, and jp

# Enumerated Values

Parameter Value
pnl_calc_type 1
pnl_calc_type 2
pnl_calc_price 1
pnl_calc_price 2
exchange us
exchange hk
exchange kr
exchange jp

Example responses

200 Response

{
  "data": {
    "list": [
      {
        "symbol": "AAPL",
        "exchange": "us",
        "quote_currency": "USD",
        "quote_currency_precision": 2,
        "fx_rate": "1",
        "trade_status": "open",
        "symbol_desc": "Apple Inc.",
        "position_pnl": "12.5",
        "today_pnl": "3.2",
        "pnl_rate": "0.012",
        "today_sell_amount": "0",
        "today_buy_amount": "2001.2",
        "today_sell_volume": "0",
        "today_buy_volume": "10",
        "yesterday_volume": "8",
        "volume": "10",
        "available": "8",
        "transfer_out_pending_qty": "0",
        "avg_cost_price": "198.11",
        "diluted_cost_price": "198.11",
        "last_price": "200.12",
        "extended_last_price": "200.2",
        "max_order_volume": "10000",
        "step_order_volume": "1",
        "min_order_volume": "1",
        "price_precision": 2,
        "price_protection": "0.1",
        "sell_price_protection": "0.1",
        "buy_price_protection": "0.1",
        "commission_rate": "0.001",
        "slippage_rate": "0.001"
      }
    ]
  },
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success TradfiSpotPositionList
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object none
»» list array Query active position list
»»» symbol string Symbol
»»» exchange string Exchange, supports us, hk, kr, and jp
»»» quote_currency string Quote currency
»»» quote_currency_precision integer Quote currency precision
»»» fx_rate string Quote currency to USD exchange rate
»»» trade_status string Trading status.
- pre_market: Pre-market.
- open: Regular trading session.
- post_market: Post-market.
- closed: Market closed.
- gt_lp: GT LP session.
»»» symbol_desc string Symbol description
»»» position_pnl string Position P&L
»»» today_pnl string Today's P&L
»»» pnl_rate string Yield
»»» today_sell_amount string Today's sales amount
»»» today_buy_amount string Today's purchase amount
»»» today_sell_volume string Today's sell volume
»»» today_buy_volume string Today's buy volume
»»» yesterday_volume string Previous close position quantity
»»» volume string Position quantity
»»» available string Available position quantity
»»» transfer_out_pending_qty string Stock transfer in progress quantity
»»» avg_cost_price string Cost price
»»» diluted_cost_price string Diluted cost price
»»» last_price string Latest price
»»» extended_last_price string|null Extended hours latest price
»»» max_order_volume string Maximum order quantity
»»» step_order_volume string Order step size
»»» min_order_volume string Minimum order quantity
»»» price_precision integer Price precision
»»» price_protection string Price protection range
»»» sell_price_protection string Sell price protection rate
»»» buy_price_protection string Buy price protection rate
»»» commission_rate string Fee Rate
»»» slippage_rate string Slippage
»» timestamp integer(int64) none

# Enumerated Values

Property Value
exchange us
exchange hk
exchange kr
exchange jp
trade_status pre_market
trade_status open
trade_status post_market
trade_status closed
trade_status gt_lp

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

WARNING

To perform this operation, you must be authenticated by API key and secret

# Close position

Code samples

# coding: utf-8
import requests
import time
import hashlib
import hmac

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/positions/close'
query_param = ''
body='{"symbol":"AAPL","close_volume":"2","close_type":1}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('POST', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('POST', host + prefix + url, headers=headers, data=body)
print(r.json())

key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="POST"
url="/stock/positions/close"
query_param=""
body_param='{"symbol":"AAPL","close_volume":"2","close_type":1}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')

full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
    -H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"

POST /stock/positions/close

Close position

Rate limit: 5 qps.

Body parameter

{
  "symbol": "AAPL",
  "close_volume": "2",
  "close_type": 1
}

Parameters

Name In Type Required Description
body body TradFiSpotClosePositionRequest true none
» symbol body string true Symbol
» close_volume body string false Close quantity; required for partial close
» close_type body integer true Close type (1=partial close, 2=close all)

# Enumerated Values

Parameter Value
» close_type 1
» close_type 2

Example responses

200 Response

{
  "data": {
    "order_id": 123456
  },
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success ClosePosition
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object none
»» order_id integer(int64) Close order ID
» timestamp integer(int64) none

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

WARNING

To perform this operation, you must be authenticated by API key and secret

# Query transaction records

Code samples

# coding: utf-8
import requests
import time
import hashlib
import hmac

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/transactions'
query_param = ''
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('GET', prefix + url, query_param)
headers.update(sign_headers)
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())

key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="GET"
url="/stock/transactions"
query_param=""
body_param=''
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')

full_url="$host$prefix$url"
curl -X $method $full_url \
    -H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"

GET /stock/transactions

Query transaction records

Rate limit: 5 qps.

Parameters

Name In Type Required Description
begin_time query integer(int64) false 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.
end_time query integer(int64) false 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.
ref_id query string false 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
type query string false Transaction type
page query integer false Page number, defaults to 1
page_size query integer false Page size, defaults to 10, max 500; server caps at 500

# Enumerated Values

Parameter Value
type deposit
type withdraw
type fee
type dividend
type sell
type buy
type award
type stock_transfer_in
type stock_transfer_out

Example responses

200 Response

{
  "data": {
    "total": 1,
    "total_page": 1,
    "list": [
      {
        "asset": "USDT",
        "symbol": "AAPL",
        "symbol_display": "Apple Inc.",
        "type": "deposit",
        "type_desc": "Deposit",
        "change": "100",
        "balance": "1000",
        "ref_id": "transfer-202607070001",
        "time": 1769378400,
        "unit_text": "USDT",
        "detail": {
          "source": "api"
        }
      }
    ]
  },
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success TradfiSpotTransactionList
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object none
»» total integer(int64) none
»» total_page integer(int64) none
»» list array Transaction record list
»»» asset string Asset
»»» symbol string Symbol
»»» symbol_display string Symbol display name
»»» type string Transaction type.
- deposit: Funds transfer in.
- withdraw: Funds transfer out.
- fee: Trading fee.
- dividend: Dividend payout.
- sell: Stock sale credit.
- buy: Stock purchase debit.
- award: Airdrop reward.
- stock_transfer_in: Stock transfer in.
- stock_transfer_out: Stock transfer out.
»»» type_desc string Transaction type description
»»» change string Change amount
»»» balance string Balance after change
»»» ref_id string Business idempotent ID
»»» time integer(int64) Unix timestamp (seconds)
»»» unit_text string Unit display text
»»» detail object Business details
»» timestamp integer(int64) none

# Enumerated Values

Property Value
type deposit
type withdraw
type fee
type dividend
type sell
type buy
type award
type stock_transfer_in
type stock_transfer_out

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

WARNING

To perform this operation, you must be authenticated by API key and secret

# Fund transfer

Code samples

# coding: utf-8
import requests
import time
import hashlib
import hmac

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/transactions'
query_param = ''
body='{"asset":"USDT","change":"100","type":"deposit","ref_id":"transfer-202607070001"}'
# for `gen_sign` implementation, refer to section `Authentication` above
sign_headers = gen_sign('POST', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('POST', host + prefix + url, headers=headers, data=body)
print(r.json())

key="YOUR_API_KEY"
secret="YOUR_API_SECRET"
host="https://api.gateio.ws"
prefix="/api/v4"
method="POST"
url="/stock/transactions"
query_param=""
body_param='{"asset":"USDT","change":"100","type":"deposit","ref_id":"transfer-202607070001"}'
timestamp=$(date +%s)
body_hash=$(printf "$body_param" | openssl sha512 | awk '{print $NF}')
sign_string="$method\n$prefix$url\n$query_param\n$body_hash\n$timestamp"
sign=$(printf "$sign_string" | openssl sha512 -hmac "$secret" | awk '{print $NF}')

full_url="$host$prefix$url"
curl -X $method $full_url -d "$body_param" -H "Content-Type: application/json" \
    -H "Timestamp: $timestamp" -H "KEY: $key" -H "SIGN: $sign"

POST /stock/transactions

Fund transfer

Rate limit: 5 qps.

Body parameter

{
  "asset": "USDT",
  "change": "100",
  "type": "deposit",
  "ref_id": "transfer-202607070001"
}

Parameters

Name In Type Required Description
body body TradFiSpotTransactionRequest true none
» asset body string true Asset, USDT only
» change body string true Change amount
» type body string true Transaction type (deposit=deposit, withdraw=withdrawal)
» ref_id body string true Business idempotent ID

# Enumerated Values

Parameter Value
» asset USDT
» type deposit
» type withdraw

Example responses

200 Response

{
  "data": {},
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success TradfiSpotCreateTransaction
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object Returns empty object on success
» timestamp integer(int64) none

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

WARNING

To perform this operation, you must be authenticated by API key and secret

# Query supported exchanges

Code samples

# coding: utf-8
import requests

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/exchanges'
query_param = ''
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())


curl -X GET https://api.gateio.ws/api/v4/stock/exchanges \
  -H 'Accept: application/json'

GET /stock/exchanges

Query supported exchanges

Example responses

200 Response

{
  "data": {
    "list": [
      {
        "exchange": "us",
        "exchange_desc": "United States",
        "icon_link": "https://static.gate.com/us.png",
        "support_transfer": true
      }
    ]
  },
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success Exchanges
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object none
»» list array none
»»» exchange string Trading market, supports us, hk, kr, and jp
»»» exchange_desc string Market display name
»»» icon_link string Market icon
»»» support_transfer boolean Whether stock transfer is supported
»» timestamp integer(int64) none

# Enumerated Values

Property Value
exchange us
exchange hk
exchange kr
exchange jp

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

# Query fee rates for Japanese and Korean stocks

Code samples

# coding: utf-8
import requests

host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

url = '/stock/fee-rate'
query_param = ''
r = requests.request('GET', host + prefix + url, headers=headers)
print(r.json())


curl -X GET https://api.gateio.ws/api/v4/stock/fee-rate \
  -H 'Accept: application/json'

GET /stock/fee-rate

Query fee rates for Japanese and Korean stocks

Query fee rates for Japanese and Korean stocks. Rate limit: 5 qps.

Example responses

200 Response

{
  "data": {
    "list": [
      {
        "vip_level": 0,
        "maker_fee": "0.001",
        "taker_fee": "0.001"
      }
    ]
  },
  "timestamp": 1783411200000
}

400 Response

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": null,
  "timestamp": 1783411200000
}

Responses

Status Meaning Description Schema
200 OK (opens new window) Request success FeeRate
400 Bad Request (opens new window) Request failed TradFiSpotError

Response Schema

Status Code 200

Name Type Description
» data object none
»» list array none
»»» vip_level integer VIP level
»»» maker_fee string Maker fee rate for Japanese and Korean stocks
»»» taker_fee string Taker fee rate for Japanese and Korean stocks
»» timestamp integer(int64) none

Status Code 400

TradFiSpotError

Name Type Description
» label string Business error label
» message string Error message
» data object|null Error additional data
» timestamp integer(int64) Server timestamp (milliseconds)

# Schemas

# TradFiSpotClosePositionRequest

{
  "symbol": "AAPL",
  "close_volume": "2",
  "close_type": 1
}

Close position request parameters

# Properties

Name Type Required Restrictions Description
symbol string true none Symbol
close_volume string false none Close quantity; required for partial close
close_type integer true none Close type (1=partial close, 2=close all)

# Enumerated Values

Property Value
close_type 1
close_type 2

# TradfiSpotOrderHistoryList

{
  "data": {
    "total": 0,
    "total_page": 0,
    "list": [
      {}
    ]
  },
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none none
» total integer(int64) false none Total quantity
» total_page integer false none Total pages
» list array false none Query historical order list
»» order_id string false none Order ID
»» symbol string false none Symbol
»» exchange string false none Exchange, supports us, hk, kr, and jp
»» quote_currency string false none Quote currency
»» fx_rate string false none Quote currency to USD exchange rate
»» symbol_desc string false none Symbol description
»» price_type string false none Price type (market = market order, limit = limit order)
»» status integer false none Order status
»» status_desc string false none Order status description
»» status_detail object|null false none Order status details
»»» title string false none Status title
»»» message string false none Status message
»» finish_as integer false none Order completion reason
»» side integer false none Side (1=sell, 2=buy)
»» time_in_force string false none Time in force.
- day: Day order.
»» volume string false none Order quantity
»» fill_volume string false none Trading size
»» price string false none Order price
»» avg_fill_price string|null false none Average fill price
»» commission string false none fee
»» time_setup integer(int64) false none Order creation time (Unix timestamp, seconds)
»» time_done integer(int64) false none Order completion time (Unix timestamp in seconds)
» timestamp integer(int64) false none none

# Enumerated Values

Property Value
exchange us
exchange hk
exchange kr
exchange jp
price_type market
price_type limit
side 1
side 2
time_in_force day

# TradfiSpotPositionList

{
  "data": {
    "list": [
      {}
    ]
  },
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none none
» list array false none Query active position list
»» symbol string false none Symbol
»» exchange string false none Exchange, supports us, hk, kr, and jp
»» quote_currency string false none Quote currency
»» quote_currency_precision integer false none Quote currency precision
»» fx_rate string false none Quote currency to USD exchange rate
»» trade_status string false none Trading status.
- pre_market: Pre-market.
- open: Regular trading session.
- post_market: Post-market.
- closed: Market closed.
- gt_lp: GT LP session.
»» symbol_desc string false none Symbol description
»» position_pnl string false none Position P&L
»» today_pnl string false none Today's P&L
»» pnl_rate string false none Yield
»» today_sell_amount string false none Today's sales amount
»» today_buy_amount string false none Today's purchase amount
»» today_sell_volume string false none Today's sell volume
»» today_buy_volume string false none Today's buy volume
»» yesterday_volume string false none Previous close position quantity
»» volume string false none Position quantity
»» available string false none Available position quantity
»» transfer_out_pending_qty string false none Stock transfer in progress quantity
»» avg_cost_price string false none Cost price
»» diluted_cost_price string false none Diluted cost price
»» last_price string false none Latest price
»» extended_last_price string|null false none Extended hours latest price
»» max_order_volume string false none Maximum order quantity
»» step_order_volume string false none Order step size
»» min_order_volume string false none Minimum order quantity
»» price_precision integer false none Price precision
»» price_protection string false none Price protection range
»» sell_price_protection string false none Sell price protection rate
»» buy_price_protection string false none Buy price protection rate
»» commission_rate string false none Fee Rate
»» slippage_rate string false none Slippage
» timestamp integer(int64) false none none

# Enumerated Values

Property Value
exchange us
exchange hk
exchange kr
exchange jp
trade_status pre_market
trade_status open
trade_status post_market
trade_status closed
trade_status gt_lp

# TradFiSpotError

{
  "label": "INVALID_ARGUMENT",
  "message": "invalid argument",
  "data": {},
  "timestamp": 1783411200000
}

TradFiSpotError

# Properties

Name Type Required Restrictions Description
label string false none Business error label
message string false none Error message
data object|null false none Error additional data
timestamp integer(int64) false none Server timestamp (milliseconds)

# TradFiSpotOrderRequest

{
  "volume": "10",
  "symbol": "AAPL",
  "side": 2,
  "price_type": "limit",
  "trading_session": "all",
  "time_in_force": "day",
  "price": "200.12",
  "client_order_id": "client-202607070001"
}

Place order request parameters

# Properties

Name Type Required Restrictions Description
volume string true none Order quantity
symbol string true none Symbol
side integer true none Side (1=sell, 2=buy)
price_type string true none Price type (market = market order, limit = limit order)
trading_session string true none Trading session.
Limit orders support only all, while market orders support only regular.
time_in_force string true none Time in force.
- day: Day order.
price string false none Order price, used for limit orders
client_order_id string false none Client-defined order ID

# Enumerated Values

Property Value
side 1
side 2
price_type market
price_type limit
trading_session regular
trading_session all
time_in_force day

# TradfiSpotTransactionList

{
  "data": {
    "total": 0,
    "total_page": 0,
    "list": [
      {}
    ]
  },
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none none
» total integer(int64) false none none
» total_page integer(int64) false none none
» list array false none Transaction record list
»» asset string false none Asset
»» symbol string false none Symbol
»» symbol_display string false none Symbol display name
»» type string false none Transaction type.
- deposit: Funds transfer in.
- withdraw: Funds transfer out.
- fee: Trading fee.
- dividend: Dividend payout.
- sell: Stock sale credit.
- buy: Stock purchase debit.
- award: Airdrop reward.
- stock_transfer_in: Stock transfer in.
- stock_transfer_out: Stock transfer out.
»» type_desc string false none Transaction type description
»» change string false none Change amount
»» balance string false none Balance after change
»» ref_id string false none Business idempotent ID
»» time integer(int64) false none Unix timestamp (seconds)
»» unit_text string false none Unit display text
»» detail object false none Business details
» timestamp integer(int64) false none none

# Enumerated Values

Property Value
type deposit
type withdraw
type fee
type dividend
type sell
type buy
type award
type stock_transfer_in
type stock_transfer_out

# TradfiSpotCreateTransaction

{
  "data": {},
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none Returns empty object on success
timestamp integer(int64) false none none

# TradfiSpotUserAssetResp

{
  "data": {
    "equity": "10000.12",
    "balance": "8000",
    "available": "6500.5",
    "position_market_value": "1500.25",
    "position_pnl": "12.5",
    "today_pnl": "3.2",
    "option_position_market_value": "0",
    "option_position_pnl": "0",
    "option_today_pnl": "0",
    "user_exists": true
  },
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none none
» equity string false none Account equity
» balance string false none Account Balance
» available string false none Available Balance
» position_market_value string false none Position market value
» position_pnl string false none Position P&L
» today_pnl string false none Today's P&L
» option_position_market_value string false none Option position market value
» option_position_pnl string false none Option position PnL
» option_today_pnl string false none Option today's PnL
» user_exists boolean false none Whether the user has activated the service
timestamp integer(int64) false none Server timestamp (milliseconds)

# SymbolDetail

{
  "data": {
    "total": 0,
    "total_page": 0,
    "list": [
      {}
    ]
  },
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none none
» total integer(int64) false none Total quantity
» total_page integer false none Total pages
» list array false none none
»» symbol string false none Symbol
»» exchange string false none Exchange, supports us, hk, kr, and jp
»» exchange_desc string false none Exchange description
»» quote_currency string false none Quote currency
»» quote_currency_precision integer false none Quote currency precision
»» fx_rate string false none Quote currency to USD exchange rate
»» symbol_desc string false none Symbol description
»» category string false none Symbol category.
- CS: Common stock.
- ETF: Exchange-traded funds.
- ADRC, ADR: Depositary receipts for foreign companies listed in the U.S.
- ETV: Exchange-traded products.
- PFD: Preferred stock.
- ETS: Exchange-traded securities.
- ETN: Exchange-traded notes.
- FUND: Funds.
»» asset_type string false none Asset type.
- STOCK: Stock.
- ETF: Exchange-traded fund.
»» settlement_currency string false none Settlement currency
»» max_order_volume string false none Maximum order quantity
»» step_order_volume string false none Order step size
»» min_order_volume string false none Minimum order quantity
»» price_precision integer false none Price precision
»» volume_precision integer false none Quantity precision
»» is_ipo boolean false none Whether it is an IPO symbol
»» ipo_price string false none IPO price
»» price_protection string false none Price protection range
»» sell_price_protection string false none Sell price protection rate
»» buy_price_protection string false none Buy price protection rate
»» slippage_rate string false none Slippage
»» commission_rate string false none Fee Rate
»» trade_status string false none Trading status.
- pre_market: Pre-market.
- open: Regular trading session.
- post_market: Post-market.
- closed: Market closed.
- gt_lp: GT LP session.
»» trade_mode integer false none Current session trading mode.
- 0: Trading disabled.
- 1: Buy only.
- 2: Sell only.
- 4: Buy and sell supported.
»» order_fill_timing integer false none Order fill timing (1=immediate, 2=after pre-market opens, 3=after regular session opens)
»» symbol_descs array false none Multilingual symbol description
»»» lang string false none Language
»»» value string false none Localized description
»» icon_link string false none Icon URL
» timestamp integer(int64) false none none

# Enumerated Values

Property Value
exchange us
exchange hk
exchange kr
exchange jp
category CS
category ETF
category ADRC
category ADR
category ETV
category PFD
category ETS
category ETN
category FUND
asset_type STOCK
asset_type ETF
trade_status pre_market
trade_status open
trade_status post_market
trade_status closed
trade_status gt_lp
trade_mode 0
trade_mode 1
trade_mode 2
trade_mode 4
order_fill_timing 1
order_fill_timing 2
order_fill_timing 3

# DeleteOrder

{
  "data": {},
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none Returns empty object on success
timestamp integer(int64) false none none

# ClosePosition

{
  "data": {
    "order_id": 123456
  },
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none none
» order_id integer(int64) false none Close order ID
timestamp integer(int64) false none none

# TradFiSpotTransactionRequest

{
  "asset": "USDT",
  "change": "100",
  "type": "deposit",
  "ref_id": "transfer-202607070001"
}

Transfer request parameters

# Properties

Name Type Required Restrictions Description
asset string true none Asset, USDT only
change string true none Change amount
type string true none Transaction type (deposit=deposit, withdraw=withdrawal)
ref_id string true none Business idempotent ID

# Enumerated Values

Property Value
asset USDT
type deposit
type withdraw

# TradfiSpotOrderBook

{
  "data": {
    "symbol": "AAPL",
    "bids": [
      {}
    ],
    "asks": [
      {}
    ]
  },
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none none
» symbol string false none Symbol
» bids array false none Bid orders
»» p string false none Price
»» user_order boolean false none Whether it is the user's own order
» asks [TradfiSpotOrderBook/properties/data/properties/bids/items] false none Ask orders
timestamp integer(int64) false none none

# TradfiSpotCreateOrder

{
  "data": {
    "id": "123456"
  },
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none none
» id string false none Order ID
timestamp integer(int64) false none none

# Exchanges

{
  "data": {
    "list": [
      {}
    ]
  },
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none none
» list array false none none
»» exchange string false none Trading market, supports us, hk, kr, and jp
»» exchange_desc string false none Market display name
»» icon_link string false none Market icon
»» support_transfer boolean false none Whether stock transfer is supported
» timestamp integer(int64) false none none

# Enumerated Values

Property Value
exchange us
exchange hk
exchange kr
exchange jp

# TradFiSpotOrderUpdateRequest

{
  "volume": "8",
  "price": "201.23"
}

Modify order request parameters

# Properties

Name Type Required Restrictions Description
volume string true none Modified order quantity
price string true none Modified order price

# TradfiSpotUpdateOrder

{
  "data": {
    "order_id": 123456
  },
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none none
» order_id integer(int64) false none Order ID
timestamp integer(int64) false none none

# TradfiSpotSymbols

{
  "data": {
    "total": 0,
    "total_page": 0,
    "list": [
      {}
    ]
  },
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none none
» total integer(int64) false none Total quantity
» total_page integer false none Total pages
» list array false none Symbol list
»» symbol string false none Symbol
»» exchange string false none Exchange, supports us, hk, kr, and jp
»» exchange_desc string false none Exchange description
»» quote_currency string false none Quote currency
»» quote_currency_precision integer false none Quote currency precision
»» fx_rate string false none Quote currency to USD exchange rate
»» symbol_desc string false none Symbol description
»» category string false none Symbol category.
- CS: Common stock.
- ETF: Exchange-traded funds.
- ADRC, ADR: Depositary receipts for foreign companies listed in the U.S.
- ETV: Exchange-traded products.
- PFD: Preferred stock.
- ETS: Exchange-traded securities.
- ETN: Exchange-traded notes.
- FUND: Funds.
»» asset_type string false none Asset type.
- STOCK: Stock.
- ETF: Exchange-traded fund.
»» trade_status string false none Trading status.
- pre_market: Pre-market.
- open: Regular trading session.
- post_market: Post-market.
- closed: Market closed.
- gt_lp: GT LP session.
»» trade_mode integer false none Current session trading mode.
- 0: Trading disabled.
- 1: Buy only.
- 2: Sell only.
- 4: Buy and sell supported.
»» order_fill_timing integer false none Order fill timing (1=immediate, 2=after pre-market opens, 3=after regular session opens)
»» icon_link string false none Icon URL
»» quote_currency_symbol string false none Quote currency symbol
»» price_precision integer false none Price precision
»» volume_precision integer false none Quantity precision
»» is_ipo boolean false none Whether it is an IPO symbol
»» ipo_price string false none IPO price
»» sell_price_protection string false none Sell price protection rate
»» buy_price_protection string false none Buy price protection rate
»» symbol_descs [TradfiSpotSymbols/definitions/SymbolListItem/properties/symbol_descs/items] false none Multilingual symbol description
» timestamp integer(int64) false none none

# Enumerated Values

Property Value
exchange us
exchange hk
exchange kr
exchange jp
category CS
category ETF
category ADRC
category ADR
category ETV
category PFD
category ETS
category ETN
category FUND
asset_type STOCK
asset_type ETF
trade_status pre_market
trade_status open
trade_status post_market
trade_status closed
trade_status gt_lp
trade_mode 0
trade_mode 1
trade_mode 2
trade_mode 4
order_fill_timing 1
order_fill_timing 2
order_fill_timing 3

# FeeRate

{
  "data": {
    "list": [
      {}
    ]
  },
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none none
» list array false none none
»» vip_level integer false none VIP level
»» maker_fee string false none Maker fee rate for Japanese and Korean stocks
»» taker_fee string false none Taker fee rate for Japanese and Korean stocks
» timestamp integer(int64) false none none

# TradfiSpotOrderList

{
  "data": {
    "list": [
      {}
    ]
  },
  "timestamp": 0
}

# Properties

Name Type Required Restrictions Description
data object false none none
» list array false none Query active order list
»» order_id string false none Order ID
»» symbol string false none Symbol
»» exchange string false none Exchange, supports us, hk, kr, and jp
»» quote_currency string false none Quote currency
»» fx_rate string false none Quote currency to USD exchange rate
»» symbol_desc string false none Symbol description
»» trade_status string false none Trading status.
- pre_market: Pre-market.
- open: Regular trading session.
- post_market: Post-market.
- closed: Market closed.
- gt_lp: GT LP session.
»» trade_mode integer false none Current session trading mode.
- 0: Trading disabled.
- 1: Buy only.
- 2: Sell only.
- 4: Buy and sell supported.
»» price_type string false none Price type (market = market order, limit = limit order)
»» side integer false none Side (1=sell, 2=buy)
»» status integer false none Order status
»» volume string false none Order quantity
»» fill_volume string false none Trading size
»» price string false none Order price
»» time_setup integer(int64) false none Order creation time (Unix timestamp, seconds)
»» time_update integer(int64) false none Order update time (Unix timestamp, seconds)
»» max_order_volume string false none Maximum order quantity
»» step_order_volume string false none Order step size
»» min_order_volume string false none Minimum order quantity
»» price_precision integer false none Price precision
»» price_protection string false none Price protection range
»» sell_price_protection string false none Sell price protection rate
»» buy_price_protection string false none Buy price protection rate
»» commission_rate string false none Fee Rate
»» slippage_rate string false none Slippage
» timestamp integer(int64) false none none

# Enumerated Values

Property Value
exchange us
exchange hk
exchange kr
exchange jp
trade_status pre_market
trade_status open
trade_status post_market
trade_status closed
trade_status gt_lp
trade_mode 0
trade_mode 1
trade_mode 2
trade_mode 4
price_type market
price_type limit
side 1
side 2