coinmarketcap

package
v0.0.0-...-b4d4280 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package coinmarketcap provides client code for interacting with the CoinMarketCap API.

Index

Constants

View Source
const (
	SandboxAPIURL    = "https://sandbox-api.coinmarketcap.com"
	SandboxAPIKey    = "b54bcf4d-1bca-4e8e-9a24-22ff2c3d462c"
	ProductionAPIURL = "https://pro-api.coinmarketcap.com"
)
View Source
const (
	STORJ = "STORJ"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CachingClient

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

func NewCachingClient

func NewCachingClient(apiURL, apiKey string, expiry time.Duration) (*CachingClient, error)

func (*CachingClient) GetQuote

func (cli *CachingClient) GetQuote(ctx context.Context, symbol Symbol) (*Quote, error)

type Client

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

func NewClient

func NewClient(apiURL, apiKey string) (*Client, error)

func (*Client) GetQuote

func (cli *Client) GetQuote(ctx context.Context, symbol Symbol) (*Quote, error)

type Quote

type Quote struct {
	Price       decimal.Decimal
	LastUpdated time.Time
}

type Quoter

type Quoter interface {
	GetQuote(ctx context.Context, symbol Symbol) (*Quote, error)
}

type QuoterFunc

type QuoterFunc func(ctx context.Context, symbol Symbol) (*Quote, error)

func (QuoterFunc) GetQuote

func (q QuoterFunc) GetQuote(ctx context.Context, symbol Symbol) (*Quote, error)

type Symbol

type Symbol string

Jump to

Keyboard shortcuts

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