Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) GetCurrencyInfoById(id string) (result CurrencyInfoMap, err error)
- func (c *Client) GetCurrencyInfoBySymbol(symbol string) (result CurrencyInfoMap, err error)
- func (c *Client) GetCurrencyListingsLatestAll() (result []CurrencyListing, err error)
- func (c *Client) GetCurrencyListingsLatestById(start, limit, convert_id string) (result []CurrencyListing, err error)
- func (c *Client) GetCurrencyListingsLatestBySymbol(start, limit, convert string) (result []CurrencyListing, err error)
- func (c *Client) GetCurrencyMap(lstatus ListingStatus, start, limit, symbol string) (result []CurrencyMap, err error)
- func (c *Client) GetCurrencyMapAllActive() (result []CurrencyMap, err error)
- func (c *Client) GetCurrencyQuotesLatestById(id, convert_id string) (result CurrencyQuoteMap, err error)
- func (c *Client) GetCurrencyQuotesLatestBySymbol(symbol, convert string) (result CurrencyQuoteMap, err error)
- func (c *Client) GetGlobalQuotesLatestById(convert_id string) (result GlobalMetrics, err error)
- func (c *Client) GetGlobalQuotesLatestBySymbol(convert string) (result GlobalMetrics, err error)
- func (c *Client) GetPriceConversionById(amount, id, convert_id string) (result PriceConversion, err error)
- func (c *Client) GetPriceConversionBySymbol(amount, symbol, convert string) (result PriceConversion, err error)
- type ConversionQuote
- type ConversionQuoteMap
- type CurrencyInfo
- type CurrencyInfoMap
- type CurrencyListing
- type CurrencyMap
- type CurrencyPlatform
- type CurrencyQuote
- type CurrencyQuoteMap
- type CurrencyUrls
- type GlobalMetrics
- type GlobalQuote
- type GlobalQuoteMap
- type ListingStatus
- type PriceConversion
- type Response
- type ResponseStatus
Constants ¶
const ( ApiDomain = "https://pro-api.coinmarketcap.com" ApiVersion = "v1" ApiRequestTimeout = 30 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewCustom ¶
NewCustom returns an instantiated Client struct with custom properties.
e.g. NewCustom(apiKey, apiDomain, apiVersion, &http.Client{}, time.Minute)
func (*Client) GetCurrencyInfoById ¶
func (c *Client) GetCurrencyInfoById(id string) (result CurrencyInfoMap, err error)
GetCurrencyInfoById returns all static metadata available for one or more cryptocurrencies.
This information includes details like logo, description, official website URL, social links, and links to a cryptocurrency's technical documentation.
func (*Client) GetCurrencyInfoBySymbol ¶
func (c *Client) GetCurrencyInfoBySymbol(symbol string) (result CurrencyInfoMap, err error)
GetCurrencyInfoBySymbol acts identically to GetCurrencyInfoById, except that it uses symbol instead of id as query parameter.
func (*Client) GetCurrencyListingsLatestAll ¶
func (c *Client) GetCurrencyListingsLatestAll() (result []CurrencyListing, err error)
GetCurrencyListingsLatestAll acts identically to GetCurrencyListingsLatestById, except that it uses predefined values for query parameters.
func (*Client) GetCurrencyListingsLatestById ¶
func (c *Client) GetCurrencyListingsLatestById( start, limit, convert_id string) (result []CurrencyListing, err error)
GetCurrencyListingsLatestById returns a paginated list of all active cryptocurrencies with latest market data. The default "market_cap" sort returns cryptocurrency in order of CoinMarketCap's market cap rank.
func (*Client) GetCurrencyListingsLatestBySymbol ¶
func (c *Client) GetCurrencyListingsLatestBySymbol( start, limit, convert string) (result []CurrencyListing, err error)
GetCurrencyListingsLatestBySymbol acts identically to GetCurrencyListingsLatestById, except that it uses symbols for convert parameter instead of ids.
func (*Client) GetCurrencyMap ¶
func (c *Client) GetCurrencyMap( lstatus ListingStatus, start, limit, symbol string) (result []CurrencyMap, err error)
GetCurrencyMap returns a mapping of cryptocurrencies to unique CoinMarketCap ids.
Per best practices it recommends to utilizing ID instead of cryptocurrency symbols to securely identify cryptocurrencies with other endpoints and in application logic.
func (*Client) GetCurrencyMapAllActive ¶
func (c *Client) GetCurrencyMapAllActive() (result []CurrencyMap, err error)
GetCurrencyMapAllActive acts identically to GetCurrencyMap, except that it uses predefined values for query parameters.
func (*Client) GetCurrencyQuotesLatestById ¶
func (c *Client) GetCurrencyQuotesLatestById( id, convert_id string) (result CurrencyQuoteMap, err error)
GetCurrencyQuotesLatestById returns the latest market quote for 1 or more cryptocurrencies.
func (*Client) GetCurrencyQuotesLatestBySymbol ¶
func (c *Client) GetCurrencyQuotesLatestBySymbol( symbol, convert string) (result CurrencyQuoteMap, err error)
GetCurrencyQuotesLatestBySymbol acts identically to GetCurrencyQuotesLatestById, except that it uses symbols instead of ids.
func (*Client) GetGlobalQuotesLatestById ¶
func (c *Client) GetGlobalQuotesLatestById(convert_id string) (result GlobalMetrics, err error)
GetGlobalQuotesLatestById returns the latest global cryptocurrency market metrics.
Use the "convert_id" to return market values in multiple fiat and cryptocurrency conversions in the same call.
func (*Client) GetGlobalQuotesLatestBySymbol ¶
func (c *Client) GetGlobalQuotesLatestBySymbol(convert string) (result GlobalMetrics, err error)
GetGlobalQuotesLatestBySymbol acts identically to GetGlobalQuotesLatestById, except that it uses convert instead of convert_id as query parameter.
func (*Client) GetPriceConversionById ¶
func (c *Client) GetPriceConversionById( amount, id, convert_id string) (result PriceConversion, err error)
GetPriceConversionById converts an amount of one cryptocurrency or fiat currency into one or more different currencies utilizing the latest market rate for each currency.
func (*Client) GetPriceConversionBySymbol ¶
func (c *Client) GetPriceConversionBySymbol( amount, symbol, convert string) (result PriceConversion, err error)
GetPriceConversionBySymbol acts identically to GetPriceConversionById, except that it uses convert and symbol instead of convert_id and id as query parameters.
type ConversionQuote ¶
type ConversionQuote struct { Price float64 `json:"price"` LastUpdated jsonTime `json:"last_updated"` }
type ConversionQuoteMap ¶
type ConversionQuoteMap map[string]ConversionQuote
type CurrencyInfo ¶
type CurrencyInfo struct { Id int `json:"id"` Name string `json:"name"` Symbol string `json:"symbol"` Category string `json:"category"` Slug string `json:"slug"` Logo string `json:"logo"` Description string `json:"description"` DateAdded jsonTime `json:"date_added"` Notice string `json:"notice"` Tags []string `json:"tags"` Platform *CurrencyPlatform `json:"platform"` Urls *CurrencyUrls `json:"urls"` }
type CurrencyInfoMap ¶
type CurrencyInfoMap map[string]CurrencyInfo
type CurrencyListing ¶
type CurrencyListing struct { Id int `json:"id"` Name string `json:"name"` Symbol string `json:"symbol"` Slug string `json:"slug"` CmcRank int `json:"cmc_rank"` NumMarketPairs int `json:"num_market_pairs,omitempty"` CirculatingSupply float64 `json:"circulating_supply"` TotalSupply float64 `json:"total_supply"` MarketCapByTotalSupply float64 `json:"market_cap_by_total_supply,omitempty"` MaxSupply float64 `json:"max_supply"` LastUpdated jsonTime `json:"last_updated"` DateAdded jsonTime `json:"date_added"` Tags []string `json:"tags"` Platform *CurrencyPlatform `json:"platform"` Quote *CurrencyQuoteMap `json:"quote"` }
type CurrencyMap ¶
type CurrencyMap struct { Id int `json:"id"` Name string `json:"name"` Symbol string `json:"symbol"` Slug string `json:"slug"` IsActive int `json:"is_active"` FirstHistoricalData jsonTime `json:"first_historical_data"` LastHistoricalData jsonTime `json:"last_historical_data"` Platform *CurrencyPlatform `json:"platform"` }
type CurrencyPlatform ¶
type CurrencyQuote ¶
type CurrencyQuote struct { Price float64 `json:"price"` Volume24h float64 `json:"volume_24h"` Volume24hReported float64 `json:"volume_24h_reported,omitempty"` Volume7d float64 `json:"volume_7d,omitempty"` Volume7dReported float64 `json:"volume_7d_reported,omitempty"` Volume30d float64 `json:"volume_30d,omitempty"` Volume30dReported float64 `json:"volume_30d_reported,omitempty"` MarketCap float64 `json:"market_cap"` PercentChange1h float64 `json:"percent_change_1h"` PercentChange24h float64 `json:"percent_change_24h"` PercentChange7d float64 `json:"percent_change_7d"` LastUpdated jsonTime `json:"last_updated"` }
type CurrencyQuoteMap ¶
type CurrencyQuoteMap map[string]CurrencyQuote
type CurrencyUrls ¶
type CurrencyUrls struct { Website []string `json:"website"` TechnicalDoc []string `json:"technical_doc"` Explorer []string `json:"explorer"` SourceCode []string `json:"source_code"` MessageBoard []string `json:"message_board"` Chat []string `json:"chat"` Announcement []string `json:"announcement"` Reddit []string `json:"reddit"` Twitter []string `json:"twitter"` }
type GlobalMetrics ¶
type GlobalMetrics struct { BtcDominance float64 `json:"btc_dominance"` EthDominance float64 `json:"eth_dominance"` ActiveCryptocurrencies int `json:"active_cryptocurrencies"` TotalCryptocurrencies int `json:"total_cryptocurrencies"` ActiveMarketPairs int `json:"active_market_pairs"` ActiveExchanges int `json:"active_exchanges"` TotalExchanges int `json:"total_exchanges"` LastUpdated jsonTime `json:"last_updated"` Quote *GlobalQuoteMap `json:"quote"` }
type GlobalQuote ¶
type GlobalQuote struct { TotalMarketCap float64 `json:"total_market_cap"` TotalVolume24h float64 `json:"total_volume_24h"` TotalVolume24hReported float64 `json:"total_volume_24h_reported"` AltcoinVolume24h float64 `json:"altcoin_volume_24h"` AltcoinVolume24hReported float64 `json:"altcoin_volume_24h_reported"` AltcoinMarketCap float64 `json:"altcoin_market_cap"` LastUpdated jsonTime `json:"last_updated"` }
type GlobalQuoteMap ¶
type GlobalQuoteMap map[string]GlobalQuote
type ListingStatus ¶
type ListingStatus string
const ( ListingActive ListingStatus = "active" ListingInactive ListingStatus = "inactive" ListingUntracked ListingStatus = "untracked" )
type PriceConversion ¶
type PriceConversion struct { Id int `json:"id"` Name string `json:"name"` Symbol string `json:"symbol"` Amount float64 `json:"amount"` LastUpdated jsonTime `json:"last_updated"` Quote *ConversionQuoteMap `json:"quote"` }
type Response ¶
type Response struct { Data json.RawMessage `json:"data"` Status ResponseStatus `json:"status"` }