GateTR

GateTR

GateTr API Information

GateTR API Link: https://www.gate.io/docs/developers/apiv4/en/#gate-api-v4-v4-90-1

Basic Endpoints

  • Base Endpoint: https://api.gateio.ws/api/v4
  • Futures TestNet trading: https://fx-api-testnet.gateio.ws/api/v4
  • Futures live trading alternative (futures only): https://fx-api.gateio.ws/api/v4

HTTP convention

GateTR API Link: https://www.gate.io/docs/developers/apiv4/en/#http-convention

  • All read endpoints use the GET method and only accept request parameters. The request body is ignored.
  • DELETE methods remove resources (e.g., orders), but not all deletions use DELETE, since DELETE methods also ignore the request body. For complex deletions, POST is used with parameters in the request body.
  • Update operations are performed using POST, PUT, or PATCH methods. Parameters may be in the request body or request parameters depending on the endpoint. Check endpoint details for how to send the request.
  • All endpoints return an HTTP status code 2xx on success. 401 is returned for authentication errors. Other 4xx codes indicate a malformed request. 5xx codes indicate a critical server error while processing the request. Report issues if a 5xx error occurs.

Times

All time-related fields are expressed in unix timestamp in seconds unless otherwise noted. Formats may vary (int64, number, or string). Possible returned values include:

  • 1596531048
  • “1596531048”
  • 1596531048.285
  • “1596531048.285”

Pagination

GateTR API Link: https://www.gate.io/docs/developers/apiv4/en/#pagination

Pagination can be implemented using one of the following methods:

  • page-limit
  • limit-offset

In both methods, limit restricts the maximum number of records returned per request. If not specified, the default is 100, with a maximum of 1000.

page starts at 1, mimicking the common web page pagination method. To retrieve the entire list, keep the same limit and increment page by 1 until fewer records than limit are returned.

offset starts at 0, similar to common DB search logic. To retrieve the entire list, increase offset by limit until fewer records than limit are returned.

For example, if the total number of orders is 201, the page-limit request parameters would be:

  • page=1&limit=100
  • page=2&limit=100
  • page=3&limit=100

Using limit-offset, the request parameters would be:

  • limit=100&offset=0
  • limit=100&offset=100
  • limit=100&offset=200

Some endpoints may return additional pagination metadata. If available, it will be returned in the response headers. For example, for GET /futures/{settle}/orders:

  • X-Pagination-Limit: request limit
  • X-Pagination-Offset: request offset
  • X-Pagination-Total: total record number satisfying the request

Frequency limit rule

GateTR API Link: https://www.gate.io/docs/developers/apiv4/en/#frequency-limit-rule

Markets Endpoints Limits Based On Content
All public endpoints Public endpoints 200r/10s per endpoint IP Orderbook, Candlestick, Ticker, etc.
Wallet Private endpoints Withdraw (POST /withdrawals): 1r/3s Transfers between trading accounts (POST /wallet/transfers): 80r/10s Transfers between main and subaccounts (POST /wallet/sub_account_transfers): 80r/10s Transfer from one subaccount to another (POST /wallet/sub_account_to_sub_account): 80r/10s Retrieve total user balance (GET /wallet/total_balance): 80r/10s Retrieve subaccount balances (GET /wallet/sub_account_balances): 80r/10s Query subaccount margin balances (GET /wallet/sub_account_margin_balances): 80r/10s Query subaccount futures balances (GET /wallet/sub_account_futures_balances): 80r/10s Query subaccount cross_margin account info (GET /wallet/sub_account_cross_margin_balances): 80r/10s Others: 200r/10s per endpoint UID Withdrawal. Query personal account balance. Query subaccount balance.
Spot Private endpoints Rate limit for placing bulk/single orders and modifying an order: 10r/s total (UID+Market). Rate limit for bulk/single order cancellations: 200r/s total. Others: 200r/10s per endpoint. UID Spot order placement and cancellation. Trade history and fee rates.
Perpetual Futures Private endpoints After 2024-11-07 (UTC+8) please refer to Trade Ratio Rate Limiting. Rate limit for placing bulk/single orders and modifying an order: 100r/s total. Maximum rate limit for order cancellations (bulk/single): 200r/s. Others: 200r/10s per endpoint. UID Futures order placement and cancellation. Trade history and fee rates.
Delivery Private endpoints Maximum order placement limit (bulk/single): 500r/10s. Maximum order cancellation limit (bulk/single): 500r/10s. Others: 200r/10s per endpoint. UID Order placement and cancellation.
Options Private endpoints Maximum order placement limit (bulk/single): 200r/s. Maximum order cancellation limit (bulk/single): 200r/s. Others: 200r/10s per endpoint. UID Order placement and cancellation.
Subaccount Private endpoints 80r/10s per endpoint UID Create a sub-account. Retrieve the list of sub-accounts. Disable or enable API key for a sub-account.
Unified Private endpoints Borrow or repay: 15r/10s UID Borrow or repay (POST /unified/loans).
Other Private endpoints Private endpoints 150r/10s per endpoint UID Earning, collateral, etc.

This table contains rate limits based on endpoint types.

Future Rate Limit Rule

Contract Frequency Limitation Rules

Tier Ratio Rate Limit (uid)
Tier 1 [0,1) 100r/s
Tier 2 [1,3) 150r/s
Tier 3 [3,5) 200r/s
Tier 4 [5,10) 250r/s
Tier 5 [10,20) 300r/s
Tier 6 [20,50) 350r/s
Tier 7 >= 50 400r/s

Return Format

GateTR API Link: https://www.gate.io/docs/developers/apiv4/en/#return-format

All API responses are in JSON format, and users are responsible for converting and extracting the data themselves.

HTTP status code 2XX indicates that all operations were successful. 401 indicates an authentication issue. Other 4xx status codes indicate that the request is invalid. A 5xx error indicates that the server encountered an unknown critical error while processing the request. Please provide feedback as soon as possible.

Return Status

Status Code Description
200/201 Request succeeded
202 Request accepted by the server, but processing is not done yet
204 Request succeeded, but the server doesn’t return body
400 Invalid request
401 Authentication failed
404 Not found
429 Too many requests
5xx Server error

RCXT GateTR API Information

There is 1 Base Endpoint for the GateTR exchange:

  • apiUrl: api.gateio.ws

Rate Limits

The rate limit set for each endpoint on the GateIo exchange is as follows:

Limit (10 saniye) Spot Margin Usd Futures Coin Futures Earn
Fetch Balances 200 Request Weight 200 Request Weight 200 Request Weight 200 Request Weight 200 Request Weight
Fetch Trades 200 Request Weight 200 Request Weight 200 Request Weight 200 Request Weight
Fetch Orders 200 Request Weight 200 Request Weight 200 Request Weight 200 Request Weight 200 Request Weight
Limit (10 saniye) TransferIn TransferOut Ticker
Fetch DepositWithdrawals 200 Request Weight 200 Request Weight
Fetch Ticker 200 Request Weight

Fetch Balances

Spot Balance
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.
  • Endpoint: /api/v4/spot/accounts
  • RCXT Endpoint: api/v1/gate-tr/balances

The user sends a GET request to query wallet balances. This request must include the necessary header parameters:

  • apiKey and secretKey values are taken from the header.

  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Spot Balance, the Request Weight is 200.
Margin Balance
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.
  • Endpoint: /api/v4/margin/accounts
  • RCXT Endpoint: api/v1/gate-tr/balances

The user sends a GET request to query wallet balances. This request must include the necessary header parameters:

  • apiKey and secretKey values are taken from the header.

  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Margin Balance, the Request Weight is 200.
Isolated Margin Balance
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.
  • Endpoint: /api/v4/margin/accounts
  • RCXT Endpoint: api/v1/gate-tr/balances

The user sends a GET request to query wallet balances. This request must include the necessary header parameters:

  • apiKey and secretKey values are taken from the header.

  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Isolated Margin Balance, the Request Weight is 200.
USD Futures Balance
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.
  • Endpoint: /api/v4/futures/usdt/accounts
  • RCXT Endpoint: api/v1/gate-tr/balances

The user sends a GET request to query wallet balances. This request must include the necessary header parameters:

  • apiKey and secretKey values are taken from the header.

  • Limiter:

    • Each API endpoint has an assigned Request Weight. For USD Futures Balance, the Request Weight is 200.
Coin Futures Balance
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.
  • Endpoint: /api/v4/futures/btc/accounts
  • RCXT Endpoint: api/v1/gate-tr/balances

The user sends a GET request to query wallet balances. This request must include the necessary header parameters:

  • apiKey and secretKey values are taken from the header.

  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Coin Futures Balance, the Request Weight is 200.
Earn Balance
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.
  • Endpoint: /api/v4/earn/uni/lends
  • RCXT Endpoint: api/v1/gate-tr/balances

The user sends a GET request to query wallet balances. This request must include the necessary header parameters:

  • apiKey and secretKey values are taken from the header.

  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Earn Balance, the Request Weight is 200.

Response Example:

{
  "spot": [
    {
      "coin": "BTTC",
      "total": "208850.4"
    }
  ],
  "margin": [
    {
      "coin": "DOGE",
      "total": "0.00399992"
    }
  ],
  "isolatedMargin": [
    {
      "coin": "DOGE",
      "total": "20.55645083"
    }
  ],
  "futures": [
    {
      "coin": "USDT",
      "total": "0.03733590"
    },
    {
      "coin": "DOGE",
      "total": "2000.00000000"
    }
  ],
  "earnings": [
    {
      "coin": "BNB",
      "total": "0.07886113"
    }
  ]
}

Fetch Trades

Spot Trades
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.

  • Endpoint: /api/v4/spot/my_trades

  • RCXT Endpoint: api/v1/gate-tr/trades

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, type, offset, page, orderId, and symbol.

    • startTime: Specify the starting date for fetching data.
    • type: Options are spot, margin, cFutures, and uFutures. Use spot for Spot Trades.
    • offset: Number of records to skip in the transaction list (used for pagination).
    • page: Page number to fetch (for pagination).
    • orderId: Filter by a specific order ID.
    • symbol: The trading pair to fetch (e.g., BTCUSDT).
  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Spot Trades, the Request Weight is 200.
      • Maximum 1000 records per page.
Margin Trades
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.

  • Endpoint: /api/v4/spot/my_trades

  • RCXT Endpoint: api/v1/gate-tr/trades

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, endTime, symbol, fromId, and type.

    • startTime: Specify the starting date for fetching data.
    • type: Options are spot, margin, cFutures, and uFutures. Use margin for Margin Trades.
    • offset: Number of records to skip (for pagination).
    • page: Page number to fetch.
    • orderId: Filter by a specific order ID.
    • symbol: The trading pair to fetch (e.g., BTCUSDT).
  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Margin Trades, the Request Weight is 200.
      • Maximum 1000 records per page.
USD Futures Trades
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.

  • Endpoint: /api/v4/futures/usdt/my_trades_timerange

  • RCXT Endpoint: api/v1/gate-tr/trades

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, endTime, symbol, fromId, and type.

    • startTime: Specify the starting date for fetching data.
    • type: Options are spot, margin, uFutures, and cFutures. Use uFutures for USD Futures Trades.
    • offset: Number of records to skip (for pagination).
    • page: Page number to fetch.
    • orderId: Filter by a specific order ID.
    • symbol: The trading pair to fetch (e.g., BTCUSDT).
  • Limiter:

    • Each API endpoint has an assigned Request Weight. For USD Futures Trades, the Request Weight is 200.
      • Maximum 100 records per page.
Coin Futures Trades
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.

  • Endpoint: /api/v4/futures/btc/my_trades_timerange

  • RCXT Endpoint: api/v1/gate-tr/trades

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, endTime, symbol, fromId, and type.

    • startTime: Specify the starting date for fetching data.
    • type: Options are spot, margin, uFutures, and cFutures. Use cFutures for Coin Futures Trades.
    • offset: Number of records to skip (for pagination).
    • page: Page number to fetch.
    • orderId: Filter by a specific order ID.
    • symbol: The trading pair to fetch (e.g., BTCUSDT).
  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Coin Futures Trades, the Request Weight is 200.
      • Maximum 100 records per page.

Response Example:

{
  "trades": [
    {
      "orderId": "226664511",
      "tradeId": "27082209",
      "isBuyer": false,
      "isMaker": false,
      "price": "0.07610000",
      "quantity": "199.90000000",
      "symbol": "ACAUSDT",
      "time": 1737552748284,
      "commission": "0.01521239",
      "commissionCurrency": "USDT"
    }
  ],
  "cursor": ""
}

Fetch Orders

Spot Orders
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.

  • Endpoint: /api/v4/spot/orders

  • RCXT Endpoint: api/v1/gate-tr/orders

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, endTime, symbol, orderId, singleOrderId, type, and orderStatus:

    • startTime: Specify the starting date for fetching data.
    • type: Options are spot, cfutures, ufutures. Use spot for Spot Orders.
    • baseAsset:
    • quoteAsset:
    • offset: Number of records to skip (for pagination).
    • orderId: Filter by a specific order ID.
    • singleOrderId: Filter by a single order ID.
    • page: Page number to fetch.
    • orderStatus: “open” for Open Orders, “closed” for Closed Orders.
    • symbol: The trading pair to fetch (e.g., BTCUSDT).
  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Spot Orders, the Request Weight is 200.
    • Maximum 100 records per page.
Spot Open Orders
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.

  • Endpoint: /api/v4/spot/open_orders

  • RCXT Endpoint: api/v1/gate-tr/orders

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, endTime, symbol, orderId, singleOrderId, type, and orderStatus:

    • startTime: Specify the starting date for fetching data.
    • type: Options are spot, cfutures, ufutures. Use spot for Spot Open Orders.
    • baseAsset:
    • quoteAsset:
    • offset: Number of records to skip (for pagination).
    • orderId: Filter by a specific order ID.
    • singleOrderId: Filter by a single order ID.
    • page: Page number to fetch.
    • orderStatus: “open” for Open Orders, “closed” for Closed Orders.
    • symbol: The trading pair to fetch (e.g., BTCUSDT).
  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Spot Open Orders, the Request Weight is 200.
    • Maximum 100 records per page.
USD Futures Orders
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.

  • Endpoint: /api/v4/futures/usdt/orders

  • RCXT Endpoint: api/v1/gate-tr/orders

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, endTime, symbol, orderId, singleOrderId, type, and orderStatus:

    • startTime: Specify the starting date for fetching data.
    • type: Options are spot, cfutures, ufutures. Use ufutures for USD Futures Orders.
    • baseAsset:
    • quoteAsset:
    • offset: Number of records to skip (for pagination).
    • orderId: Filter by a specific order ID.
    • singleOrderId: Filter by a single order ID.
    • page: Page number to fetch.
    • orderStatus: “open” for Open Orders, “closed” for Closed Orders.
    • symbol: The trading pair to fetch (e.g., BTCUSDT).
  • Limiter:

    • Each API endpoint has an assigned Request Weight. For USD Futures Orders, the Request Weight is 200.
    • Maximum 100 records per page.
USD Futures Open Orders
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.

  • Endpoint: /api/v4/futures/usdt/orders

  • RCXT Endpoint: api/v1/gate-tr/orders

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, endTime, symbol, orderId, singleOrderId, type, and orderStatus:

    • startTime: Specify the starting date for fetching data.
    • type: Options are spot, cfutures, ufutures. Use ufutures for USD Futures Open Orders.
    • baseAsset:
    • quoteAsset:
    • offset: Number of records to skip (for pagination).
    • orderId: Filter by a specific order ID.
    • singleOrderId: Filter by a single order ID.
    • page: Page number to fetch.
    • orderStatus: “open” for Open Orders, “closed” for Closed Orders.
    • symbol: The trading pair to fetch (e.g., BTCUSDT).
  • Limiter:

    • Each API endpoint has an assigned Request Weight. For USD Futures Open Orders, the Request Weight is 200.
    • Maximum 100 records per page.
