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(ctx, orderId, currencyPair) Cancel a single order
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
orderId | string | ID returned on order successfully being created | |
currencyPair | string | Currency pair |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.SpotApi
orderId := "12345"; // string - ID returned on order successfully being created
currencyPair := "BTC_USDT"; // string - Currency pair
result, _, err := api.CancelOrder(nil, orderId, currencyPair)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]Order CancelOrders(ctx, currencyPair, optional) Cancel all
open
orders in specified currency pair
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
currencyPair | string | Currency pair | |
optional | *CancelOrdersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a CancelOrdersOpts struct
Name | Type | Description | Notes |
---|
side | optional.String| All bids or asks. Both included in not specified | account | optional.String| Specify account type. Default to all account types being included |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.SpotApi
currencyPair := "BTC_USDT"; // string - Currency pair
result, _, err := api.CancelOrders(nil, currencyPair, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Order CreateOrder(ctx, order) Create an order
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
order | Order |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.SpotApi
order := new (gateapi.Order); // Order -
result, _, err := api.CreateOrder(nil, order)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CurrencyPair GetCurrencyPair(ctx, currencyPair) Get detail of one single order
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
currencyPair | string | Currency pair |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
api := client.SpotApi
currencyPair := "ETH_BTC"; // string - Currency pair
result, _, err := api.GetCurrencyPair(nil, currencyPair)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Order GetOrder(ctx, orderId, currencyPair) Get a single order
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
orderId | string | ID returned on order successfully being created | |
currencyPair | string | Currency pair |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.SpotApi
orderId := "12345"; // string - ID returned on order successfully being created
currencyPair := "BTC_USDT"; // string - Currency pair
result, _, err := api.GetOrder(nil, orderId, currencyPair)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[][]string ListCandlesticks(ctx, currencyPair, optional) Market candlesticks
Candlestick data will start from (current time - limit * interval), end at current time
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
currencyPair | string | Currency pair | |
optional | *ListCandlesticksOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListCandlesticksOpts struct
Name | Type | Description | Notes |
---|
limit | optional.Int32| Maximum number of record returned in one list | [default to 100] interval | optional.String| Interval time between data points | [default to 30m]
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
api := client.SpotApi
currencyPair := "BTC_USDT"; // string - Currency pair
result, _, err := api.ListCandlesticks(nil, currencyPair, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]CurrencyPair ListCurrencyPairs(ctx, ) List all currency pairs supported
This endpoint does not need any parameter.
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
api := client.SpotApi
result, _, err := api.ListCurrencyPairs(nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]Trade ListMyTrades(ctx, currencyPair, optional) List personal trading history
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
currencyPair | string | Currency pair | |
optional | *ListMyTradesOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListMyTradesOpts struct
Name | Type | Description | Notes |
---|
limit | optional.Int32| Maximum number of record returned in one list | [default to 100] page | optional.Int32| Page number | [default to 1] orderId | optional.String| List all trades of specified order |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.SpotApi
currencyPair := "BTC_USDT"; // string - Currency pair
result, _, err := api.ListMyTrades(nil, currencyPair, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
OrderBook ListOrderBook(ctx, currencyPair, optional) Retrieve order book
Order book will be sorted by price from high to low on bids; reversed on asks
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
currencyPair | string | Currency pair | |
optional | *ListOrderBookOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListOrderBookOpts struct
Name | Type | Description | Notes |
---|
interval | optional.String| Order depth. 0 means no aggregation is applied. default to 0 | [default to 0] limit | optional.Int32| Maximum number of order depth data in asks or bids | [default to 10]
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
api := client.SpotApi
currencyPair := "BTC_USDT"; // string - Currency pair
result, _, err := api.ListOrderBook(nil, currencyPair, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]Order ListOrders(ctx, currencyPair, status, optional) List orders
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
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 | |
optional | *ListOrdersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListOrdersOpts struct
Name | Type | Description | Notes |
---|
page | optional.Int32| Page number | [default to 1] limit | optional.Int32| Maximum number of record returned in one list | [default to 100]
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.SpotApi
currencyPair := "BTC_USDT"; // string - Currency pair
status := "open"; // string - List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled
result, _, err := api.ListOrders(nil, currencyPair, status, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]SpotAccount ListSpotAccounts(ctx, optional) List spot accounts
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | *ListSpotAccountsOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListSpotAccountsOpts struct
Name | Type | Description | Notes |
---|---|---|---|
currency | optional.String | Retrieved specified currency related data |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.SpotApi
result, _, err := api.ListSpotAccounts(nil, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]Ticker ListTickers(ctx, optional) Retrieve ticker information
Return only related data if currency_pair
is specified; otherwise return all of them
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | *ListTickersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListTickersOpts struct
Name | Type | Description | Notes |
---|---|---|---|
currencyPair | optional.String | Currency pair |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
api := client.SpotApi
result, _, err := api.ListTickers(nil, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]Trade ListTrades(ctx, currencyPair, optional) Retrieve market trades
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
currencyPair | string | Currency pair | |
optional | *ListTradesOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListTradesOpts struct
Name | Type | Description | Notes |
---|
limit | optional.Int32| Maximum number of record returned in one list | [default to 100] lastId | optional.String| Specify list staring point using the last record of `id` in previous list-query results |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
api := client.SpotApi
currencyPair := "BTC_USDT"; // string - Currency pair
result, _, err := api.ListTrades(nil, currencyPair, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]