All URIs are relative to https://api.gateio.ws/api/v4
| Method | HTTP request | Description |
|---|---|---|
| ListFlashSwapCurrencyPair | Get /flash_swap/currency_pairs | List All Supported Currency Pairs In Flash Swap |
| ListFlashSwapOrders | Get /flash_swap/orders | Query flash swap order list |
| CreateFlashSwapOrder | Post /flash_swap/orders | Create a flash swap order |
| GetFlashSwapOrder | Get /flash_swap/orders/{order_id} | Query single flash swap order |
| PreviewFlashSwapOrder | Post /flash_swap/orders/preview | Flash swap order preview |
[]FlashSwapCurrencyPair ListFlashSwapCurrencyPair(ctx, optional)
List All Supported Currency Pairs In Flash Swap
BTC_GT represents selling BTC and buying GT. The limits for each currency may vary across different currency pairs. It is not necessary that two currencies that can be swapped instantaneously can be exchanged with each other. For example, it is possible to sell BTC and buy GT, but it does not necessarily mean that GT can be sold to buy BTC.
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| optional | ListFlashSwapCurrencyPairOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListFlashSwapCurrencyPairOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| currency | optional.String | Query by specified currency name | |
| page | optional.Int32 | Page number | [default to 1] |
| limit | optional.Int32 | Maximum number of items returned. Default: 1000, minimum: 1, maximum: 1000 | [default to 1000] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
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.FlashSwapApi.ListFlashSwapCurrencyPair(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]
[]FlashSwapOrder ListFlashSwapOrders(ctx, optional)
Query flash swap order list
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| optional | ListFlashSwapOrdersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListFlashSwapOrdersOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| status | optional.Int32 | Flash swap order status `1` - success `2` - failed | |
| sellCurrency | optional.String | Asset name to sell - Retrieved from API `GET /flash_swap/currencies` for supported flash swap currencies | |
| buyCurrency | optional.String | Asset name to buy - Retrieved from API `GET /flash_swap/currencies` for supported flash swap currencies | |
| reverse | optional.Bool | Sort by ID in ascending or descending order, default `true` - `true`: ID descending order (most recent data first) - `false`: ID ascending order (oldest data first) | |
| limit | optional.Int32 | Maximum number of records returned in a single list | [default to 100] |
| page | optional.Int32 | Page number | [default to 1] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
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.FlashSwapApi.ListFlashSwapOrders(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]
FlashSwapOrder CreateFlashSwapOrder(ctx, flashSwapOrderRequest)
Create a flash swap order
Initiate a flash swap preview in advance because order creation requires a preview result
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| flashSwapOrderRequest | FlashSwapOrderRequest |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
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",
}
)
flashSwapOrderRequest := gateapi.FlashSwapOrderRequest{} // FlashSwapOrderRequest -
result, _, err := client.FlashSwapApi.CreateFlashSwapOrder(ctx, flashSwapOrderRequest)
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]
FlashSwapOrder GetFlashSwapOrder(ctx, orderId)
Query single flash swap order
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| orderId | int32 | Flash swap order ID |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
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 := 1 // int32 - Flash swap order ID
result, _, err := client.FlashSwapApi.GetFlashSwapOrder(ctx, orderId)
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]
FlashSwapOrderPreview PreviewFlashSwapOrder(ctx, flashSwapPreviewRequest)
Flash swap order preview
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| flashSwapPreviewRequest | FlashSwapPreviewRequest |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v7"
)
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",
}
)
flashSwapPreviewRequest := gateapi.FlashSwapPreviewRequest{} // FlashSwapPreviewRequest -
result, _, err := client.FlashSwapApi.PreviewFlashSwapOrder(ctx, flashSwapPreviewRequest)
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]