Skip to content

Latest commit

 

History

History
38 lines (32 loc) · 844 Bytes

File metadata and controls

38 lines (32 loc) · 844 Bytes

Retries Configuration

package main

import (
	"context"
	"encoding/json"
	"log"

	client "github.com/binance/binance-connector-go/clients/convert"
	"github.com/binance/binance-connector-go/common/v2/common"
)

func main() {
	ListAllConvertPairs()
}

func ListAllConvertPairs() {
	configuration := common.NewConfigurationRestAPI(
		common.WithBasePath(common.ConvertRestApiProdUrl),
		common.WithApiKey("Your API Key"),
		common.WithApiSecret("Your API Secret"),
		common.WithRetries(2),
	)
	apiClient := client.NewBinanceConvertClient(
		client.WithRestAPI(configuration),
	)
	resp, err := apiClient.RestApi.MarketDataAPI.ListAllConvertPairs(context.Background()).Execute()
	if err != nil {
		log.Println(err)
		return
	}

	dataValue, _ := json.MarshalIndent(resp.Data, "", "  ")
	log.Printf("Response: %s\n", string(dataValue))
}