coinglass

package module
v1.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 13 Imported by: 0

README

CoinGlass Golang SDK

CoinGlass Golang SDK

CI Tests CodeQL Codecov Go Reference Go version License

A Go client for the Coinglass API v4, with no external dependencies.

coinglass-go is a small, typed Go client for the Coinglass API v4. I built it to scratch my own itch while working on liquidation dashboards and funding-rate tooling, and it covers the Futures, Spot, Options, ETF, and Indicator endpoints. It leans entirely on the standard library, so adding it to your project won't drag in a tree of transitive dependencies.

Documentation

Highlights

  • Covers all five endpoint groups: Futures, Spot, Options, ETF, and Indicators.
  • Includes a WebSocket client for real-time liquidation, trade, and futures ticker streams.
  • No third-party dependencies — just the standard library, for both the REST and WebSocket clients.
  • Configured with functional options, the way most Go clients do it.
  • Every method takes a context.Context, and the client is safe to share across goroutines.
  • Retries rate-limited (429) requests with exponential backoff, and honors Retry-After when the API sends it.
  • Returns typed sentinel errors for 401, 404, and 429, and a detailed APIError (with the API's own code/msg) for anything else.
  • Each service ships with its own httptest-based tests.

Requirements

Requirement Version
Go 1.21+
Dependencies none (standard library only)
Coinglass API key Get one here

Installation

go get github.com/tigusigalpa/coinglass-go

Getting started

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), // 3 attempts, 1s initial backoff
    )

    // BTC open interest history (last 30 days, daily)
    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)
    }
}

Compile and run it:

go run main.go

Configuring the client

NewClient takes functional options:

client := coinglass.NewClient("YOUR_API_KEY",
    coinglass.WithBaseURL("https://open-api-v4.coinglass.com"), // default, shown for clarity
    coinglass.WithTimeout(15*time.Second),
    coinglass.WithRetry(3, time.Second),
    coinglass.WithHTTPClient(&http.Client{}), // custom transport, proxies, TLS, etc.
)
Option What it does When to use it
WithBaseURL(url string) Overrides the API base URL. Mocking the API in tests or using a custom gateway.
WithHTTPClient(client *http.Client) Supplies your own HTTP client. Custom TLS, proxies, tracing, or middleware.
WithTimeout(d time.Duration) Sets the per-request timeout. Default is 30s; lower it for fast UI endpoints.
WithRetry(maxAttempts int, baseDelay time.Duration) Retries on HTTP 429 with exponential backoff. Strongly recommended for production workloads.

You can also read the API key from the COINGLASS_API_KEY environment variable:

client, err := coinglass.NewClientFromEnv(coinglass.WithTimeout(15 * time.Second))
if err != nil {
    log.Fatal(err)
}

Rate limits by plan

Plan Requests/min
Hobbyist 30
Startup 80
Standard 300
Professional 1200

If you enable retries, the client backs off automatically and doubles the wait on each attempt (or uses the Retry-After header when Coinglass sends one):

client := coinglass.NewClient("YOUR_API_KEY",
    coinglass.WithRetry(3, time.Second), // 1s, then 2s, then 4s
)

Full API reference

Futures — client.Futures
Method Endpoint Description
SupportedCoins(ctx) GET /futures/supported-coins Supported futures coins
SupportedExchangePairs(ctx, params) GET /api/futures/supported-exchange-pairs Supported exchange pairs
CoinsMarkets(ctx, params) GET /api/futures/coins-markets Futures coin markets
PairsMarkets(ctx, params) GET /api/futures/pairs-markets Futures pair markets
PriceChangeList(ctx) GET /futures/price-change-list Price change list
OpenInterestHistory(ctx, params) GET /api/futures/openInterest/ohlc-history OI OHLC history
OpenInterestAggregatedHistory(ctx, params) GET /api/futures/openInterest/ohlc-aggregated-history Aggregated OI OHLC
OpenInterestExchangeList(ctx, params) GET /api/futures/openInterest/exchange-list OI by exchange
FundingRateHistory(ctx, params) GET /api/futures/fundingRate/ohlc-history Funding rate OHLC
FundingRateOiWeighted(ctx, params) GET /api/futures/fundingRate/oi-weight-ohlc-history OI-weighted funding rate
FundingRateExchangeList(ctx, params) GET /api/futures/fundingRate/exchange-list Funding rate by exchange
FundingRateArbitrage(ctx, params) GET /api/futures/fundingRate/arbitrage Funding arbitrage
LongShortRatioHistory(ctx, params) GET /api/futures/global-long-short-account-ratio/history Global L/S ratio
TopLongShortRatioHistory(ctx, params) GET /api/futures/top-long-short-account-ratio/history Top trader L/S ratio
LiquidationHistory(ctx, params) GET /api/futures/liquidation/history Pair liquidation history
LiquidationAggregatedHistory(ctx, params) GET /api/futures/liquidation/aggregated-history Coin liquidation history
LiquidationCoinList(ctx, params) GET /api/futures/liquidation/coin-list Liquidation coin list
LiquidationHeatmap(ctx, model, params) GET /api/futures/liquidation/heatmap/model{1,2,3} Liquidation heatmaps
LiquidationMap(ctx, params) GET /api/futures/liquidation/map Liquidation map
OrderbookHistory(ctx, params) GET /api/futures/orderbook/history Orderbook heatmap
LargeOrders(ctx, params) GET /api/futures/orderbook/large-limit-order Large orderbook orders
TakerBuySellHistory(ctx, params) GET /api/futures/taker-buy-sell-volume/history Taker buy/sell history
WhaleAlert(ctx, params) GET /api/hyperliquid/whale-alert Hyperliquid whale alert
Spot — client.Spot
Method Endpoint Description
SupportedCoins(ctx) GET /api/spot/supported-coins Supported coins
CoinsMarkets(ctx, params) GET /api/spot/coins-markets Coins markets
PairsMarkets(ctx, params) GET /api/spot/pairs-markets Pairs markets
PriceHistory(ctx, params) GET /api/spot/price/history Price OHLC history
OrderbookHistory(ctx, params) GET /api/spot/orderbook/history Orderbook heatmap
TakerBuySellHistory(ctx, params) GET /api/spot/taker-buy-sell-volume/history Taker buy/sell history
Options — client.Options
Method Endpoint Description
MaxPain(ctx, params) GET /api/option/max-pain Option max pain
Info(ctx, params) GET /api/option/info Options info
ExchangeOIHistory(ctx, params) GET /api/option/exchange-oi-history Exchange OI history
ExchangeVolHistory(ctx, params) GET /api/option/exchange-vol-history Exchange volume history
ETF — client.ETF
Method Endpoint Description
BitcoinList(ctx) GET /api/etf/bitcoin/list Bitcoin ETF list
BitcoinFlowHistory(ctx, params) GET /api/etf/bitcoin/flow-history BTC ETF flows
BitcoinNetAssetsHistory(ctx, params) GET /api/etf/bitcoin/net-assets/history ETF net assets
EthereumList(ctx) GET /api/etf/ethereum/list Ethereum ETF list
EthereumFlowHistory(ctx, params) GET /api/etf/ethereum/flow-history ETH ETF flows
GrayscaleHoldings(ctx) GET /api/grayscale/holdings-list Grayscale holdings
Indicators — client.Indicators
Method Endpoint Description
FearGreedHistory(ctx, params) GET /api/index/fear-greed-history Fear & Greed index
RSIList(ctx, params) GET /api/futures/rsi/list RSI list
BasisHistory(ctx, params) GET /api/futures/basis/history Futures basis
CoinbasePremium(ctx, params) GET /api/coinbase-premium-index Coinbase premium
BitcoinRainbowChart(ctx) GET /api/index/bitcoin/rainbow-chart BTC rainbow chart
StockToFlow(ctx) GET /api/index/stock-flow Stock-to-Flow model
StablecoinMarketCap(ctx, params) GET /api/index/stableCoin-marketCap-history Stablecoin market cap

