Orders are the fundamental building blocks of trading on Coinbase Exchange. Understanding the different order types and their behaviors is crucial for building effective Crypto-as-a-Service (CaaS) trading strategies.
Before placing orders, you need to know which trading pairs are available. Product pairs represent the available markets for trading. To list product pairs, as well as important metadata about order size requirements, run the following:
Copy
Ask AI
package mainimport ( "context" "encoding/json" "fmt" "log" "github.com/coinbase-samples/core-go" "github.com/coinbase-samples/exchange-sdk-go/client" "github.com/coinbase-samples/exchange-sdk-go/credentials" "github.com/coinbase-samples/exchange-sdk-go/products")func main() { credentials, err := credentials.ReadEnvCredentials("EXCHANGE_CREDENTIALS") if err != nil { log.Fatalf("unable to read credentials from environment: %v", err) } httpClient, err := core.DefaultHttpClient() if err != nil { log.Fatalf("unable to load default http client: %v", err) } client := client.NewRestClient(credentials, httpClient) productsSvc := products.NewProductsService(client) request := &products.ListProductsRequest{} response, err := productsSvc.ListProducts(context.Background(), request) if err != nil { log.Fatalf("unable to list products: %v", err) } output, err := json.MarshalIndent(response, "", " ") if err != nil { log.Fatalf("error marshaling response to JSON: %v", err) } fmt.Println(string(output))}