Skip to content

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.

Initialization

client := coinglass.NewClient("YOUR_API_KEY")
ctx := context.Background()

Market Sentiment & Indices

Fear & Greed Index History

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)
}

Coinbase Premium Index

premium, err := client.Indicators.CoinbasePremium(ctx, &coinglass.CoinbasePremiumParams{
    Limit: coinglass.IntPtr(30),
})

Stablecoin Market Cap History

stablecoins, err := client.Indicators.StablecoinMarketCap(ctx, &coinglass.StablecoinMarketCapParams{
    Limit: coinglass.IntPtr(30),
})

Technical Indicators

RSI List

rsi, err := client.Indicators.RSIList(ctx, &coinglass.RSIListParams{
    Symbol:   coinglass.StringPtr("BTC"),
    Interval: coinglass.StringPtr("1d"),
})

Futures Basis History

basis, err := client.Indicators.BasisHistory(ctx, &coinglass.BasisHistoryParams{
    Symbol:   "BTC",
    Interval: "1d",
})

Long-Term Models

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{}.

Bitcoin Rainbow Chart

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))
}

Stock-to-Flow Model

s2f, err := client.Indicators.StockToFlow(ctx)

Clone this wiki locally