Versions in this module Expand all Collapse all v3 v3.2.0 Jul 4, 2026 Changes in this version + const BaseURL + var ErrInvalidAuthMode = errors.New("invalid websocket auth mode") + var ErrInvalidOHLCVInterval = errors.New("invalid ohlcv interval") + var ErrInvalidOHLCVToken = errors.New("invalid ohlcv token side") + var ErrMissingAPIKey = errors.New("coingecko websocket api key is required") + var ErrMissingTargets = errors.New("at least one subscription target is required") + func FormatSubscriptionTarget(networkID, address string) string + type AuthMode string + const AuthModeHeader + const AuthModeQuery + type CGSimplePriceUpdate struct + ChannelType string + CoinID string + LastUpdatedAt *Number + MarketCapUSD *Number + Price *Number + Price24hChangePercentage *Number + VSCurrency string + Volume24h *Number + func (u *CGSimplePriceUpdate) UnmarshalJSON(data []byte) error + type Channel string + const ChannelCGSimplePrice + const ChannelOnchainOHLCV + const ChannelOnchainSimpleTokenPrice + const ChannelOnchainTrade + type Client struct + func NewClient(apiKey string, opts ...Option) *Client + func (c *Client) Connect(ctx context.Context) (*Conn, error) + type Conn struct + func (c *Conn) Close() error + func (c *Conn) CloseWithStatus(code coderws.StatusCode, reason string) error + func (c *Conn) Raw() *coderws.Conn + func (c *Conn) Read(ctx context.Context) (Message, error) + func (c *Conn) ReadRaw(ctx context.Context) ([]byte, error) + func (c *Conn) SetCGSimplePrice(ctx context.Context, coinIDs []string, vsCurrencies ...string) error + func (c *Conn) SetOnchainOHLCV(ctx context.Context, targets []string, interval OHLCVInterval, ...) error + func (c *Conn) SetOnchainSimpleTokenPrice(ctx context.Context, targets []string) error + func (c *Conn) SetOnchainTrade(ctx context.Context, targets []string) error + func (c *Conn) Subscribe(ctx context.Context, channel Channel) error + func (c *Conn) UnsetCGSimplePrice(ctx context.Context, coinIDs []string, vsCurrencies ...string) error + func (c *Conn) UnsetOnchainOHLCV(ctx context.Context, targets []string, interval OHLCVInterval, ...) error + func (c *Conn) UnsetOnchainSimpleTokenPrice(ctx context.Context, targets []string) error + func (c *Conn) UnsetOnchainTrade(ctx context.Context, targets []string) error + func (c *Conn) Unsubscribe(ctx context.Context, channel Channel) error + type EventMessage struct + Identifier string + Type string + type Message interface + func ParseMessage(data []byte) (Message, error) + type Number float64 + func (n *Number) UnmarshalJSON(data []byte) error + func (n Number) Float64() float64 + type OHLCVInterval string + const OHLCVInterval12h + const OHLCVInterval15m + const OHLCVInterval1d + const OHLCVInterval1h + const OHLCVInterval1m + const OHLCVInterval1s + const OHLCVInterval2h + const OHLCVInterval4h + const OHLCVInterval5m + const OHLCVInterval8h + type OHLCVToken string + const OHLCVTokenBase + const OHLCVTokenQuote + type OnchainOHLCVUpdate struct + ChannelType string + Close *Number + High *Number + Interval OHLCVInterval + Low *Number + NetworkID string + Open *Number + PoolAddress string + Timestamp *Number + Token OHLCVToken + Volume *Number + func (u *OnchainOHLCVUpdate) UnmarshalJSON(data []byte) error + type OnchainSimpleTokenPriceUpdate struct + ChannelType string + LastUpdatedAt *Number + MarketCapUSD *Number + NetworkID string + Price24hChangePercentage *Number + PriceUSD *Number + TokenAddress string + Volume24h *Number + func (u *OnchainSimpleTokenPriceUpdate) UnmarshalJSON(data []byte) error + type OnchainTradeUpdate struct + ChannelType string + LastUpdatedAt *Number + NetworkID string + PoolAddress string + PriceInNativeCurrency *Number + PriceUSD *Number + QuoteTokenAmount *Number + TokenAmount *Number + TradeType string + TransactionHash string + VolumeUSD *Number + func (u *OnchainTradeUpdate) UnmarshalJSON(data []byte) error + type Option func(*Client) + func WithAuthMode(mode AuthMode) Option + func WithHTTPClient(httpClient *http.Client) Option + func WithHeader(header http.Header) Option + func WithURL(rawURL string) Option + type StatusMessage struct + Code int + Message string + type UnknownMessage struct + Raw json.RawMessage