Coin Futures Orders
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.

  • Endpoint: /api/v4/futures/btc/orders

  • RCXT Endpoint: api/v1/gate-tr/orders

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, endTime, symbol, orderId, singleOrderId, type, and orderStatus:

    • startTime: Specify the starting date for fetching data.
    • type: Options are spot, cfutures, ufutures. Use cfutures for Coin Futures Orders.
    • baseAsset:
    • quoteAsset:
    • offset: Number of records to skip (for pagination).
    • orderId: Filter by a specific order ID.
    • singleOrderId: Filter by a single order ID.
    • page: Page number to fetch.
    • orderStatus: “open” for Open Orders, “closed” for Closed Orders.
    • symbol: The trading pair to fetch (e.g., BTCUSDT).
  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Coin Futures Orders, the Request Weight is 200.
    • Maximum 100 records per page.
Coin Open Futures Orders
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.

  • Endpoint: /api/v4/futures/btc/orders

  • RCXT Endpoint: api/v1/gate-tr/orders

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, endTime, symbol, orderId, singleOrderId, type, and orderStatus:

    • startTime: Specify the starting date for fetching data.
    • type: Options are spot, cfutures, ufutures. Use cfutures for Coin Open Futures Orders.
    • baseAsset:
    • quoteAsset:
    • offset: Number of records to skip (for pagination).
    • orderId: Filter by a specific order ID.
    • singleOrderId: Filter by a single order ID.
    • page: Page number to fetch.
    • orderStatus: “open” for Open Orders, “closed” for Closed Orders.
    • symbol: The trading pair to fetch (e.g., BTCUSDT).
  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Coin Open Futures Orders, the Request Weight is 200.
    • Maximum 100 records per page.

Response Example:

{
  "orders": [
    {
      "orderId": "226664511",
      "symbol": "ACAUSDT",
      "type": "MARKET",
      "price": "0",
      "side": "SELL",
      "time": 1737552748284,
      "status": "CLOSED",
      "executedQuantity": "199.90000000",
      "quantity": "199.90000000"
    }
  ],
  "cursor": ""
}

Fetch DepositsWithdrawals

TransferIn
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.

  • Endpoint: /api/v4/wallet/deposits

  • RCXT Endpoint: api/v1/gate-tr/deposit-withdraw-history

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, offset, and type:

    • startTime: Specify the starting date for fetching data.
    • offset: Number of records to skip (for pagination).
    • type: Options are transferIn and transferOut. Use transferIn for Transfer In.
  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Transfer In, the Request Weight is 200.
    • Maximum 500 records per page.
TransferOut
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.

  • Endpoint: /api/v4/wallet/withdrawals

  • RCXT Endpoint: api/v1/gate-tr/deposit-withdraw-history

  • apiKey and secretKey values are taken from the header.

  • Query parameters include startTime, offset, and type:

    • startTime: Specify the starting date for fetching data.
    • offset: Number of records to skip (for pagination).
    • type: Options are transferIn and transferOut. Use transferOut for Transfer Out.
  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Transfer Out, the Request Weight is 200.
    • Maximum 500 records per page.

Response Example:

{
  "depositWithdrawals": [
    {
      "fiatCurrency": "",
      "cryptoCurrency": "ACA",
      "fiatAmount": "",
      "cryptoAmount": "199.9",
      "price": "",
      "address": "21Pau9weZ19NtbojGKnjFUDd2RZ4mpMMFqfYeYHmHLxV9ncr",
      "orderId": "",
      "transactionId": "4355261931473846528",
      "fee": "",
      "network": "ACA",
      "status": "1",
      "time": 1737552240000
    }
  ],
  "cursor": ""
}
Ticker
  • Uses apiUrl (api.gateio.ws) as the Base Endpoint.

  • Endpoint: /api/v4/spot/tickers

  • RCXT Endpoint: api/v1/gate-tr/ticker

  • Only the symbol query parameter is required (e.g., BTCUSDT).

    • symbol: Specifies the symbol of the crypto pair.
  • Limiter:

    • Each API endpoint has an assigned Request Weight. For Ticker, the Request Weight is 200.

Response Example:

{
  "symbol": "BTCUSDT",
  "price": "104562.53000000"
}