Documentation
¶
Overview ¶
Package coinmarketcap Coin Market Cap API client for Go
Index ¶
- Variables
- type Client
- type Config
- type ConvertListing
- type ConvertOptions
- type ConvertQuote
- type CryptocurrencyInfo
- type CryptocurrencyService
- func (s *CryptocurrencyService) HistoricalOHLCV() error
- func (s *CryptocurrencyService) HistoricalQuotes() error
- func (s *CryptocurrencyService) Info(options *InfoOptions) (map[string]*CryptocurrencyInfo, error)
- func (s *CryptocurrencyService) LatestListings(options *ListingOptions) ([]*Listing, error)
- func (s *CryptocurrencyService) LatestMarketPairs(options *MarketPairOptions) (*MarketPairs, error)
- func (s *CryptocurrencyService) LatestQuotes(options *QuoteOptions) ([]*QuoteLatest, error)
- func (s *CryptocurrencyService) Map(options *MapOptions) ([]*MapListing, error)
- type Exchange
- type ExchangeQuote
- type ExchangeQuotes
- type ExchangeReported
- type ExchangeService
- type FiatMapListing
- type FiatMapOptions
- type FiatService
- type GlobalMetricsService
- type InfoOptions
- type Listing
- type ListingOptions
- type MapListing
- type MapOptions
- type MarketMetrics
- type MarketMetricsQuote
- type MarketPair
- type MarketPairBase
- type MarketPairOptions
- type MarketPairQuote
- type MarketPairs
- type Platform
- type Quote
- type QuoteLatest
- type QuoteOptions
- type Response
- type Status
- type ToolsService
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTypeAssertion is type assertion error ErrTypeAssertion = errors.New("type assertion error") )
var SortOptions sortOptions
SortOptions sort options
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Cryptocurrency *CryptocurrencyService
Fiat *FiatService
Exchange *ExchangeService
GlobalMetrics *GlobalMetricsService
Tools *ToolsService
// contains filtered or unexported fields
}
Client the CoinMarketCap client
type ConvertListing ¶
type ConvertListing struct {
ID int `json:"id"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Amount float64 `json:"amount"`
LastUpdated string `json:"last_updated"`
Quote map[string]*ConvertQuote `json:"quote"`
}
ConvertListing is the converted listing structure
type ConvertOptions ¶
type ConvertOptions struct {
Amount float64
ID string
Symbol string
Time int
Convert string
ConvertID string
}
ConvertOptions options
type ConvertQuote ¶
ConvertQuote is the converted listing structure
type CryptocurrencyInfo ¶
type CryptocurrencyInfo struct {
ID float64 `json:"id"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Category string `json:"category"`
Slug string `json:"slug"`
Logo string `json:"logo"`
Tags []string `json:"tags"`
Urls map[string]interface{} `json:"urls"`
}
CryptocurrencyInfo options
type CryptocurrencyService ¶
type CryptocurrencyService service
CryptocurrencyService ...
func (*CryptocurrencyService) HistoricalOHLCV ¶
func (s *CryptocurrencyService) HistoricalOHLCV() error
HistoricalOHLCV NOT IMPLEMENTED
func (*CryptocurrencyService) HistoricalQuotes ¶
func (s *CryptocurrencyService) HistoricalQuotes() error
HistoricalQuotes NOT IMPLEMENTED
func (*CryptocurrencyService) Info ¶
func (s *CryptocurrencyService) Info(options *InfoOptions) (map[string]*CryptocurrencyInfo, error)
Info returns all static metadata for one or more cryptocurrencies including name, symbol, logo, and its various registered URLs.
func (*CryptocurrencyService) LatestListings ¶
func (s *CryptocurrencyService) LatestListings(options *ListingOptions) ([]*Listing, error)
LatestListings gets a paginated list of all cryptocurrencies with latest market data. You can configure this call to sort by market cap or another market ranking field. Use the "convert" option to return market values in multiple fiat and cryptocurrency conversions in the same call.
func (*CryptocurrencyService) LatestMarketPairs ¶
func (s *CryptocurrencyService) LatestMarketPairs(options *MarketPairOptions) (*MarketPairs, error)
LatestMarketPairs Lists all market pairs across all exchanges for the specified cryptocurrency with associated stats. Use the "convert" option to return market values in multiple fiat and cryptocurrency conversions in the same call.
func (*CryptocurrencyService) LatestQuotes ¶
func (s *CryptocurrencyService) LatestQuotes(options *QuoteOptions) ([]*QuoteLatest, error)
LatestQuotes gets latest quote for each specified symbol. Use the "convert" option to return market values in multiple fiat and cryptocurrency conversions in the same call.
func (*CryptocurrencyService) Map ¶
func (s *CryptocurrencyService) Map(options *MapOptions) ([]*MapListing, error)
Map returns a paginated list of all cryptocurrencies by CoinMarketCap ID.
type ExchangeQuote ¶
type ExchangeQuote struct {
Price float64 `json:"price"`
Volume24 float64 `json:"volume_24h"`
Volume24HBase float64 `json:"volume_24h_base"` // for 'exchange_reported'
Volume24HQuote float64 `json:"volume_24h_quote"` // for 'exchange_reported'
LastUpdated string `json:"last_updated"`
}
ExchangeQuote ...
type ExchangeReported ¶
type ExchangeReported struct {
Price float64 `json:"price"`
Volume24HBase float64 `json:"volume_24h_base"`
Volume24HQuote float64 `json:"volume_24h_quote"`
LastUpdated string `json:"last_updated"`
}
ExchangeReported ...
type ExchangeService ¶
type ExchangeService service
ExchangeService ...
func (*ExchangeService) HistoricalQuotes ¶
func (s *ExchangeService) HistoricalQuotes() error
HistoricalQuotes NOT IMPLEMENTED
func (*ExchangeService) LatestListings ¶
func (s *ExchangeService) LatestListings() error
LatestListings NOT IMPLEMENTED
func (*ExchangeService) LatestMarketPairs ¶
func (s *ExchangeService) LatestMarketPairs() error
LatestMarketPairs NOT IMPLEMENTED
func (*ExchangeService) LatestQuotes ¶
func (s *ExchangeService) LatestQuotes() error
LatestQuotes NOT IMPLEMENTED
type FiatMapListing ¶
type FiatMapListing struct {
ID float64 `json:"id"`
Name string `json:"name"`
Sign string `json:"sign"`
Symbol string `json:"symbol"`
}
FiatMapListing is the structure of a fiat map listing
type FiatMapOptions ¶
FiatMapOptions options
type FiatService ¶
type FiatService service
FiatService ...
func (*FiatService) Map ¶
func (s *FiatService) Map(options *FiatMapOptions) ([]*FiatMapListing, error)
Map returns a paginated list of all cryptocurrencies by CoinMarketCap ID.
type GlobalMetricsService ¶
type GlobalMetricsService service
GlobalMetricsService ...
func (*GlobalMetricsService) HistoricalQuotes ¶
func (s *GlobalMetricsService) HistoricalQuotes() error
HistoricalQuotes NOT IMPLEMENTED
func (*GlobalMetricsService) LatestQuotes ¶
func (s *GlobalMetricsService) LatestQuotes(options *QuoteOptions) (*MarketMetrics, error)
LatestQuotes Get the latest quote of aggregate market metrics. Use the "convert" option to return market values in multiple fiat and cryptocurrency conversions in the same call.
type InfoOptions ¶
InfoOptions options
type Listing ¶
type Listing struct {
ID float64 `json:"id"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Slug string `json:"slug"`
CirculatingSupply float64 `json:"circulating_supply"`
TotalSupply float64 `json:"total_supply"`
MaxSupply float64 `json:"max_supply"`
DateAdded string `json:"date_added"`
NumMarketPairs float64 `json:"num_market_pairs"`
CMCRank float64 `json:"cmc_rank"`
LastUpdated string `json:"last_updated"`
Quote map[string]*Quote `json:"quote"`
}
Listing is the listing structure
type ListingOptions ¶
ListingOptions options
type MapListing ¶
type MapListing struct {
ID float64 `json:"id"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Slug string `json:"slug"`
IsActive int `json:"is_active"`
FirstHistoricalData string `json:"first_historical_data"`
LastHistoricalData string `json:"last_historical_data"`
Platform Platform `json:"platform"`
}
type MapOptions ¶
MapOptions options
type MarketMetrics ¶
type MarketMetrics struct {
BTCDominance float64 `json:"btc_dominance"`
ETHDominance float64 `json:"eth_dominance"`
ActiveCryptocurrencies float64 `json:"active_cryptocurrencies"`
ActiveMarketPairs float64 `json:"active_market_pairs"`
ActiveExchanges float64 `json:"active_exchanges"`
LastUpdated string `json:"last_updated"`
Quote map[string]*MarketMetricsQuote `json:"quote"`
}
MarketMetrics is the market metrics structure
type MarketMetricsQuote ¶
type MarketMetricsQuote struct {
TotalMarketCap float64 `json:"total_market_cap"`
TotalVolume24H float64 `json:"total_volume_24h"`
LastUpdated string `json:"last_updated"`
}
MarketMetricsQuote is the quote structure
type MarketPair ¶
type MarketPair struct {
Exchange *Exchange
MarketPair string `json:"market_pair"`
MarketPairBase *MarketPairBase `json:"market_pair_base"`
MarketPairQuote *MarketPairQuote `json:"market_pair_quote"`
Quote ExchangeQuotes `json:"quote"`
ExchangeReported *ExchangeReported `json:"exchange_reported"`
}
MarketPair ...
type MarketPairBase ¶
type MarketPairBase struct {
CurrencyID int `json:"currency_id"`
CurrencySymbol string `json:"currency_symbol"`
CurrencyType string `json:"currency_type"`
}
MarketPairBase ...
type MarketPairOptions ¶
MarketPairOptions options
type MarketPairQuote ¶
type MarketPairQuote struct {
CurrencyID int `json:"currency_id"`
CurrencySymbol string `json:"currency_symbol"`
CurrencyType string `json:"currency_type"`
}
MarketPairQuote ...
type MarketPairs ¶
type MarketPairs struct {
ID int `json:"id"`
Name string `json:"name"`
Symbol string `json:"symbol"`
NumMarketPairs int `json:"num_market_pairs"`
MarketPairs []*MarketPair `json:"market_pairs"`
}
MarketPairs ...
type Platform ¶
type Platform struct {
ID int `json:"id"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Slug string `json:"slug"`
TokenAddress string `json:"token_address"`
}
MapListing is the structure of a map listing
type Quote ¶
type Quote struct {
Price float64 `json:"price"`
Volume24H float64 `json:"volume_24h"`
PercentChange1H float64 `json:"percent_change_1h"`
PercentChange24H float64 `json:"percent_change_24h"`
PercentChange7D float64 `json:"percent_change_7d"`
MarketCap float64 `json:"market_cap"`
LastUpdated string `json:"last_updated"`
}
Quote is the quote structure
type QuoteLatest ¶
type QuoteLatest struct {
ID float64 `json:"id"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Slug string `json:"slug"`
CirculatingSupply float64 `json:"circulating_supply"`
TotalSupply float64 `json:"total_supply"`
MaxSupply float64 `json:"max_supply"`
DateAdded string `json:"date_added"`
NumMarketPairs float64 `json:"num_market_pairs"`
CMCRank float64 `json:"cmc_rank"`
LastUpdated string `json:"last_updated"`
Quote map[string]*Quote `json:"quote"`
}
QuoteLatest is the quotes structure
type QuoteOptions ¶
type QuoteOptions struct {
// Covert suppots multiple currencies command separated. eg. "BRL,USD"
Convert string
// Symbols suppots multiple tickers command separated. eg. "BTC,ETH,XRP"
Symbol string
}
QuoteOptions options
type Response ¶
type Response struct {
Status Status `json:"status"`
Data interface{} `json:"data"`
}
Response is the response structure
type Status ¶
type Status struct {
Timestamp string `json:"timestamp"`
ErrorCode int `json:"error_code"`
ErrorMessage *string `json:"error_message"`
Elapsed int `json:"elapsed"`
CreditCount int `json:"credit_count"`
}
Status is the status structure
type ToolsService ¶
type ToolsService service
ToolsService ...
func (*ToolsService) PriceConversion ¶
func (s *ToolsService) PriceConversion(options *ConvertOptions) (*ConvertListing, error)
PriceConversion Convert an amount of one currency into multiple cryptocurrencies or fiat currencies at the same time using the latest market averages. Optionally pass a historical timestamp to convert values based on historic averages.