Documentation
¶
Index ¶
Constants ¶
View Source
const UserAgent = "coinmarketcap-go-sdk"
Variables ¶
View Source
var ( // Client initialization errors. ErrEmptyBaseURL = errors.New("base URL cannot be empty") ErrEmptyAPIKey = errors.New("api key cannot be empty") // Request lifecycle errors. ErrNilRequest = errors.New("request is nil") ErrRequestEncode = errors.New("failed to encode request body") // HTTP / transport errors. ErrHTTPFailure = errors.New("http request failed") ErrUnexpectedStatus = errors.New("unexpected http status code") )
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetLatestQuotes ¶
func (c *Client) GetLatestQuotes(ctx context.Context, params *GetLatestQuotesParams) (*LatestQuotesResponse, error)
type CryptocurrencyQuote ¶
type CryptocurrencyQuote struct {
ID int `json:"id"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Slug string `json:"slug"`
NumMarketPairs int `json:"num_market_pairs"`
DateAdded time.Time `json:"date_added"`
Tags []Tag `json:"tags"`
MaxSupply *float64 `json:"max_supply"`
CirculatingSupply float64 `json:"circulating_supply"`
TotalSupply float64 `json:"total_supply"`
Platform *Platform `json:"platform"`
IsActive int `json:"is_active"`
InfiniteSupply bool `json:"infinite_supply"`
MintedMarketCap float64 `json:"minted_market_cap"`
CMCRank int `json:"cmc_rank"`
IsFiat int `json:"is_fiat"`
SelfReportedCirculatingSupply *float64 `json:"self_reported_circulating_supply"`
SelfReportedMarketCap *float64 `json:"self_reported_market_cap"`
TVLRatio *float64 `json:"tvl_ratio"`
LastUpdated time.Time `json:"last_updated"`
Quote map[string]QuoteData `json:"quote"`
}
type GetLatestQuotesParams ¶
type LatestQuotesResponse ¶
type LatestQuotesResponse struct {
Status ResponseStatus `json:"status"`
Data map[string][]CryptocurrencyQuote `json:"-"`
}
type Option ¶
type Option func(*Client)
func WithHTTPClient ¶
func WithHTTPClient(httpClient HTTPClient) Option
func WithLogger ¶
type QuoteData ¶
type QuoteData struct {
Price float64 `json:"price"`
Volume24h float64 `json:"volume_24h"`
VolumeChange24h float64 `json:"volume_change_24h"`
PercentChange1h float64 `json:"percent_change_1h"`
PercentChange24h float64 `json:"percent_change_24h"`
PercentChange7d float64 `json:"percent_change_7d"`
PercentChange30d float64 `json:"percent_change_30d"`
PercentChange60d float64 `json:"percent_change_60d"`
PercentChange90d float64 `json:"percent_change_90d"`
MarketCap float64 `json:"market_cap"`
MarketCapDominance float64 `json:"market_cap_dominance"`
FullyDilutedMarketCap float64 `json:"fully_diluted_market_cap"`
TVL *float64 `json:"tvl"`
LastUpdated time.Time `json:"last_updated"`
}
type ResponseStatus ¶
Click to show internal directories.
Click to hide internal directories.