Skip to content
Igor Sazonov edited this page Jul 12, 2026 · 1 revision

Welcome to the coinglass-go Wiki!

coinglass-go is a fast, idiomatic, and dependency-free Go client for the Coinglass API v4. It provides access to Futures, Spot, Options, ETF, and Indicator endpoints using only the Go standard library.

Quick Links

Why this SDK?

  1. Zero Dependencies: Built entirely on net/http, encoding/json, context, and time. No go.mod bloat.
  2. Resilient: Built-in automatic exponential backoff for 429 Too Many Requests responses, honoring the Retry-After header.
  3. Idiomatic: Uses the functional options pattern for configuration, passes context.Context everywhere, and returns strongly typed structs.
  4. Thread-Safe: The client is safe to share across multiple goroutines.

Basic Example

package main

import (
	"context"
	"fmt"
	"log"
	"time"

	coinglass "github.com/tigusigalpa/coinglass-go"
)

func main() {
	ctx := context.Background()

	client := coinglass.NewClient("YOUR_API_KEY",
		coinglass.WithTimeout(15*time.Second),
		coinglass.WithRetry(3, time.Second),
	)

	// Fetch Bitcoin open interest history
	oi, err := client.Futures.OpenInterestHistory(ctx, &coinglass.OIHistoryParams{
		Symbol:   "BTC",
		Interval: "1d",
		Limit:    coinglass.IntPtr(30),
	})
	if err != nil {
		log.Fatal(err)
	}

	for _, point := range oi {
		fmt.Printf("OI: %.2f USD at %d\n", point.OpenInterestUsd, point.Timestamp)
	}
}

Check out the sidebar for detailed documentation on each service!

Clone this wiki locally