cryptocurrency

package
v0.0.0-...-3093bb9 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package cryptocurrency is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cryptocurrency

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

func New

func New(executor Executor) *Cryptocurrency

func (*Cryptocurrency) Info

func (c *Cryptocurrency) Info(
	ctx context.Context,
	currencies []currency.Currency,
	withOpts ...InfoOption,
) (*InfoResponse, error)

Info returns all static metadata available for one or more cryptocurrencies. https://coinmarketcap.com/api/documentation/v1/#operation/getV2CryptocurrencyInfo

func (*Cryptocurrency) Map

func (c *Cryptocurrency) Map(
	ctx context.Context,
	withOpts ...MapOption,
) (*MapResponse, error)

Map returns a mapping of all cryptocurrencies to unique CoinMarketCap ids. https://coinmarketcap.com/api/documentation/v1/#operation/getV1CryptocurrencyMap

func (*Cryptocurrency) QuotesLatest

func (c *Cryptocurrency) QuotesLatest(
	ctx context.Context,
	convertFrom []currency.Currency,
	convertTo []currency.Currency,
	withOpts ...QuotesLatestOption,
) (*QuotesLatestResponse, error)

QuotesLatest returns the latest market quote for 1 or more cryptocurrencies. https://coinmarketcap.com/api/documentation/v1/#operation/getV2CryptocurrencyQuotesLatest

type Executor

type Executor interface {
	Get(
		ctx context.Context,
		path string,
		preProcessFn func(req *http.Request) error,
		result any,
	) error
}

type InfoData

type InfoData struct {
	ID                            int              `json:"id"`
	Name                          string           `json:"name"`
	Symbol                        string           `json:"symbol"`
	Category                      string           `json:"category"`
	Slug                          string           `json:"slug"`
	Description                   string           `json:"description"`
	DateAdded                     time.Time        `json:"date_added"`
	DateLaunched                  time.Time        `json:"date_launched"`
	Notice                        string           `json:"notice"`
	Tags                          []any            `json:"tags"`
	Platform                      types.PlatformV2 `json:"platform"`
	SelfReportedCirculatingSupply float64          `json:"self_reported_circulating_supply"`
	SelfReportedMarketCap         float64          `json:"self_reported_market_cap"`
	SelfReportedTags              []any            `json:"self_reported_tags"`
	InfiniteSupply                bool             `json:"infinite_supply"`
	Urls                          InfoUrls         `json:"urls"`
}

type InfoOption

type InfoOption func(opts *infoOptions)

InfoOption info optional param.

func WithInfoAddress

func WithInfoAddress(address string) InfoOption

WithInfoAddress contract address.

func WithInfoAux

func WithInfoAux(fields ...string) InfoOption

WithInfoAux specify a list of supplemental data fields to return. By default "urls,logo,description,tags,platform,date_added,notice".

func WithInfoSkipInvalid

func WithInfoSkipInvalid(skip bool) InfoOption

WithInfoSkipInvalid specify request validation rules. When requesting records on multiple cryptocurrencies an error is returned if no match is found for 1 or more requested cryptocurrencies. If set to true, invalid lookups will be skipped allowing valid cryptocurrencies to still be returned. By default true.

type InfoResponse

type InfoResponse struct {
	Data   map[string]InfoData `json:"data"`
	Status types.Status        `json:"status"`
}

type InfoUrls

type InfoUrls struct {
	Website      []string `json:"website"`
	TechicalDoc  []string `json:"technical_doc"`
	Explored     []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 MapData

type MapData struct {
	ID                  int              `json:"id"`
	Rank                float64          `json:"rank"`
	Name                string           `json:"name"`
	Symbol              string           `json:"symbol"`
	Slug                string           `json:"slug"`
	IsActive            int              `json:"is_active"`
	Status              int              `json:"status"`
	FirstHistoricalData time.Time        `json:"first_historical_data"`
	LastHistoricalData  time.Time        `json:"last_historical_data"`
	Platform            types.PlatformV1 `json:"platform"`
}

type MapOption

type MapOption func(opts *mapOptions)

MapOption map optional param.

func WithMapAux

func WithMapAux(fields ...string) MapOption

WithMapAux specify a list of supplemental data fields to return. By default "platform,first_historical_data,last_historical_data,is_active".

func WithMapLimit

func WithMapLimit(limit int) MapOption

WithMapLimit use this parameter and the "start" parameter to determine your own pagination size.

func WithMapListingStatus

func WithMapListingStatus(status MapStatus) MapOption

WithListingStatus map satatus option. Default "active".

func WithMapSort

func WithMapSort(field MapSortField) MapOption

WithMapSort what field to sort the list of cryptocurrencies by. Default "id".

func WithMapStart

func WithMapStart(start int) MapOption

WithMapStart offset the start (1-based index) of the paginated list of items to return. Default 1.

func WithMapSymbol

func WithMapSymbol(symbols ...string) MapOption

WithMapSymbol list of cryptocurrency symbols to return CoinMarketCap IDs for. If this option is passed, other options will be ignored.

type MapResponse

type MapResponse struct {
	Data   []MapData    `json:"data"`
	Status types.Status `json:"status"`
}

type MapSortField

type MapSortField string
const (
	MapSortID      MapSortField = "id"
	MapSortCMCRank MapSortField = "cmc_rank"
)

func (MapSortField) String

func (m MapSortField) String() string

type MapStatus

type MapStatus string
const (
	MapStatusActive    MapStatus = "active"
	MapStatusInactive  MapStatus = "inactive"
	MapStatusUntracket MapStatus = "untracked"
)

func (MapStatus) String

func (m MapStatus) String() string

type MockExecutor

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

MockExecutor is a mock of Executor interface.

func NewMockExecutor

func NewMockExecutor(ctrl *gomock.Controller) *MockExecutor

NewMockExecutor creates a new mock instance.

func (*MockExecutor) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockExecutor) Get

