All URIs are relative to https://api.gateio.ws/api/v4
Method | HTTP request | Description |
---|---|---|
ListCurrencyPairs | Get /spot/currency_pairs | List all currency pairs supported |
GetCurrencyPair | Get /spot/currency_pairs/{currency_pair} | Get detail of one single order |
ListTickers | Get /spot/tickers | Retrieve ticker information |
ListOrderBook | Get /spot/order_book | Retrieve order book |
ListTrades | Get /spot/trades | Retrieve market trades |
ListCandlesticks | Get /spot/candlesticks | Market candlesticks |
GetFee | Get /spot/fee | Query user trading fee rates |
ListSpotAccounts | Get /spot/accounts | List spot accounts |
CreateBatchOrders | Post /spot/batch_orders | Create a batch of orders |
ListAllOpenOrders | Get /spot/open_orders | List all open orders |
ListOrders | Get /spot/orders | List orders |
CreateOrder | Post /spot/orders | Create an order |
CancelOrders | Delete /spot/orders | Cancel all `open` orders in specified currency pair |
CancelBatchOrders | Post /spot/cancel_batch_orders | Cancel a batch of orders with an ID list |
GetOrder | Get /spot/orders/{order_id} | Get a single order |
CancelOrder | Delete /spot/orders/{order_id} | Cancel a single order |
ListMyTrades | Get /spot/my_trades | List personal trading history |
[]CurrencyPair ListCurrencyPairs(ctx, )
List all currency pairs supported
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.Background()
result, _, err := client.SpotApi.ListCurrencyPairs(ctx)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", 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 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 |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.Background()
currencyPair := "ETH_BTC" // string - Currency pair
result, _, err := client.SpotApi.GetCurrencyPair(ctx, currencyPair)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", 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]
[]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 |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.Background()
result, _, err := client.SpotApi.ListTickers(ctx, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", 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]
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] |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.Background()
currencyPair := "BTC_USDT" // string - Currency pair
result, _, err := client.SpotApi.ListOrderBook(ctx, currencyPair, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", 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 records returned in one list | [default to 100] |
lastId | optional.String | Specify list staring point using the `id` of last record in previous list-query results |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.Background()
currencyPair := "BTC_USDT" // string - Currency pair
result, _, err := client.SpotApi.ListTrades(ctx, currencyPair, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", 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]
[][]string ListCandlesticks(ctx, currencyPair, optional)
Market candlesticks
Maximum of 1000 points are returned in one query. Be sure not to exceed the limit when specifying from
, to
and interval
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 recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [default to 100] |
from | optional.Int64 | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | |
to | optional.Int64 | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | |
interval | optional.String | Interval time between data points | [default to 30m] |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.Background()
currencyPair := "BTC_USDT" // string - Currency pair
result, _, err := client.SpotApi.ListCandlesticks(ctx, currencyPair, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", 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]
TradeFee GetFee(ctx, optional)
Query user trading fee rates
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | GetFeeOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a GetFeeOpts struct
Name | Type | Description | Notes |
---|---|---|---|
currencyPair | optional.String | Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
result, _, err := client.SpotApi.GetFee(ctx, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}
- 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 |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
result, _, err := client.SpotApi.ListSpotAccounts(ctx, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]BatchOrder CreateBatchOrders(ctx, order)
Create a batch of orders
Batch orders requirements: 1. custom order field text
is required 2. At most 4 currency pairs, maximum 5 orders each, are allowed in one request 3. No mixture of spot orders and margin orders, i.e. account
must be identical for all orders
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
order | []Order |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
order := []gateapi.Order{gateapi.Order{}} // []Order -
result, _, err := client.SpotApi.CreateBatchOrders(ctx, order)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]OpenOrders ListAllOpenOrders(ctx, optional)
List all open orders
List open orders in all currency pairs. Note that pagination parameters affect record number in each currency pair's open order list. No pagination is applied to the number of currency pairs returned. All currency pairs with open orders will be returned
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | ListAllOpenOrdersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListAllOpenOrdersOpts struct
Name | Type | Description | Notes |
---|---|---|---|
page | optional.Int32 | Page number | [default to 1] |
limit | optional.Int32 | Maximum number of records returned in one page in each currency pair | [default to 100] |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
result, _, err := client.SpotApi.ListAllOpenOrders(ctx, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}
- 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 records returned. If `status` is `open`, maximum of `limit` is 100 | [default to 100] |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
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 := client.SpotApi.ListOrders(ctx, currencyPair, status, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}
- 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 |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
order := gateapi.Order{} // Order -
result, _, err := client.SpotApi.CreateOrder(ctx, order)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}
- Content-Type: application/json
- 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 |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
currencyPair := "BTC_USDT" // string - Currency pair
result, _, err := client.SpotApi.CancelOrders(ctx, currencyPair, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]CancelOrderResult CancelBatchOrders(ctx, cancelOrder)
Cancel a batch of orders with an ID list
Multiple currency pairs can be specified, but maximum 20 orders are allowed per request
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
cancelOrder | []CancelOrder |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
cancelOrder := []gateapi.CancelOrder{gateapi.CancelOrder{}} // []CancelOrder -
result, _, err := client.SpotApi.CancelBatchOrders(ctx, cancelOrder)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}
- Content-Type: application/json
- 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 |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
orderId := "12345" // string - ID returned on order successfully being created
currencyPair := "BTC_USDT" // string - Currency pair
result, _, err := client.SpotApi.GetOrder(ctx, orderId, currencyPair)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
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 |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
orderId := "12345" // string - ID returned on order successfully being created
currencyPair := "BTC_USDT" // string - Currency pair
result, _, err := client.SpotApi.CancelOrder(ctx, orderId, currencyPair)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}
- 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 records returned in one list | [default to 100] |
page | optional.Int32 | Page number | [default to 1] |
orderId | optional.String | List all trades of specified order |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
currencyPair := "BTC_USDT" // string - Currency pair
result, _, err := client.SpotApi.ListMyTrades(ctx, currencyPair, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]