-
Notifications
You must be signed in to change notification settings - Fork 0
Home
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.
- Installation & Configuration
- Futures Service
- Spot Service
- Options Service
- ETF Service
- Indicators Service
- Error Handling & Retries
- Concurrency & Thread Safety
-
Zero Dependencies: Built entirely on
net/http,encoding/json,context, andtime. Nogo.modbloat. -
Resilient: Built-in automatic exponential backoff for
429 Too Many Requestsresponses, honoring theRetry-Afterheader. -
Idiomatic: Uses the functional options pattern for configuration, passes
context.Contexteverywhere, and returns strongly typed structs. - Thread-Safe: The client is safe to share across multiple goroutines.
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!