Version: v2.4.0+incompatible Latest Latest

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

Go to latest
Published: Jan 9, 2019 License: MIT Imports: 8 Imported by: 10




This section is empty.


This section is empty.


This section is empty.


type Client

type Client struct {
	Tickers   TickersService
	Search    SearchService
	Coins     CoinsService
	Global    GlobalService
	Tags      TagsService
	People    PeopleService
	Exchanges ExchangesService
	// contains filtered or unexported fields

Client can be used to get data from coinpaprika API.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient creates a new client to work with coinpaprika API.

type Coin

type Coin struct {
	ID       *string `json:"id"`
	Name     *string `json:"name"`
	Symbol   *string `json:"symbol"`
	Rank     *int64  `json:"rank"`
	IsNew    *bool   `json:"is_new"`
	IsActive *bool   `json:"is_active"`

	// Extended information
	Parent            *Parent             `json:"parent"`
	OpenSource        *bool               `json:"open_source"`
	HardwareWallet    *bool               `json:"hardware_wallet"`
	Description       *string             `json:"description"`
	Message           *string             `json:"message"`
	StartedAt         *string             `json:"started_at"`
	DevelopmentStatus *string             `json:"development_status"`
	ProofType         *string             `json:"proof_type"`
	OrgStructure      *string             `json:"org_structure"`
	HashAlgorithm     *string             `json:"hash_algorithm"`
	Whitepaper        *Whitepaper         `json:"whitepaper"`
	Links             map[string][]string `json:"links"`
	LinksExtended     []CoinLink          `json:"links_extended"`
	Tags              []Tag               `json:"tags"`
	Team              []Person            `json:"team"`

Coin stores basic currency information.

type CoinLink struct {
	URL   *string            `json:"url"`
	Type  *string            `json:"type"`
	Stats map[string]float64 `json:"stats"`

CoinLink represents coin link with additional information like statistics or type of the link.

type CoinsService

type CoinsService service

CoinsService is used to get coins information.

func (*CoinsService) GetByID

func (s *CoinsService) GetByID(coinID string) (coin *Coin, err error)

GetByID gets coin by id (eg. btc-bitcoin).

func (*CoinsService) GetEventsByCoinID

func (s *CoinsService) GetEventsByCoinID(coinID string) (events []*Event, err error)

GetEventsByCoinID gets events for a coin by coin id (eg. btc-bitcoin).

func (*CoinsService) GetExchangesByCoinID

func (s *CoinsService) GetExchangesByCoinID(coinID string) (exchanges []*Exchange, err error)

GetExchangesByCoinID gets exchanges for a coin by coin id.

func (*CoinsService) GetHistoricalOHLCVByCoinID

func (s *CoinsService) GetHistoricalOHLCVByCoinID(coinID string, options *HistoricalOHLCVOptions) (entries []*OHLCVEntry, err error)

GetHistoricalOHLCVByCoinID gets historical ohlcv values for a coin by coin id (eg. btc-bitcoin).

func (*CoinsService) GetLatestOHLCVByCoinID

func (s *CoinsService) GetLatestOHLCVByCoinID(coinID string, options *LatestOHLCVOptions) (entries []*OHLCVEntry, err error)

GetLatestOHLCVByCoinID gets latest ohlcv values for a coin by coin id (eg. btc-bitcoin).

func (*CoinsService) GetMarketsByCoinID

func (s *CoinsService) GetMarketsByCoinID(coinID string) (markets []*Market, err error)

GetMarketsByCoinID gets markets for a coin by coin id.

func (*CoinsService) GetTwitterTimelineByCoinID

func (s *CoinsService) GetTwitterTimelineByCoinID(coinID string) (timeline []*Tweet, err error)

GetTwitterTimelineByCoinID gets twitter timeline for a coin by coin id (eg. btc-bitcoin).

func (*CoinsService) List

func (s *CoinsService) List() (coins []*Coin, err error)

List returns list of all active coins listed on coinpaprika.

type Event

type Event struct {
	Date           *string `json:"date"`
	DateTo         *string `json:"date_to"`
	Name           *string `json:"name"`
	Description    *string `json:"description"`
	IsConference   *bool   `json:"is_conference"`
	Link           *string `json:"link"`
	ProofImageLink *string `json:"proof_image_link"`

Event represents event on related to coin.

type Exchange

type Exchange struct {
	ID                     *string                  `json:"id"`
	Name                   *string                  `json:"name"`
	Message                *string                  `json:"message"`
	Active                 *bool                    `json:"active"`
	MarketsDataFetched     *bool                    `json:"markets_data_fetched"`
	Rank                   *int64                   `json:"rank"`
	AdjustedRank           *int64                   `json:"adjusted_rank"`
	ReportedRank           *int64                   `json:"reported_rank"`
	Currencies             *int64                   `json:"currencies"`
	Markets                *int64                   `json:"markets"`
	AdjustedVolume24hShare *float64                 `json:"adjusted_volume_24h_share"`
	Fiats                  []ExchangeFiat           `json:"fiats"`
	Quotes                 map[string]ExchangeQuote `json:"quotes"`
	Links                  map[string][]string      `json:"links"`
	LastUpdated            *string                  `json:"last_updated"`

Exchange represents an exchange.

type ExchangeFiat

type ExchangeFiat struct {
	Name   *string `json:"name"`
	Symbol *string `json:"symbol"`

ExchangeFiat represents fiat traded on exchange.

type ExchangeQuote

type ExchangeQuote struct {
	ReportedVolume24h *float64 `json:"reported_volume_24h"`
	AdjustedVolume24h *float64 `json:"adjusted_volume_24h"`

ExchangeQuote represents exchange volume data in quote currency.

type ExchangesOptions

type ExchangesOptions struct {
	Quote string `url:"quote,omitempty"`

ExchangesOptions specifies optional parameters for exchanges endpoints.

type ExchangesService

type ExchangesService service

ExchangesService is used to get exchanges and markets data.

func (*ExchangesService) GetByID

func (s *ExchangesService) GetByID(exchangeID string, options *ExchangesOptions) (exchange *Exchange, err error)

GetByID gets exchange by ID.

func (*ExchangesService) GetMarketsByExchangeID

func (s *ExchangesService) GetMarketsByExchangeID(exchangeID string, options *MarketsOptions) (markets []*Market, err error)

GetMarketsByExchangeID gets list of markets for an exchange.

func (*ExchangesService) List

func (s *ExchangesService) List(options *ExchangesOptions) (exchanges []*Exchange, err error)

List returns list of all exchanges listed on coinpaprika.

type GlobalService

type GlobalService service

GlobalService is used to get global market overview data

func (*GlobalService) Get

func (s *GlobalService) Get() (g *GlobalStats, err error)

Get gets market overview data.

type GlobalStats

type GlobalStats struct {
	MarketCapUSD               *float64   `json:"market_cap_usd"`
	Volume24hUSD               *float64   `json:"volume_24h_usd"`
	BitcoinDominancePercentage *float64   `json:"bitcoin_dominance_percentage"`
	CryptocurrenciesNumber     *int64     `json:"cryptocurrencies_number"`
	MarketCapATHValue          *float64   `json:"market_cap_ath_value"`
	MarketCapATHDate           *time.Time `json:"market_cap_ath_date"`
	Volume24hATHValue          *float64   `json:"volume_24h_ath_value"`
	Volume24hATHDate           *time.Time `json:"volume_24h_ath_date"`
	MarketCapChange24h         *float64   `json:"market_cap_change_24h"`
	Volume24hChange24h         *float64   `json:"volume_24h_change_24h"`
	LastUpdated                *int64     `json:"last_updated"`

GlobalStats stores global market overview data

type HistoricalOHLCVOptions

type HistoricalOHLCVOptions struct {
	Start time.Time `url:"start"`
	End   time.Time `url:"end,omitempty"`
	Limit int       `url:"limit,omitempty"`
	Quote string    `url:"quote,omitempty"`

HistoricalOHLCVOptions specifies optional parameters for ohlcv historical endpoint.

type ICO

type ICO struct {
	ID     *string `json:"id"`
	Name   *string `json:"name"`
	Symbol *string `json:"symbol"`
	IsNew  *bool   `json:"is_new"`

ICO represents an ICO.

type LatestOHLCVOptions

type LatestOHLCVOptions struct {
	Quote string `url:"quote,omitempty"`

LatestOHLCVOptions specifies optional parameters for ohlcv latest endpoint.

type Market

type Market struct {
	Pair                   *string                `json:"pair"`
	BaseCurrencyID         *string                `json:"base_currency_id"`
	BaseCurrencyName       *string                `json:"base_currency_name"`
	QuoteCurrencyID        *string                `json:"quote_currency_id"`
	QuoteCurrencyName      *string                `json:"quote_currency_name"`
	MarketURL              *string                `json:"market_url"`
	Category               *string                `json:"category"`
	FeeType                *string                `json:"fee_type"`
	Outlier                *bool                  `json:"outlier"`
	ReportedVolume24hShare *float64               `json:"reported_volume_24h_share"`
	Quotes                 map[string]MarketQuote `json:"quotes"`
	LastUpdated            *string                `json:"last_updated"`
	ExchangeID             *string                `json:"exchange_id"`
	ExchangeName           *string                `json:"exchange_name"`
	AdjustedVolume24hShare *float64               `json:"adjusted_volume_24h_share"`

Market represents a market.

type MarketQuote

type MarketQuote struct {
	Price     *float64 `json:"price"`
	Volume24h *float64 `json:"volume_24h"`

MarketQuote represents market price and volume data in quote currency.

type MarketsOptions

type MarketsOptions struct {
	Quote string `url:"quote,omitempty"`

MarketsOptions specifies optional parameters for markets endpoint.

type OHLCVEntry

type OHLCVEntry struct {
	TimeOpen  *time.Time `json:"time_open"`
	TimeClose *time.Time `json:"time_close"`
	Open      *float64   `json:"open"`
	High      *float64   `json:"high"`
	Low       *float64   `json:"low"`
	Close     *float64   `json:"close"`
	Volume    *int64     `json:"volume"`
	MarketCap *int64     `json:"market_cap"`

OHLCVEntry stores OHLCV (open, high, low, close, volume) values for cryptocurrency.

type Parent

type Parent struct {
	ID     *string `json:"id"`
	Name   *string `json:"name"`
	Symbol *string `json:"symbol"`

Parent represents coin parent information.

type PeopleService

type PeopleService service

PeopleService is used to get data about people.

func (*PeopleService) GetByID

func (s *PeopleService) GetByID(personID string) (person *Person, err error)

GetByID gets person by person id (eg. vitalik-buterin).

type Person

type Person struct {
	ID          *string                 `json:"id"`
	Name        *string                 `json:"name"`
	Position    *string                 `json:"position"`
	TeamsCount  *int64                  `json:"teams_count"`
	Description *string                 `json:"description"`
	Positions   []Position              `json:"positions"`
	Links       map[string][]SocialLink `json:"links"`

Person stores information about a person.

type Position

type Position struct {
	CoinID   *string `json:"coin_id"`
	CoinName *string `json:"coin_name"`
	Position *string `json:"position"`

Position represents person position with relation to specific coin.

type Quote

type Quote struct {
	Price               *float64 `json:"price"`
	Volume24h           *float64 `json:"volume_24h"`
	Volume24hChange24h  *float64 `json:"volume_24h_change_24h"`
	MarketCap           *float64 `json:"market_cap"`
	MarketCapChange24h  *float64 `json:"market_cap_change_24h"`
	PercentChange1h     *float64 `json:"percent_change_1h"`
	PercentChange12h    *float64 `json:"percent_change_12h"`
	PercentChange24h    *float64 `json:"percent_change_24h"`
	PercentChange7d     *float64 `json:"percent_change_7d"`
	PercentChange30d    *float64 `json:"percent_change_30d"`
	PercentChange1y     *float64 `json:"percent_change_1y"`
	ATHPrice            *float64 `json:"ath_price"`
	ATHDate             *string  `json:"ath_date"`
	PercentFromPriceATH *float64 `json:"percent_from_price_ath"`

Quote represents coin price data in quote currency.

type SearchOptions

type SearchOptions struct {
	Query string `url:"q"`

	// Comma separated categories to include in search results.
	// Available options: currencies|exchanges|icos|people|tags.
	// Eg. "currencies,exchanges"
	Categories string `url:"c,omitempty"`

	// The number of results per category.
	Limit int `url:"limit,omitempty"`

	Modifier string `url:"modifier,omitempty"`

SearchOptions specifies optional parameters for search endpoint.

type SearchResult

type SearchResult struct {
	Currencies []*Coin     `json:"currencies"`
	ICOS       []*ICO      `json:"icos"`
	Exchanges  []*Exchange `json:"exchanges"`
	People     []*Person   `json:"people"`
	Tags       []*Tag      `json:"tags"`

SearchResult represents a result of search API endpoint.

type SearchService

type SearchService service

SearchService is used for search requests

func (*SearchService) Search

func (s *SearchService) Search(options *SearchOptions) (searchResult *SearchResult, err error)

Search returns a list of currencies, exchanges, icos, people and tags for given query.

type SocialLink struct {
	URL       *string `json:"url"`
	Followers *int64  `json:"followers"`

SocialLink represents a link to social media profile with followers count.

type Tag

type Tag struct {
	ID          *string  `json:"id"`
	Name        *string  `json:"name"`
	CoinCounter *int64   `json:"coin_counter"`
	ICOCounter  *int64   `json:"ico_counter"`
	Description *string  `json:"description"`
	Type        *string  `json:"type"`
	Coins       []string `json:"coins"`
	ICOs        []string `json:"icos"`

Tag represents a tag (related to currency or ico).

type TagsOptions

type TagsOptions struct {
	AdditionalFields string `url:"additional_fields,omitempty"`

TagsOptions specifies optional parameters for tags endpoint.

type TagsService

type TagsService service

TagsService is used for listing and getting tags.

func (*TagsService) GetByID

func (s *TagsService) GetByID(tagID string, options *TagsOptions) (tag *Tag, err error)

GetByID return a tag by id.

func (*TagsService) List

func (s *TagsService) List(options *TagsOptions) (tags []*Tag, err error)

List returns a list of all tags.

type Ticker

type Ticker struct {
	ID                *string          `json:"id"`
	Name              *string          `json:"name"`
	Symbol            *string          `json:"symbol"`
	Rank              *int64           `json:"rank"`
	CirculatingSupply *int64           `json:"circulating_supply"`
	TotalSupply       *int64           `json:"total_supply"`
	MaxSupply         *int64           `json:"max_supply"`
	BetaValue         *float64         `json:"beta_value"`
	LastUpdated       *string          `json:"last_updated"`
	Quotes            map[string]Quote `json:"quotes"`

Ticker represents ticker information.

type TickerHistorical

type TickerHistorical struct {
	Price     *float64   `json:"price"`
	Volume24h *float64   `json:"volume_24h"`
	MarketCap *float64   `json:"market_cap"`
	Timestamp *time.Time `json:"timestamp"`

TickerHistorical represents historical ticker information.

type TickersHistoricalOptions

type TickersHistoricalOptions struct {
	Start    time.Time `url:"start"`
	End      time.Time `url:"end,omitempty"`
	Limit    int       `url:"limit,omitempty"`
	Quote    string    `url:"quote,omitempty"`
	Interval string    `url:"interval,omitempty"`

TickersHistoricalOptions specifies optional parameters for tickers historical endpoint.

type TickersOptions

type TickersOptions struct {
	Quotes string `url:"quotes,omitempty"`

TickersOptions specifies optional parameters for tickers endpoints.

type TickersService

type TickersService service

TickersService is used to get ticker information

func (*TickersService) GetByID

func (s *TickersService) GetByID(coinID string, options *TickersOptions) (ticker *Ticker, err error)

GetByID gets ticker information for specific coin by id (eg. btc-bitcoin).

func (*TickersService) GetHistoricalTickersByID

func (s *TickersService) GetHistoricalTickersByID(coinID string, options *TickersHistoricalOptions) (tickersHistorical []*TickerHistorical, err error)

GetHistoricalTickersByID gets historical ticker information for specific coin by id (eg. btc-bitcoin).

func (*TickersService) List

func (s *TickersService) List(options *TickersOptions) (tickers []*Ticker, err error)

List gets ticker information for all coins listed on coinpaprika.

type Tweet

type Tweet struct {
	Date        *time.Time `json:"date"`
	UserName    *string    `json:"user_name"`
	Status      *string    `json:"status"`
	IsRetweet   *bool      `json:"is_retweet"`
	StatusLink  *string    `json:"status_link"`
	MediaLink   *string    `json:"media_link,omitempty"`
	YoutubeLink *string    `json:"youtube_link,omitempty"`

Tweet represents twitter timeline entry.

type Whitepaper

type Whitepaper struct {
	Link      *string `json:"link"`
	Thumbnail *string `json:"thumbnail"`

Whitepaper represents coin whitepaper.

Jump to

Keyboard shortcuts

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