All URIs are relative to https://api.gateio.ws/api/v4
| Method | HTTP request | Description |
|---|---|---|
| cancelOrder | DELETE /spot/orders/{order_id} | Cancel a single order |
| cancelOrders | DELETE /spot/orders | Cancel all `open` orders in specified currency pair |
| createOrder | POST /spot/orders | Create an order |
| getCurrencyPair | GET /spot/currency_pairs/{currency_pair} | Get detail of one single order |
| getOrder | GET /spot/orders/{order_id} | Get a single order |
| listCandlesticks | GET /spot/candlesticks | Market candlesticks |
| listCurrencyPairs | GET /spot/currency_pairs | List all currency pairs supported |
| listMyTrades | GET /spot/my_trades | List personal trading history |
| listOrderBook | GET /spot/order_book | Retrieve order book |
| listOrders | GET /spot/orders | List orders |
| listSpotAccounts | GET /spot/accounts | List spot accounts |
| listTickers | GET /spot/tickers | Retrieve ticker information |
| listTrades | GET /spot/trades | Retrieve market trades |
Order cancelOrder(orderId, currencyPair)
Cancel a single order
import io.gate.gateapi.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.SpotApi;
import java.io.File;
import java.util.*;
ApiClient client = new ApiClient("YOUR_API_KEY", "YOUR_API_SECRET");
// uncomment the next line if testing the API with other host
// apiClient.setBasePath("https://some-other-host");
SpotApi apiInstance = new SpotApi(client);
String orderId = "12345"; // String | ID returned on order successfully being created
String currencyPair = "BTC_USDT"; // String | Currency pair
try {
Order result = apiInstance.cancelOrder(orderId, currencyPair);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SpotApi#cancelOrder");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| orderId | String | ID returned on order successfully being created | |
| currencyPair | String | Currency pair |
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
List<Order> cancelOrders(currencyPair, side, account)
Cancel all `open` orders in specified currency pair
import io.gate.gateapi.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.SpotApi;
import java.io.File;
import java.util.*;
ApiClient client = new ApiClient("YOUR_API_KEY", "YOUR_API_SECRET");
// uncomment the next line if testing the API with other host
// apiClient.setBasePath("https://some-other-host");
SpotApi apiInstance = new SpotApi(client);
String currencyPair = "BTC_USDT"; // String | Currency pair
String side = "sell"; // String | All bids or asks. Both included in not specified
String account = "spot"; // String | Specify account type. Default to all account types being included
try {
List<Order> result = apiInstance.cancelOrders(currencyPair, side, account);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SpotApi#cancelOrders");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | String | Currency pair | |
| side | String | All bids or asks. Both included in not specified | [optional] [enum: buy, sell] |
| account | String | Specify account type. Default to all account types being included | [optional] [enum: spot, margin] |
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
Order createOrder(order)
Create an order
import io.gate.gateapi.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.SpotApi;
import java.io.File;
import java.util.*;
ApiClient client = new ApiClient("YOUR_API_KEY", "YOUR_API_SECRET");
// uncomment the next line if testing the API with other host
// apiClient.setBasePath("https://some-other-host");
SpotApi apiInstance = new SpotApi(client);
Order order = new Order(); // Order |
try {
Order result = apiInstance.createOrder(order);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SpotApi#createOrder");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| order | Order |
Authentication with API key and secret is required
- Content-Type: application/json
- Accept: application/json
CurrencyPair getCurrencyPair(currencyPair)
Get detail of one single order
import io.gate.gateapi.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.SpotApi;
import java.io.File;
import java.util.*;
SpotApi apiInstance = new SpotApi();
String currencyPair = "ETH_BTC"; // String | Currency pair
try {
CurrencyPair result = apiInstance.getCurrencyPair(currencyPair);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SpotApi#getCurrencyPair");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | String | Currency pair |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Order getOrder(orderId, currencyPair)
Get a single order
import io.gate.gateapi.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.SpotApi;
import java.io.File;
import java.util.*;
ApiClient client = new ApiClient("YOUR_API_KEY", "YOUR_API_SECRET");
// uncomment the next line if testing the API with other host
// apiClient.setBasePath("https://some-other-host");
SpotApi apiInstance = new SpotApi(client);
String orderId = "12345"; // String | ID returned on order successfully being created
String currencyPair = "BTC_USDT"; // String | Currency pair
try {
Order result = apiInstance.getOrder(orderId, currencyPair);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SpotApi#getOrder");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| orderId | String | ID returned on order successfully being created | |
| currencyPair | String | Currency pair |
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
List<List<String>> listCandlesticks(currencyPair, limit, interval)
Market candlesticks
Candlestick data will start from (current time - limit * interval), end at current time
import io.gate.gateapi.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.SpotApi;
import java.io.File;
import java.util.*;
SpotApi apiInstance = new SpotApi();
String currencyPair = "BTC_USDT"; // String | Currency pair
Integer limit = 100; // Integer | Maximum number of record returned in one list
String interval = "30m"; // String | Interval time between data points
try {
List<List<String>> result = apiInstance.listCandlesticks(currencyPair, limit, interval);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SpotApi#listCandlesticks");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | String | Currency pair | |
| limit | Integer | Maximum number of record returned in one list | [optional] [default to 100] |
| interval | String | Interval time between data points | [optional] [default to 30m] [enum: 10s, 1m, 5m, 15m, 30m, 1h, 4h, 8h, 1d, 7d] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
List<CurrencyPair> listCurrencyPairs()
List all currency pairs supported
import io.gate.gateapi.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.SpotApi;
import java.io.File;
import java.util.*;
SpotApi apiInstance = new SpotApi();
try {
List<CurrencyPair> result = apiInstance.listCurrencyPairs();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SpotApi#listCurrencyPairs");
e.printStackTrace();
}This endpoint does not need any parameter.
No authorization required
- Content-Type: Not defined
- Accept: application/json
List<Trade> listMyTrades(currencyPair, limit, page, orderId)
List personal trading history
import io.gate.gateapi.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.SpotApi;
import java.io.File;
import java.util.*;
ApiClient client = new ApiClient("YOUR_API_KEY", "YOUR_API_SECRET");
// uncomment the next line if testing the API with other host
// apiClient.setBasePath("https://some-other-host");
SpotApi apiInstance = new SpotApi(client);
String currencyPair = "BTC_USDT"; // String | Currency pair
Integer limit = 100; // Integer | Maximum number of record returned in one list
Integer page = 1; // Integer | Page number
String orderId = "12345"; // String | List all trades of specified order
try {
List<Trade> result = apiInstance.listMyTrades(currencyPair, limit, page, orderId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SpotApi#listMyTrades");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | String | Currency pair | |
| limit | Integer | Maximum number of record returned in one list | [optional] [default to 100] |
| page | Integer | Page number | [optional] [default to 1] |
| orderId | String | List all trades of specified order | [optional] |
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
OrderBook listOrderBook(currencyPair, interval, limit)
Retrieve order book
Order book will be sorted by price from high to low on bids; reversed on asks
import io.gate.gateapi.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.SpotApi;
import java.io.File;
import java.util.*;
SpotApi apiInstance = new SpotApi();
String currencyPair = "BTC_USDT"; // String | Currency pair
String interval = "\"0\""; // String | Price precision of order book. 0 means no aggregation is applied
Integer limit = 10; // Integer | Maximum number of order depth data in asks or bids
try {
OrderBook result = apiInstance.listOrderBook(currencyPair, interval, limit);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SpotApi#listOrderBook");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | String | Currency pair | |
| interval | String | Price precision of order book. 0 means no aggregation is applied | [optional] [default to "0"] |
| limit | Integer | Maximum number of order depth data in asks or bids | [optional] [default to 10] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
List<Order> listOrders(currencyPair, status, page, limit)
List orders
import io.gate.gateapi.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.SpotApi;
import java.io.File;
import java.util.*;
ApiClient client = new ApiClient("YOUR_API_KEY", "YOUR_API_SECRET");
// uncomment the next line if testing the API with other host
// apiClient.setBasePath("https://some-other-host");
SpotApi apiInstance = new SpotApi(client);
String currencyPair = "BTC_USDT"; // String | Currency pair
String status = "open"; // String | List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled
Integer page = 1; // Integer | Page number
Integer limit = 100; // Integer | Maximum number of record returned in one list
try {
List<Order> result = apiInstance.listOrders(currencyPair, status, page, limit);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SpotApi#listOrders");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | String | Currency pair | |
| status | String | List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled | [enum: open, finished] |
| page | Integer | Page number | [optional] [default to 1] |
| limit | Integer | Maximum number of record returned in one list | [optional] [default to 100] |
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
List<SpotAccount> listSpotAccounts(currency)
List spot accounts
import io.gate.gateapi.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.SpotApi;
import java.io.File;
import java.util.*;
ApiClient client = new ApiClient("YOUR_API_KEY", "YOUR_API_SECRET");
// uncomment the next line if testing the API with other host
// apiClient.setBasePath("https://some-other-host");
SpotApi apiInstance = new SpotApi(client);
String currency = "BTC"; // String | Retrieved specified currency related data
try {
List<SpotAccount> result = apiInstance.listSpotAccounts(currency);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SpotApi#listSpotAccounts");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| currency | String | Retrieved specified currency related data | [optional] |
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
List<Ticker> listTickers(currencyPair)
Retrieve ticker information
Return only related data if `currency_pair` is specified; otherwise return all of them
import io.gate.gateapi.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.SpotApi;
import java.io.File;
import java.util.*;
SpotApi apiInstance = new SpotApi();
String currencyPair = "BTC_USDT"; // String | Currency pair
try {
List<Ticker> result = apiInstance.listTickers(currencyPair);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SpotApi#listTickers");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | String | Currency pair | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
List<Trade> listTrades(currencyPair, limit, lastId)
Retrieve market trades
import io.gate.gateapi.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.SpotApi;
import java.io.File;
import java.util.*;
SpotApi apiInstance = new SpotApi();
String currencyPair = "BTC_USDT"; // String | Currency pair
Integer limit = 100; // Integer | Maximum number of record returned in one list
String lastId = "12345"; // String | Specify list staring point using the last record of `id` in previous list-query results
try {
List<Trade> result = apiInstance.listTrades(currencyPair, limit, lastId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SpotApi#listTrades");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | String | Currency pair | |
| limit | Integer | Maximum number of record returned in one list | [optional] [default to 100] |
| lastId | String | Specify list staring point using the last record of `id` in previous list-query results | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json