-
Notifications
You must be signed in to change notification settings - Fork 0
Indicators Service
Igor Sazonov edited this page Jul 12, 2026
·
1 revision
The IndicatorsService provides access to Coinglass market indicators, such as the Fear & Greed Index, RSI, Futures Basis, Coinbase Premium, and long-term models like the Rainbow Chart and Stock-to-Flow. It is accessed via client.Indicators.
client := coinglass.NewClient("YOUR_API_KEY")
ctx := context.Background()fg, err := client.Indicators.FearGreedHistory(ctx, &coinglass.FearGreedParams{
Limit: coinglass.IntPtr(7),
})
if err == nil && len(fg) > 0 {
fmt.Printf("Latest Fear & Greed: %d (%s)\n", fg[0].Value, fg[0].Classification)
}premium, err := client.Indicators.CoinbasePremium(ctx, &coinglass.CoinbasePremiumParams{
Limit: coinglass.IntPtr(30),
})stablecoins, err := client.Indicators.StablecoinMarketCap(ctx, &coinglass.StablecoinMarketCapParams{
Limit: coinglass.IntPtr(30),
})rsi, err := client.Indicators.RSIList(ctx, &coinglass.RSIListParams{
Symbol: coinglass.StringPtr("BTC"),
Interval: coinglass.StringPtr("1d"),
})basis, err := client.Indicators.BasisHistory(ctx, &coinglass.BasisHistoryParams{
Symbol: "BTC",
Interval: "1d",
})Because the Rainbow Chart and Stock-to-Flow models return complex, deeply nested JSON structures that can change, the SDK returns the data payload as json.RawMessage. You can unmarshal it into your own custom structs or map[string]interface{}.
rainbow, err := client.Indicators.BitcoinRainbowChart(ctx)
if err == nil {
// rainbow.Data is a json.RawMessage
fmt.Printf("Received %d bytes of chart data\n", len(rainbow.Data))
}s2f, err := client.Indicators.StockToFlow(ctx)