All URIs are relative to https://api.gateio.ws/api/v4
Method | HTTP request | Description |
---|---|---|
ListFlashSwapCurrencies | Get /flash_swap/currencies | List All Supported Currencies In Flash Swap (deprecated) |
ListFlashSwapCurrencyPair | Get /flash_swap/currency_pairs | List All Supported Currency Pairs In Flash Swap |
ListFlashSwapOrders | Get /flash_swap/orders | List all flash swap orders |
CreateFlashSwapOrder | Post /flash_swap/orders | Create a flash swap order |
GetFlashSwapOrder | Get /flash_swap/orders/{order_id} | Get a single flash swap order's detail |
PreviewFlashSwapOrder | Post /flash_swap/orders/preview | Initiate a flash swap order preview |
[]FlashSwapCurrency ListFlashSwapCurrencies(ctx, )
List All Supported Currencies In Flash Swap (deprecated)
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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.ListFlashSwapCurrencies(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]
[]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 | Retrieve data of the specified currency | |
page | optional.Int32 | Page number | [default to 1] |
limit | optional.Int32 | Maximum response items. Default: 100, minimum: 1, Maximum: 1000 | [default to 1000] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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)
List all flash swap orders
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` - failure | |
sellCurrency | optional.String | Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` | |
buyCurrency | optional.String | Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` | |
reverse | optional.Bool | If results are sorted by id in reverse order. Default to `true` - `true`: sort by id in descending order(recent first) - `false`: sort by id in ascending order(oldest first) | |
limit | optional.Int32 | Maximum number of records to be 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/v6"
)
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/v6"
)
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)
Get a single flash swap order's detail
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/v6"
)
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)
Initiate a 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/v6"
)
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]