func (m *MockExecutor) Get(ctx context.Context, path string, preProcessFn func(*http.Request) error, result any) error

Get mocks base method.

type MockExecutorMockRecorder

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

MockExecutorMockRecorder is the mock recorder for MockExecutor.

func (*MockExecutorMockRecorder) Get

func (mr *MockExecutorMockRecorder) Get(ctx, path, preProcessFn, result any) *gomock.Call

Get indicates an expected call of Get.

type Quote

type Quote struct {
	Price                 float64   `json:"price"`
	Volume24h             float64   `json:"volume_24h"`
	VolumeChange24h       float64   `json:"volume_change_24h"`
	Volume24hReported     float64   `json:"volume_24h_reported"`
	Volume7d              float64   `json:"volume_7d"`
	Volume7dReported      float64   `json:"volume_7d_reported"`
	Volume30d             float64   `json:"volume_30d"`
	MarketCap             float64   `json:"market_cap"`
	MarketCapDominance    float64   `json:"market_cap_dominance"`
	FullyDilutedMarketCap float64   `json:"fully_diluted_market_cap"`
	PercentChange1h       float64   `json:"percent_change_1h"`
	PercentChange24h      float64   `json:"percent_change_24h"`
	PercentChange7d       float64   `json:"percent_change_7d"`
	PercentChange30d      float64   `json:"percent_change_30d"`
	LastUpdated           time.Time `json:"last_updated"`
}

type QuoteLatestData

type QuoteLatestData struct {
	ID                            int              `json:"id"`
	Name                          string           `json:"name"`
	Symbol                        string           `json:"symbol"`
	Slug                          string           `json:"slug"`
	IsActive                      int              `json:"is_active"`
	IsFiat                        int              `json:"is_fiat"`
	CMCRank                       int              `json:"cmc_rank"`
	NumMarketPairs                int              `json:"num_market_pairs"`
	CirculatingSupply             float64          `json:"circulating_supply"`
	TotalSupply                   float64          `json:"total_supply"`
	MarketCapByTotalSupply        float64          `json:"market_cap_by_total_supply"`
	MaxSupply                     float64          `json:"max_supply"`
	DateAdded                     time.Time        `json:"date_added"`
	Tags                          []any            `json:"tags"`
	Platform                      types.PlatformV2 `json:"platform"`
	LastUpdated                   time.Time        `json:"last_updated"`
	SelfReportedCirculatingSupply float64          `json:"self_reported_circulating_supply"`
	SelfReportedMarketCap         float64          `json:"self_reported_market_cap"`
	Quotes                        map[string]Quote `json:"quote"`
}

type QuotesLatestOption

type QuotesLatestOption func(opts *quotesLatestOptions)

QuotesLatestOption quotes latest optional param.

func WithQLAux

func WithQLAux(fields ...string) QuotesLatestOption

WithQLAux specify a list of supplemental data fields to return. By default "num_market_pairs, cmc_rank, date_added, tags, platform, max_supply, circulating_supply, total_supply, is_active, is_fiat".

func WithQLSkipInvalid

func WithQLSkipInvalid(skip bool) QuotesLatestOption

WithQLSkipInvalid specify request validation rules. When requesting records on multiple cryptocurrencies an error is returned if no match is found for 1 or more requested cryptocurrencies. If set to true, invalid lookups will be skipped allowing valid cryptocurrencies to still be returned. By default true.

type QuotesLatestResponse

type QuotesLatestResponse struct {
	Data   map[string]QuoteLatestData `json:"data"`
	Status types.Status               `json:"status"`
}

func (*QuotesLatestResponse) QuotePrices

func (q *QuotesLatestResponse) QuotePrices(baseSymbol string) map[string]float64

Jump to

Keyboard shortcuts

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