cmc

package
v0.0.0-...-1413895 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CmcAuthVal = "e7f31052-0284-4ad6-8115-e35f2ecc8028"
View Source
const CmcPriceUrl = "https://pro-api.coinmarketcap.com/v2/cryptocurrency/quotes/latest?"
View Source
const CmcUrl = "https://pro-api.coinmarketcap.com/v1/cryptocurrency/map?sort=cmc_rank"

Variables

This section is empty.

Functions

func GetTokenPrice

func GetTokenPrice(symbol string) decimal.Decimal

func SetLogger

func SetLogger(lg interlog.Logger)

Types

type Platform

type Platform struct {
	Id           int64  `json:"id"`
	Name         string `json:"name"`
	Symbol       string `json:"symbol"`
	Slug         string `json:"slug"`
	TokenAddress string `json:"token_address"`
}

type PriceData

type PriceData struct {
	Key1 *PriceDataDetail `json:"1"`
}

type PriceDataDetail

type PriceDataDetail struct {
	Id      int64  `json:"id"`
	Name    string `json:"name"`
	Symbol  string `json:"symbol"`
	Slug    string `json:"slug"`
	CmcRank int64  `json:"cmc_rank"`
	Quote   *Quote `json:"quote"`
}

type PriceStatus

type PriceStatus struct {
	Timestamp    string `json:"timestamp"`
	ErrorCode    int64  `json:"error_code"`
	ErrorMessage string `json:"error_message"`
	Elapsed      int64  `json:"elapsed"`
	CreditCount  int64  `json:"credit_count"`
	Notice       string `json:"notice"`
}

type Quote

type Quote struct {
	USD *QuoteUsd `json:"USD"`
}

type QuoteUsd

type QuoteUsd struct {
	Price            decimal.Decimal `json:"price"`
	Volume24h        decimal.Decimal `json:"volume_24h"`
	PercentChange24h decimal.Decimal `json:"percent_change_24h"`
}

type Status

type Status struct {
	Timestamp    string `json:"timestamp"`
	ErrorCode    int64  `json:"error_code"`
	ErrorMessage string `json:"error_message"`
	Elapsed      int64  `json:"elapsed"`
	CreditCount  int64  `json:"credit_count"`
	Notice       string `json:"notice"`
}

type TokenInfo

type TokenInfo struct {
	Id                  int64     `json:"id"`
	Rank                int64     `json:"rank"`
	Name                string    `json:"name"`
	Symbol              string    `json:"symbol"`
	Slug                string    `json:"slug"`
	IsActive            int64     `json:"is_active"`
	FirstHistoricalData string    `json:"first_historical_data"`
	LastHistoricalData  string    `json:"last_historical_data"`
	Platform            *Platform `json:"platform"`
}

func GetTopToken

func GetTopToken(num int64) []TokenInfo

type TokenPriceResp

type TokenPriceResp struct {
	Data   map[string][]PriceDataDetail `json:"data"`
	Status *PriceStatus                 `json:"status"`
}

type TokenResp

type TokenResp struct {
	Status Status      `json:"status"`
	Data   []TokenInfo `json:"data"`
}

Jump to

Keyboard shortcuts

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