Error handling

Any non-2xx response, or a response whose Coinglass envelope code isn't zero, comes back as an *coinglass.APIError:

type APIError struct {
    StatusCode int
    Code       string
    Message    string
    RawBody    []byte
}

For the common cases, match on the sentinel errors with errors.Is; when you need the details, pull out the *APIError with errors.As:

import "errors"

oi, err := client.Futures.OpenInterestHistory(ctx, params)
if err != nil {
    switch {
    case errors.Is(err, coinglass.ErrUnauthorized):
        log.Fatal("Invalid API key")
    case errors.Is(err, coinglass.ErrRateLimited):
        log.Println("Rate limited — retries exhausted")
    default:
        var apiErr *coinglass.APIError
        if errors.As(err, &apiErr) {
            log.Printf("API error %d (%s): %s", apiErr.StatusCode, apiErr.Code, apiErr.Message)
        }
    }
}

WebSocket API

Alongside the REST client, coinglass-go ships a small WebSocket client under the websocket subpackage for Coinglass's real-time streams — liquidation orders, spot and futures trades, and futures ticker snapshots. It's built entirely on the standard library too: the WebSocket handshake, framing, and masking are implemented directly on top of net/crypto/tls, so no third-party dependency is pulled in.

package main

import (
    "context"
    "log"
    "os"
    "os/signal"
    "syscall"

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

func main() {
    client := coinglass.NewClient(os.Getenv("COINGLASS_API_KEY"))
    ws := client.WSClient()

    ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
    defer stop()

    stream, err := ws.Connect(ctx)
    if err != nil {
        log.Fatal(err)
    }
    defer stream.Close()

    stream.Subscribe(
        websocket.ChannelLiquidationOrders(),
        websocket.ChannelFuturesTicker("Binance", "BTCUSDT"),
    )

    for {
        select {
        case <-ctx.Done():
            return
        case msg, ok := <-stream.Messages():
            if !ok {
                return
            }
            if msg.Channel == websocket.ChannelLiquidationOrders() {
                orders, _ := websocket.DecodeLiquidationOrders(msg.Data)
                for _, o := range orders {
                    log.Printf("%s %s liquidated %.2f USD", o.Exchange, o.Symbol, o.VolumeUSD)
                }
            }
        case err := <-stream.Errors():
            log.Println("stream error:", err)
        }
    }
}

A single connection carries every subscription; Subscribe/Unsubscribe accept any number of channel names, and the client sends the "ping" heartbeat every 20 seconds that Coinglass expects to keep the socket open.

Channel helpers
Helper Channel Docs
websocket.ChannelLiquidationOrders() liquidation_orders Liquidation Order
websocket.ChannelSpotTrades(exchange, symbol, minVolumeUSD) spot_trades@{exchange}_{symbol}@{minVolumeUSD} Spot Trade Order
websocket.ChannelFuturesTrades(exchange, symbol, minVolumeUSD) futures_trades@{exchange}_{symbol}@{minVolumeUSD} Futures Trade Order
websocket.ChannelFuturesTicker(exchange, symbol) futures_ticker@{exchange}_{symbol} Futures Ticker Snapshot

Each channel has a matching decode helper — DecodeLiquidationOrders, DecodeTrades, and DecodeFuturesTicker — that unmarshals Message.Data into typed structs.

Context and concurrency

Every method takes a context, and a single Client is safe to use from multiple goroutines:

var wg sync.WaitGroup
for _, symbol := range []string{"BTC", "ETH", "SOL"} {
    wg.Add(1)
    go func(sym string) {
        defer wg.Done()
        oi, err := client.Futures.OpenInterestHistory(ctx, &coinglass.OIHistoryParams{
            Symbol:   sym,
            Interval: "1d",
        })
        if err != nil {
            log.Printf("%s failed: %v", sym, err)
            return
        }
        log.Printf("%s: %d points", sym, len(oi))
    }(symbol)
}
wg.Wait()

Pointer helpers

Optional parameters are pointer fields, so the client can tell "not set" apart from a real zero value. These helpers save you a few lines when passing literals:

coinglass.IntPtr(30)
coinglass.StringPtr("BTC")
coinglass.BoolPtr(true)
coinglass.Int64Ptr(1690000000)
coinglass.Float64Ptr(1.5)

Examples

There are a few runnable examples in the examples/ directory:

Example What it shows
examples/basic Client setup, Futures/Spot/Options queries, error handling
examples/etf Bitcoin/Ethereum ETF flows, Grayscale holdings, Fear & Greed Index
examples/concurrency Sharing a single Client safely across goroutines
examples/websocket Subscribing to liquidation orders, trades, and futures ticker streams

Run any of them with:

export COINGLASS_API_KEY=your-api-key
go run ./examples/basic

Running the tests

go test ./...

Race detection requires CGO_ENABLED=1 and a C toolchain:

go test -race ./...

The same checks run automatically on every push and pull request through GitHub Actions.

License

MIT © Igor Sazonov

Documentation

Overview

Package coinglass provides a Go SDK for the Coinglass API v4 (https://open-api-v4.coinglass.com). It exposes service structs grouped by resource (Futures, Spot, Options, ETF, Indicators) accessible as fields on Client.

Package coinglass provides a Go SDK for the Coinglass API v4.

Index

Constants

View Source
const DefaultBaseDelay = 500 * time.Millisecond

DefaultBaseDelay is the default initial backoff delay used for retry attempts, unless overridden with WithRetry.

View Source
const DefaultBaseURL = "https://open-api-v4.coinglass.com"

DefaultBaseURL is the default Coinglass API v4 base URL used by NewClient unless overridden with WithBaseURL.

View Source
const DefaultMaxAttempts = 1

DefaultMaxAttempts is the default number of attempts (including the initial request) made for a request before giving up when receiving HTTP 429 responses, unless overridden with WithRetry.

View Source
const DefaultTimeout = 30 * time.Second

DefaultTimeout is the default HTTP client timeout used unless overridden with WithTimeout.

Variables

View Source
var (
	// ErrUnauthorized is returned when the API responds with HTTP 401.
	ErrUnauthorized = errors.New("coinglass: unauthorized — check your API key")
	// ErrNotFound is returned when the API responds with HTTP 404.
	ErrNotFound = errors.New("coinglass: resource not found")
	// ErrRateLimited is returned when the API responds with HTTP 429 and
	// all retry attempts have been exhausted.
	ErrRateLimited = errors.New("coinglass: rate limit exceeded")
)

Sentinel errors that can be checked with errors.Is against errors returned from service methods. The underlying *APIError is always available via errors.As for accessing StatusCode/RawBody.

Functions

func BoolPtr

func BoolPtr(b bool) *bool

BoolPtr returns a pointer to the provided bool value.

func Float64Ptr

func Float64Ptr(f float64) *float64

Float64Ptr returns a pointer to the provided float64 value.

func Int64Ptr

func Int64Ptr(i int64) *int64

Int64Ptr returns a pointer to the provided int64 value.

func IntPtr

func IntPtr(i int) *int

IntPtr returns a pointer to the provided int value. It is useful for populating optional pointer fields in parameter structs.

func StringPtr

func StringPtr(s string) *string

StringPtr returns a pointer to the provided string value.

Types

type APIError

type APIError struct {
	// StatusCode is the HTTP status code returned by the API.
	StatusCode int
	// Code is the Coinglass API-level code, if present in the response.
	Code string
	// Message is a human-readable error message.
	Message string
	// RawBody contains the raw response body for debugging purposes.
	RawBody []byte
}

APIError represents an error response returned by the Coinglass API. It is returned by every service method when the API responds with a non-2xx HTTP status code or a non-zero API code.

func (*APIError) Error

func (e *APIError) Error() string

Error implements the error interface for APIError.

type ArbitrageItem

type ArbitrageItem struct {
	Symbol      string  `json:"symbol"`
	Exchange    string  `json:"exchange"`
	FundingRate float64 `json:"fundingRate"`
	Spread      float64 `json:"spread"`
}

ArbitrageItem represents a single funding-rate arbitrage opportunity.

type BasisHistoryParams

type BasisHistoryParams struct {
	Symbol    string `url:"symbol"`
	Interval  string `url:"interval"`
	Limit     *int   `url:"limit,omitempty"`
	StartTime *int64 `url:"startTime,omitempty"`
	EndTime   *int64 `url:"endTime,omitempty"`
}

BasisHistoryParams holds parameters for BasisHistory.

type BasisPoint

type BasisPoint struct {
	Basis     float64 `json:"basis"`
	Timestamp int64   `json:"t"`
}

BasisPoint represents a single futures basis history point.

type Client

type Client struct {

	// Futures provides access to the futures endpoints.
	Futures *FuturesService
	// Spot provides access to the spot endpoints.
	Spot *SpotService
	// Options provides access to the options endpoints.
	Options *OptionsService
	// ETF provides access to the ETF endpoints.
	ETF *ETFService
	// Indicators provides access to the indicator endpoints.
	Indicators *IndicatorsService
	// contains filtered or unexported fields
}

Client is the entry point of the Coinglass Go SDK. It holds the HTTP configuration and exposes one service struct per API resource group. A Client is safe for concurrent use by multiple goroutines.

func NewClient

func NewClient(apiKey string, opts ...Option) *Client

NewClient creates a new Coinglass API client authenticated with the given apiKey. The apiKey is sent in the CG-API-KEY header on every request. Behaviour can be customized via Option values such as WithBaseURL, WithHTTPClient, WithTimeout, and WithRetry.

Example:

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

func NewClientFromEnv

func NewClientFromEnv(opts ...Option) (*Client, error)

NewClientFromEnv reads the API key from the COINGLASS_API_KEY environment variable and returns a new Coinglass client. Additional Option values can be passed to override timeouts, retries, etc.

func (*Client) WSClient added in v1.1.0

func (c *Client) WSClient(opts ...websocket.Option) *websocket.Client

WSClient returns a new WebSocket client authenticated with the same API key as the HTTP client. The Coinglass WebSocket API is served from a dedicated host (wss://open-ws.coinglass.com/ws-api) independent of the REST base URL, so no base URL is inherited. Additional websocket.Option values can be passed to override the endpoint, handshake timeout, or ping interval.

type CoinMarket

type CoinMarket struct {
	Symbol            string  `json:"symbol"`
	Price             float64 `json:"price"`
	PriceChange1h     float64 `json:"priceChange1h"`
	PriceChange24h    float64 `json:"priceChange24h"`
	VolumeUsd24h      float64 `json:"volumeUsd24h"`
	OpenInterestUsd   float64 `json:"openInterestUsd"`
	FundingRate       float64 `json:"fundingRate"`
	TurnoverNumber24h float64 `json:"turnoverNumber24h"`
}

CoinMarket represents a single futures coin market snapshot.

type CoinbasePremiumParams

type CoinbasePremiumParams struct {
	Limit     *int   `url:"limit,omitempty"`
	StartTime *int64 `url:"startTime,omitempty"`
	EndTime   *int64 `url:"endTime,omitempty"`
}

CoinbasePremiumParams holds optional parameters for CoinbasePremium.

type CoinsMarketsParams

type CoinsMarketsParams struct {
	Symbol    *string  `url:"symbol,omitempty"`
	Exchanges []string `url:"exchanges,omitempty"`
	Limit     *int     `url:"limit,omitempty"`
}

CoinsMarketsParams holds the optional parameters for CoinsMarkets.

type ETFFlowParams

type ETFFlowParams struct {
	Interval string `url:"interval"`
	Limit    *int   `url:"limit,omitempty"`
}

ETFFlowParams holds parameters for ETF flow history endpoints.

type ETFFlowPoint

type ETFFlowPoint struct {
	Timestamp    int64   `json:"t"`
	NetFlow      float64 `json:"netFlow"`
	TotalInflow  float64 `json:"totalInflow"`
	TotalOutflow float64 `json:"totalOutflow"`
}

ETFFlowPoint represents a single ETF flow history point.

type ETFItem

type ETFItem struct {
	Ticker   string  `json:"ticker"`
	Name     string  `json:"name"`
	Holdings float64 `json:"holdings"`
}

ETFItem represents a single ETF listing entry.

type ETFNetAssetsParams

type ETFNetAssetsParams struct {
	Interval string `url:"interval"`
	Limit    *int   `url:"limit,omitempty"`
}

ETFNetAssetsParams holds parameters for BitcoinNetAssetsHistory.

type ETFNetAssetsPoint

type ETFNetAssetsPoint struct {
	Timestamp int64   `json:"t"`
	NetAssets float64 `json:"netAssets"`
}

ETFNetAssetsPoint represents a single ETF net-assets history point.

type ETFService

type ETFService struct {
	// contains filtered or unexported fields
}

ETFService provides access to all Coinglass ETF endpoints.

func (*ETFService) BitcoinFlowHistory

func (s *ETFService) BitcoinFlowHistory(ctx context.Context, params *ETFFlowParams) ([]ETFFlowPoint, error)

BitcoinFlowHistory returns Bitcoin ETF flow history.

func (*ETFService) BitcoinList

func (s *ETFService) BitcoinList(ctx context.Context) ([]ETFItem, error)

BitcoinList returns the list of Bitcoin ETFs.

func (*ETFService) BitcoinNetAssetsHistory

func (s *ETFService) BitcoinNetAssetsHistory(ctx context.Context, params *ETFNetAssetsParams) ([]ETFNetAssetsPoint, error)

BitcoinNetAssetsHistory returns Bitcoin ETF net assets history.

func (*ETFService) EthereumFlowHistory

func (s *ETFService) EthereumFlowHistory(ctx context.Context, params *ETFFlowParams) ([]ETFFlowPoint, error)

EthereumFlowHistory returns Ethereum ETF flow history.

func (*ETFService) EthereumList

func (s *ETFService) EthereumList(ctx context.Context) ([]ETFItem, error)

EthereumList returns the list of Ethereum ETFs.

func (*ETFService) GrayscaleHoldings

func (s *ETFService) GrayscaleHoldings(ctx context.Context) ([]GrayscaleHolding, error)

GrayscaleHoldings returns the Grayscale holdings list.

type ExchangePair

type ExchangePair struct {
	Exchange string `json:"exchange"`
	Symbol   string `json:"symbol"`
	Pair     string `json:"pair"`
}

ExchangePair describes a single futures exchange + symbol pair.

type FearGreedParams

type FearGreedParams struct {
	Limit *int `url:"limit,omitempty"`
}

FearGreedParams holds optional parameters for FearGreedHistory.

type FearGreedPoint

type FearGreedPoint struct {
	Value          int    `json:"value"`
	Classification string `json:"classification"`
	Timestamp      int64  `json:"t"`
}

FearGreedPoint represents a single Fear & Greed Index history point.

type FundingRateArbitrageParams

type FundingRateArbitrageParams struct {
	Symbol   *string `url:"symbol,omitempty"`
	Interval *string `url:"interval,omitempty"`
	Limit    *int    `url:"limit,omitempty"`
}

FundingRateArbitrageParams holds optional parameters for FundingRateArbitrage.

type FundingRateExchange

type FundingRateExchange struct {
	Exchange    string  `json:"exchange"`
	FundingRate float64 `json:"fundingRate"`
	Timestamp   int64   `json:"t"`
}

FundingRateExchange represents funding-rate data for a specific exchange.

type FundingRateExchangeListParams

type FundingRateExchangeListParams struct {
	Symbol    string  `url:"symbol"`
	Interval  string  `url:"interval"`
	Limit     *int    `url:"limit,omitempty"`
	StartTime *int64  `url:"startTime,omitempty"`
	EndTime   *int64  `url:"endTime,omitempty"`
	Exchange  *string `url:"exchange,omitempty"`
}

FundingRateExchangeListParams holds parameters for FundingRateExchangeList.

type FundingRateHistoryParams

type FundingRateHistoryParams struct {
	Symbol    string `url:"symbol"`
	Interval  string `url:"interval"`
	Limit     *int   `url:"limit,omitempty"`
	StartTime *int64 `url:"startTime,omitempty"`
	EndTime   *int64 `url:"endTime,omitempty"`
}

FundingRateHistoryParams holds parameters for FundingRateHistory.

type FundingRatePoint

type FundingRatePoint struct {
	FundingRate              float64 `json:"fundingRate"`
	FundingRateAnnualPercent float64 `json:"fundingRateAnnualPercent"`
	Timestamp                int64   `json:"t"`
}

FundingRatePoint represents a single funding-rate OHLC point.

type FuturesService

type FuturesService struct {
	// contains filtered or unexported fields
}

FuturesService provides access to all Coinglass futures endpoints.

func (*FuturesService) CoinsMarkets

func (s *FuturesService) CoinsMarkets(ctx context.Context, params *CoinsMarketsParams) ([]CoinMarket, error)

CoinsMarkets returns futures coin markets.

func (*FuturesService) FundingRateArbitrage

func (s *FuturesService) FundingRateArbitrage(ctx context.Context, params *FundingRateArbitrageParams) ([]ArbitrageItem, error)

FundingRateArbitrage returns funding-rate arbitrage opportunities.

func (*FuturesService) FundingRateExchangeList

func (s *FuturesService) FundingRateExchangeList(ctx context.Context, params *FundingRateExchangeListParams) ([]FundingRateExchange, error)

FundingRateExchangeList returns funding-rate history grouped by exchange.

func (*FuturesService) FundingRateHistory

func (s *FuturesService) FundingRateHistory(ctx context.Context, params *FundingRateHistoryParams) ([]FundingRatePoint, error)

FundingRateHistory returns funding-rate OHLC history.

func (*FuturesService) FundingRateOiWeighted

func (s *FuturesService) FundingRateOiWeighted(ctx context.Context, params *FundingRateHistoryParams) ([]FundingRatePoint, error)

FundingRateOiWeighted returns OI-weighted funding-rate OHLC history.

func (*FuturesService) LargeOrders

func (s *FuturesService) LargeOrders(ctx context.Context, params *LargeOrdersParams) ([]LargeOrder, error)

LargeOrders returns large limit orders from the orderbook.

func (*FuturesService) LiquidationAggregatedHistory

func (s *FuturesService) LiquidationAggregatedHistory(ctx context.Context, params *LiquidationAggregatedHistoryParams) ([]LiquidationPoint, error)

LiquidationAggregatedHistory returns aggregated coin liquidation history.

func (*FuturesService) LiquidationCoinList

func (s *FuturesService) LiquidationCoinList(ctx context.Context, params *LiquidationCoinListParams) ([]LiquidationCoin, error)

LiquidationCoinList returns the liquidation coin list.

func (*FuturesService) LiquidationHeatmap

func (s *FuturesService) LiquidationHeatmap(ctx context.Context, model int, params *LiquidationHeatmapParams) (*LiquidationHeatmap, error)

LiquidationHeatmap returns a liquidation heatmap for the requested model (1, 2 or 3).

func (*FuturesService) LiquidationHistory

func (s *FuturesService) LiquidationHistory(ctx context.Context, params *LiquidationHistoryParams) ([]LiquidationPoint, error)

LiquidationHistory returns pair liquidation history.

func (*FuturesService) LiquidationMap

func (s *FuturesService) LiquidationMap(ctx context.Context, params *LiquidationMapParams) (*LiquidationMap, error)

LiquidationMap returns the liquidation map for a symbol/pair.

func (*FuturesService) LongShortRatioHistory

func (s *FuturesService) LongShortRatioHistory(ctx context.Context, params *LongShortRatioParams) ([]LongShortPoint, error)

LongShortRatioHistory returns the global long/short account ratio history.

func (*FuturesService) OpenInterestAggregatedHistory

func (s *FuturesService) OpenInterestAggregatedHistory(ctx context.Context, params *OIHistoryParams) ([]OIHistoryPoint, error)

OpenInterestAggregatedHistory returns aggregated OHLC open-interest history.

func (*FuturesService) OpenInterestExchangeList

func (s *FuturesService) OpenInterestExchangeList(ctx context.Context, params *OIExchangeListParams) ([]OIExchangeItem, error)

OpenInterestExchangeList returns open-interest history grouped by exchange.

func (*FuturesService) OpenInterestHistory

func (s *FuturesService) OpenInterestHistory(ctx context.Context, params *OIHistoryParams) ([]OIHistoryPoint, error)

OpenInterestHistory returns OHLC open-interest history for a symbol and interval.

func (*FuturesService) OrderbookHistory

func (s *FuturesService) OrderbookHistory(ctx context.Context, params *OrderbookHistoryParams) ([]OrderbookPoint, error)

OrderbookHistory returns orderbook heatmap history.

func (*FuturesService) PairsMarkets

func (s *FuturesService) PairsMarkets(ctx context.Context, params *PairsMarketsParams) ([]PairMarket, error)

PairsMarkets returns futures pair markets.

func (*FuturesService) PriceChangeList

func (s *FuturesService) PriceChangeList(ctx context.Context) ([]PriceChangeItem, error)

PriceChangeList returns the futures price change list.

func (*FuturesService) SupportedCoins

func (s *FuturesService) SupportedCoins(ctx context.Context) ([]string, error)

SupportedCoins returns the list of coins supported by Coinglass futures.

func (*FuturesService) SupportedExchangePairs

func (s *FuturesService) SupportedExchangePairs(ctx context.Context, params *SupportedExchangePairsParams) (map[string][]ExchangePair, error)

SupportedExchangePairs returns the supported futures exchange pairs, optionally filtered by a single exchange.

func (*FuturesService) TakerBuySellHistory

func (s *FuturesService) TakerBuySellHistory(ctx context.Context, params *TakerBuySellHistoryParams) ([]TakerBuySellPoint, error)

TakerBuySellHistory returns futures taker buy/sell volume history.

func (*FuturesService) TopLongShortRatioHistory

func (s *FuturesService) TopLongShortRatioHistory(ctx context.Context, params *LongShortRatioParams) ([]LongShortPoint, error)

TopLongShortRatioHistory returns the top trader long/short account ratio history.

func (*FuturesService) WhaleAlert

func (s *FuturesService) WhaleAlert(ctx context.Context, params *WhaleAlertParams) ([]WhaleAlert, error)

WhaleAlert returns the Hyperliquid whale alert feed.

type GrayscaleHolding

type GrayscaleHolding struct {
	Symbol   string  `json:"symbol"`
	Asset    string  `json:"asset"`
	Holdings float64 `json:"holdings"`
	ValueUsd float64 `json:"valueUsd"`
}

GrayscaleHolding represents a single Grayscale holdings entry.

type IndicatorsService

type IndicatorsService struct {
	// contains filtered or unexported fields
}

IndicatorsService provides access to Coinglass market-indicator endpoints.

func (*IndicatorsService) BasisHistory

func (s *IndicatorsService) BasisHistory(ctx context.Context, params *BasisHistoryParams) ([]BasisPoint, error)

BasisHistory returns the futures basis history.

func (*IndicatorsService) BitcoinRainbowChart

func (s *IndicatorsService) BitcoinRainbowChart(ctx context.Context) (*RainbowChart, error)

BitcoinRainbowChart returns the Bitcoin rainbow chart data.

func (*IndicatorsService) CoinbasePremium

func (s *IndicatorsService) CoinbasePremium(ctx context.Context, params *CoinbasePremiumParams) ([]PremiumPoint, error)

CoinbasePremium returns the Coinbase premium index history.

func (*IndicatorsService) FearGreedHistory

func (s *IndicatorsService) FearGreedHistory(ctx context.Context, params *FearGreedParams) ([]FearGreedPoint, error)

FearGreedHistory returns the Fear & Greed Index history.

func (*IndicatorsService) RSIList

func (s *IndicatorsService) RSIList(ctx context.Context, params *RSIListParams) ([]RSIItem, error)

RSIList returns the futures RSI list.

func (*IndicatorsService) StablecoinMarketCap

func (s *IndicatorsService) StablecoinMarketCap(ctx context.Context, params *StablecoinMarketCapParams) ([]StablecoinPoint, error)

StablecoinMarketCap returns the stablecoin market-cap history.

func (*IndicatorsService) StockToFlow

func (s *IndicatorsService) StockToFlow(ctx context.Context) (*StockToFlow, error)

StockToFlow returns the stock-to-flow model data.

type LargeOrder

type LargeOrder struct {
	Symbol    string  `json:"symbol"`
	Exchange  string  `json:"exchange"`
	Side      string  `json:"side"`
	Price     float64 `json:"price"`
	Size      float64 `json:"size"`
	ValueUsd  float64 `json:"valueUsd"`
	Timestamp int64   `json:"t"`
}

LargeOrder represents a large limit order in the orderbook.

type LargeOrdersParams

type LargeOrdersParams struct {
	Symbol   string `url:"symbol"`
	Exchange string `url:"exchange"`
	Interval string `url:"interval"`
	Limit    *int   `url:"limit,omitempty"`
}

LargeOrdersParams holds parameters for LargeOrders.

type LiquidationAggregatedHistoryParams

type LiquidationAggregatedHistoryParams struct {
	Symbol    string `url:"symbol"`
	Interval  string `url:"interval"`
	Limit     *int   `url:"limit,omitempty"`
	StartTime *int64 `url:"startTime,omitempty"`
	EndTime   *int64 `url:"endTime,omitempty"`
}

LiquidationAggregatedHistoryParams holds parameters for LiquidationAggregatedHistory.

type LiquidationCoin

type LiquidationCoin struct {
	Symbol         string  `json:"symbol"`
	Exchange       string  `json:"exchange"`
	LiquidationUsd float64 `json:"liquidationUsd"`
	Timestamp      int64   `json:"t"`
}

LiquidationCoin represents a liquidation coin list entry.

type LiquidationCoinListParams

type LiquidationCoinListParams struct {
	Symbol *string `url:"symbol,omitempty"`
	Limit  *int    `url:"limit,omitempty"`
}

LiquidationCoinListParams holds optional parameters for LiquidationCoinList.

type LiquidationHeatmap

type LiquidationHeatmap struct {
	Model int                       `json:"model"`
	Data  []LiquidationHeatmapPoint `json:"data"`
	Raw   json.RawMessage           `json:"-"`
}

LiquidationHeatmap is the modelled liquidation heatmap response.

type LiquidationHeatmapParams

type LiquidationHeatmapParams struct {
	Symbol   string `url:"symbol"`
	Interval string `url:"interval"`
	Limit    *int   `url:"limit,omitempty"`
}

LiquidationHeatmapParams holds parameters for LiquidationHeatmap.

type LiquidationHeatmapPoint

type LiquidationHeatmapPoint struct {
	Price          float64 `json:"price"`
	LiquidationUsd float64 `json:"liquidationUsd"`
}

LiquidationHeatmapPoint is one bucket in a liquidation heatmap.

type LiquidationHistoryParams

type LiquidationHistoryParams struct {
	Symbol    string `url:"symbol"`
	Pair      string `url:"pair"`
	Interval  string `url:"interval"`
	Limit     *int   `url:"limit,omitempty"`
	StartTime *int64 `url:"startTime,omitempty"`
	EndTime   *int64 `url:"endTime,omitempty"`
}

LiquidationHistoryParams holds parameters for LiquidationHistory.

type LiquidationMap

type LiquidationMap struct {
	Symbol string          `json:"symbol"`
	Data   json.RawMessage `json:"data"`
	Raw    json.RawMessage `json:"-"`
}

LiquidationMap represents the liquidation map response.

type LiquidationMapParams

type LiquidationMapParams struct {
	Symbol   string `url:"symbol"`
	Pair     string `url:"pair"`
	Interval string `url:"interval"`
	Limit    *int   `url:"limit,omitempty"`
}

LiquidationMapParams holds parameters for LiquidationMap.

type LiquidationPoint

type LiquidationPoint struct {
	BuyQty     float64 `json:"buyQty"`
	SellQty    float64 `json:"sellQty"`
	BuyAmount  float64 `json:"buyAmount"`
	SellAmount float64 `json:"sellAmount"`
	Timestamp  int64   `json:"t"`
}

LiquidationPoint represents a single liquidation history point.

type LongShortPoint

type LongShortPoint struct {
	LongAccount  float64 `json:"longAccount"`
	ShortAccount float64 `json:"shortAccount"`
	LongRatio    float64 `json:"longRatio"`
	ShortRatio   float64 `json:"shortRatio"`
	Timestamp    int64   `json:"t"`
}

LongShortPoint represents a single long/short account ratio point.

type LongShortRatioParams

type LongShortRatioParams struct {
	Symbol    string  `url:"symbol"`
	Interval  string  `url:"interval"`
	Limit     *int    `url:"limit,omitempty"`
	StartTime *int64  `url:"startTime,omitempty"`
	EndTime   *int64  `url:"endTime,omitempty"`
	Exchange  *string `url:"exchange,omitempty"`
}

LongShortRatioParams holds parameters for long/short ratio history endpoints.

type OIExchangeItem

type OIExchangeItem struct {
	Exchange        string  `json:"exchange"`
	OpenInterest    float64 `json:"openInterest"`
	OpenInterestUsd float64 `json:"openInterestUsd"`
	Timestamp       int64   `json:"t"`
}

OIExchangeItem represents open interest broken down by exchange.

type OIExchangeListParams

type OIExchangeListParams struct {
	Symbol    string  `url:"symbol"`
	Interval  string  `url:"interval"`
	Limit     *int    `url:"limit,omitempty"`
	StartTime *int64  `url:"startTime,omitempty"`
	EndTime   *int64  `url:"endTime,omitempty"`
	Exchange  *string `url:"exchange,omitempty"`
}

OIExchangeListParams holds parameters for OpenInterestExchangeList.

type OIHistoryParams

type OIHistoryParams struct {
	Symbol    string `url:"symbol"`
	Interval  string `url:"interval"`
	Limit     *int   `url:"limit,omitempty"`
	StartTime *int64 `url:"startTime,omitempty"`
	EndTime   *int64 `url:"endTime,omitempty"`
}

OIHistoryParams holds parameters for open-interest history endpoints.

type OIHistoryPoint

type OIHistoryPoint struct {
	OpenInterest    float64 `json:"openInterest"`
	OpenInterestUsd float64 `json:"openInterestUsd"`
	Timestamp       int64   `json:"t"`
}

OIHistoryPoint represents a single open interest OHLC point.

type Option

type Option func(*Client)

Option configures a Client. Options are applied in the order they are passed to NewClient.

func WithBaseURL

func WithBaseURL(url string) Option

WithBaseURL overrides the default Coinglass API base URL (https://open-api-v4.coinglass.com). This is primarily useful for testing against a mock server.

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient sets a custom *http.Client used to perform requests. This allows callers to configure transport-level behaviour such as proxies, TLS settings, or custom RoundTrippers.

func WithRetry

func WithRetry(maxAttempts int, baseDelay time.Duration) Option

WithRetry configures automatic retry behaviour for HTTP 429 (rate limited) responses. maxAttempts is the total number of attempts (including the first one) and baseDelay is the initial backoff delay used for exponential backoff (delay doubles on each subsequent retry unless a Retry-After header is present, in which case that value takes precedence).

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets the timeout applied to the underlying HTTP client for every request made by the Client.

type OptionHistoryParams

type OptionHistoryParams struct {
	Interval  string `url:"interval"`
	Limit     *int   `url:"limit,omitempty"`
	StartTime *int64 `url:"startTime,omitempty"`
	EndTime   *int64 `url:"endTime,omitempty"`
}

OptionHistoryParams holds parameters for options history endpoints.

type OptionInfo

type OptionInfo struct {
	Underlying string          `json:"underlying"`
	Expiry     int64           `json:"expiry"`
	Data       json.RawMessage `json:"data"`
	Raw        json.RawMessage `json:"-"`
}

OptionInfo represents general options information for an underlying.

type OptionMaxPain

type OptionMaxPain struct {
	Underlying string          `json:"underlying"`
	Expiry     int64           `json:"expiry"`
	MaxPain    float64         `json:"maxPain"`
	Data       json.RawMessage `json:"data"`
	Raw        json.RawMessage `json:"-"`
}

OptionMaxPain represents the max-pain analysis for an underlying asset.

type OptionOIPoint

type OptionOIPoint struct {
	Exchange  string  `json:"exchange"`
	TotalOI   float64 `json:"totalOI"`
	Timestamp int64   `json:"t"`
}

OptionOIPoint represents a single exchange open-interest history point.

type OptionParams

type OptionParams struct {
	Underlying string  `url:"underlying"`
	Expiry     *int64  `url:"expiry,omitempty"`
	Interval   *string `url:"interval,omitempty"`
}

OptionParams holds parameters for MaxPain and Info.

type OptionVolPoint

type OptionVolPoint struct {
	Exchange  string  `json:"exchange"`
	TotalVol  float64 `json:"totalVol"`
	Timestamp int64   `json:"t"`
}

OptionVolPoint represents a single exchange volume history point.

type OptionsService

type OptionsService struct {
	// contains filtered or unexported fields
}

OptionsService provides access to all Coinglass options endpoints.

func (*OptionsService) ExchangeOIHistory

func (s *OptionsService) ExchangeOIHistory(ctx context.Context, params *OptionHistoryParams) ([]OptionOIPoint, error)

ExchangeOIHistory returns options exchange open-interest history.

func (*OptionsService) ExchangeVolHistory

func (s *OptionsService) ExchangeVolHistory(ctx context.Context, params *OptionHistoryParams) ([]OptionVolPoint, error)

ExchangeVolHistory returns options exchange volume history.

func (*OptionsService) Info

func (s *OptionsService) Info(ctx context.Context, params *OptionParams) (*OptionInfo, error)

Info returns options information for the given underlying.

func (*OptionsService) MaxPain

func (s *OptionsService) MaxPain(ctx context.Context, params *OptionParams) (*OptionMaxPain, error)

MaxPain returns the option max-pain analysis for the given underlying.

type OrderbookHistoryParams

type OrderbookHistoryParams struct {
	Symbol    string `url:"symbol"`
	Exchange  string `url:"exchange"`
	Interval  string `url:"interval"`
	Limit     *int   `url:"limit,omitempty"`
	StartTime *int64 `url:"startTime,omitempty"`
	EndTime   *int64 `url:"endTime,omitempty"`
}

OrderbookHistoryParams holds parameters for OrderbookHistory.

type OrderbookPoint

type OrderbookPoint struct {
	Price     float64 `json:"price"`
	BidQty    float64 `json:"bidQty"`
	AskQty    float64 `json:"askQty"`
	BidAmount float64 `json:"bidAmount"`
	AskAmount float64 `json:"askAmount"`
	Timestamp int64   `json:"t"`
}

OrderbookPoint represents a single orderbook heatmap point.

type PairMarket

type PairMarket struct {
	Exchange        string  `json:"exchange"`
	Symbol          string  `json:"symbol"`
	Pair            string  `json:"pair"`
	Price           float64 `json:"price"`
	PriceChange24h  float64 `json:"priceChange24h"`
	VolumeUsd24h    float64 `json:"volumeUsd24h"`
	OpenInterestUsd float64 `json:"openInterestUsd"`
}

PairMarket represents a single futures trading pair market snapshot.

type PairsMarketsParams

type PairsMarketsParams struct {
	Symbol   *string `url:"symbol,omitempty"`
	Exchange *string `url:"exchange,omitempty"`
	Limit    *int    `url:"limit,omitempty"`
}

PairsMarketsParams holds the optional parameters for PairsMarkets.

type PremiumPoint

type PremiumPoint struct {
	Premium   float64 `json:"premium"`
	Timestamp int64   `json:"t"`
}

PremiumPoint represents a single Coinbase premium index point.

type PriceChangeItem

type PriceChangeItem struct {
	Symbol    string  `json:"symbol"`
	Change1h  float64 `json:"change1h"`
	Change24h float64 `json:"change24h"`
	Change7d  float64 `json:"change7d"`
}

PriceChangeItem represents a single entry in the price change list.

type PricePoint

type PricePoint struct {
	Open      float64 `json:"open"`
	High      float64 `json:"high"`
	Low       float64 `json:"low"`
	Close     float64 `json:"close"`
	Volume    float64 `json:"volume"`
	Timestamp int64   `json:"t"`
}

PricePoint represents a single OHLC price history point.

type RSIItem

type RSIItem struct {
	Symbol    string  `json:"symbol"`
	Interval  string  `json:"interval"`
	RSI       float64 `json:"rsi"`
	Timestamp int64   `json:"t"`
}

RSIItem represents a single RSI list entry.

type RSIListParams

type RSIListParams struct {
	Symbol   *string `url:"symbol,omitempty"`
	Interval *string `url:"interval,omitempty"`
	Limit    *int    `url:"limit,omitempty"`
}

RSIListParams holds parameters for RSIList.

type RainbowChart

type RainbowChart struct {
	Data json.RawMessage `json:"data"`
	Raw  json.RawMessage `json:"-"`
}

RainbowChart represents the Bitcoin rainbow chart response.

type SpotCoinMarket

type SpotCoinMarket struct {
	Symbol         string  `json:"symbol"`
	Price          float64 `json:"price"`
	PriceChange24h float64 `json:"priceChange24h"`
	VolumeUsd24h   float64 `json:"volumeUsd24h"`
}

SpotCoinMarket represents a single spot coin market snapshot.

type SpotCoinsMarketsParams

type SpotCoinsMarketsParams struct {
	Symbol   *string `url:"symbol,omitempty"`
	Exchange *string `url:"exchange,omitempty"`
	Limit    *int    `url:"limit,omitempty"`
}

SpotCoinsMarketsParams holds optional parameters for CoinsMarkets.

type SpotOrderbookHistoryParams

type SpotOrderbookHistoryParams struct {
	Symbol    string `url:"symbol"`
	Exchange  string `url:"exchange"`
	Interval  string `url:"interval"`
	Limit     *int   `url:"limit,omitempty"`
	StartTime *int64 `url:"startTime,omitempty"`
	EndTime   *int64 `url:"endTime,omitempty"`
}

SpotOrderbookHistoryParams holds parameters for Spot OrderbookHistory.

type SpotPairMarket

type SpotPairMarket struct {
	Exchange       string  `json:"exchange"`
	Symbol         string  `json:"symbol"`
	Pair           string  `json:"pair"`
	Price          float64 `json:"price"`
	PriceChange24h float64 `json:"priceChange24h"`
	VolumeUsd24h   float64 `json:"volumeUsd24h"`
}

SpotPairMarket represents a single spot pair market snapshot.

type SpotPairsMarketsParams

type SpotPairsMarketsParams struct {
	Symbol   *string `url:"symbol,omitempty"`
	Exchange *string `url:"exchange,omitempty"`
	Limit    *int    `url:"limit,omitempty"`
}

SpotPairsMarketsParams holds optional parameters for PairsMarkets.

type SpotPriceHistoryParams

type SpotPriceHistoryParams struct {
	Symbol    string `url:"symbol"`
	Interval  string `url:"interval"`
	Limit     *int   `url:"limit,omitempty"`
	StartTime *int64 `url:"startTime,omitempty"`
	EndTime   *int64 `url:"endTime,omitempty"`
}

SpotPriceHistoryParams holds parameters for PriceHistory.

type SpotService

type SpotService struct {
	// contains filtered or unexported fields
}

SpotService provides access to all Coinglass spot market endpoints.

func (*SpotService) CoinsMarkets

func (s *SpotService) CoinsMarkets(ctx context.Context, params *SpotCoinsMarketsParams) ([]SpotCoinMarket, error)

CoinsMarkets returns spot coin markets.

func (*SpotService) OrderbookHistory

func (s *SpotService) OrderbookHistory(ctx context.Context, params *SpotOrderbookHistoryParams) ([]OrderbookPoint, error)

OrderbookHistory returns the spot orderbook heatmap history.

func (*SpotService) PairsMarkets

func (s *SpotService) PairsMarkets(ctx context.Context, params *SpotPairsMarketsParams) ([]SpotPairMarket, error)

PairsMarkets returns spot pair markets.

func (*SpotService) PriceHistory

func (s *SpotService) PriceHistory(ctx context.Context, params *SpotPriceHistoryParams) ([]PricePoint, error)

PriceHistory returns spot price OHLC history.

func (*SpotService) SupportedCoins

func (s *SpotService) SupportedCoins(ctx context.Context) ([]string, error)

SupportedCoins returns the list of coins supported by Coinglass spot markets.

func (*SpotService) TakerBuySellHistory

func (s *SpotService) TakerBuySellHistory(ctx context.Context, params *SpotTakerBuySellHistoryParams) ([]TakerBuySellPoint, error)

TakerBuySellHistory returns spot taker buy/sell volume history.

type SpotTakerBuySellHistoryParams

type SpotTakerBuySellHistoryParams struct {
	Symbol   string `url:"symbol"`
	Exchange string `url:"exchange"`
	Interval string `url:"interval"`
	Limit    *int   `url:"limit,omitempty"`
}

SpotTakerBuySellHistoryParams holds parameters for Spot TakerBuySellHistory.

type StablecoinMarketCapParams

type StablecoinMarketCapParams struct {
	Limit     *int   `url:"limit,omitempty"`
	StartTime *int64 `url:"startTime,omitempty"`
	EndTime   *int64 `url:"endTime,omitempty"`
}

StablecoinMarketCapParams holds optional parameters for StablecoinMarketCap.

type StablecoinPoint

type StablecoinPoint struct {
	MarketCap float64 `json:"marketCap"`
	Timestamp int64   `json:"t"`
}

StablecoinPoint represents a single stablecoin market-cap history point.

type StockToFlow

type StockToFlow struct {
	Data json.RawMessage `json:"data"`
	Raw  json.RawMessage `json:"-"`
}

StockToFlow represents the stock-to-flow model response.

type SupportedExchangePairsParams

type SupportedExchangePairsParams struct {
	Exchange *string `url:"exchange,omitempty"`
}

SupportedExchangePairsParams holds the optional parameters for SupportedExchangePairs.

type TakerBuySellHistoryParams

type TakerBuySellHistoryParams struct {
	Symbol   string `url:"symbol"`
	Exchange string `url:"exchange"`
	Interval string `url:"interval"`
	Limit    *int   `url:"limit,omitempty"`
}

TakerBuySellHistoryParams holds parameters for TakerBuySellHistory.

type TakerBuySellPoint

type TakerBuySellPoint struct {
	BuyVolume  float64 `json:"buyVolume"`
	SellVolume float64 `json:"sellVolume"`
	Timestamp  int64   `json:"t"`
}

TakerBuySellPoint represents a single taker buy/sell volume point.

type WhaleAlert

type WhaleAlert struct {
	Symbol string  `json:"symbol"`
	Side   string  `json:"side"`
	Size   float64 `json:"size"`
	Price  float64 `json:"price"`
	Time   int64   `json:"time"`
	Link   string  `json:"link"`
}

WhaleAlert represents a Hyperliquid whale alert entry.

type WhaleAlertParams

type WhaleAlertParams struct {
	Symbol   *string `url:"symbol,omitempty"`
	Interval *string `url:"interval,omitempty"`
	Limit    *int    `url:"limit,omitempty"`
}

WhaleAlertParams holds optional parameters for WhaleAlert.

Directories

Path Synopsis
examples
basic command
Package main demonstrates basic usage of the coinglass-go SDK: client initialization, Futures/Spot/Options queries, and error handling.
Package main demonstrates basic usage of the coinglass-go SDK: client initialization, Futures/Spot/Options queries, and error handling.
concurrency command
Package main demonstrates that a coinglass-go Client is safe to share across goroutines, fetching open-interest history for multiple symbols concurrently.
Package main demonstrates that a coinglass-go Client is safe to share across goroutines, fetching open-interest history for multiple symbols concurrently.
etf command
Package main demonstrates ETF and market Indicators usage of the coinglass-go SDK: Bitcoin/Ethereum ETF flows, Grayscale holdings, the Fear & Greed Index, and the Bitcoin rainbow chart.
Package main demonstrates ETF and market Indicators usage of the coinglass-go SDK: Bitcoin/Ethereum ETF flows, Grayscale holdings, the Fear & Greed Index, and the Bitcoin rainbow chart.
websocket command
Package main demonstrates the coinglass-go WebSocket client: connecting, subscribing to the liquidation orders, spot trades, futures trades, and futures ticker channels, and decoding incoming messages.
Package main demonstrates the coinglass-go WebSocket client: connecting, subscribing to the liquidation orders, spot trades, futures trades, and futures ticker channels, and decoding incoming messages.
Package websocket provides a client for the Coinglass real-time WebSocket API (https://docs.coinglass.com/reference/ws-getting-started).
Package websocket provides a client for the Coinglass real-time WebSocket API (https://docs.coinglass.com/reference/ws-getting-started).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL