coingecko

package
v0.0.0-...-efbd42f Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoinGeckoAPI

type CoinGeckoAPI struct {
	ApiURL string
	ApiKey string
	// contains filtered or unexported fields
}

func NewCoinGeckoAPI

func NewCoinGeckoAPI(apiKey string) *CoinGeckoAPI

func (*CoinGeckoAPI) GetSymbol

func (cg *CoinGeckoAPI) GetSymbol(ChainId string, ContractId string) (string, error)

func (*CoinGeckoAPI) GetSymbolByContract

func (cg *CoinGeckoAPI) GetSymbolByContract(ChainId string, ContractId string) (*TokenItem, error)

GetSymbolByContract returns the symbol of the token Input: ChaindId is the name of the chain: ie: ethereum, solana, etc Input: ContractId is the contract address of the token (ECR-20 or other)

func (*CoinGeckoAPI) GetSymbolDailyPrice

func (cg *CoinGeckoAPI) GetSymbolDailyPrice(CoinID string) (*CoinHistoryResponse, error)

type CoinHistoryResponse

type CoinHistoryResponse struct {
	Prices       [][]decimal.Decimal `json:"prices"`
	MarketCaps   [][]any             `json:"market_caps"`
	TotalVolumes [][]float64         `json:"total_volumes"`
}

type CoingGeckoPlatform

type CoingGeckoPlatform struct {
	Id              string      `json:"id"`
	ChainIdentifier interface{} `json:"chain_identifier"`
	Name            string      `json:"name"`
	Shortname       string      `json:"shortname"`
}

type TokenData

type TokenData struct {
	ID              string `json:"id"`
	Symbol          string `json:"symbol"`
	Name            string `json:"name"`
	AssetPlatformID string `json:"asset_platform_id"`
	Platforms       struct {
		Avalanche string `json:"avalanche"`
	} `json:"platforms"`
	DetailPlatforms struct {
		Avalanche struct {
			DecimalPlace    int    `json:"decimal_place"`
			ContractAddress string `json:"contract_address"`
		} `json:"avalanche"`
	} `json:"detail_platforms"`
	BlockTimeInMinutes int      `json:"block_time_in_minutes"`
	HashingAlgorithm   any      `json:"hashing_algorithm"`
	Categories         []string `json:"categories"`
	PublicNotice       any      `json:"public_notice"`
	AdditionalNotices  []any    `json:"additional_notices"`
	Localization       struct {
		En   string `json:"en"`
		De   string `json:"de"`
		Es   string `json:"es"`
		Fr   string `json:"fr"`
		It   string `json:"it"`
		Pl   string `json:"pl"`
		Ro   string `json:"ro"`
		Hu   string `json:"hu"`
		Nl   string `json:"nl"`
		Pt   string `json:"pt"`
		Sv   string `json:"sv"`
		Vi   string `json:"vi"`
		Tr   string `json:"tr"`
		Ru   string `json:"ru"`
		Ja   string `json:"ja"`
		Zh   string `json:"zh"`
		ZhTw string `json:"zh-tw"`
		Ko   string `json:"ko"`
		Ar   string `json:"ar"`
		Th   string `json:"th"`
		ID   string `json:"id"`
		Cs   string `json:"cs"`
		Da   string `json:"da"`
		El   string `json:"el"`
		Hi   string `json:"hi"`
		No   string `json:"no"`
		Sk   string `json:"sk"`
		Uk   string `json:"uk"`
		He   string `json:"he"`
		Fi   string `json:"fi"`
		Bg   string `json:"bg"`
		Hr   string `json:"hr"`
		Lt   string `json:"lt"`
		Sl   string `json:"sl"`
	} `json:"localization"`
	Description struct {
		En   string `json:"en"`
		De   string `json:"de"`
		Es   string `json:"es"`
		Fr   string `json:"fr"`
		It   string `json:"it"`
		Pl   string `json:"pl"`
		Ro   string `json:"ro"`
		Hu   string `json:"hu"`
		Nl   string `json:"nl"`
		Pt   string `json:"pt"`
		Sv   string `json:"sv"`
		Vi   string `json:"vi"`
		Tr   string `json:"tr"`
		Ru   string `json:"ru"`
		Ja   string `json:"ja"`
		Zh   string `json:"zh"`
		ZhTw string `json:"zh-tw"`
		Ko   string `json:"ko"`
		Ar   string `json:"ar"`
		Th   string `json:"th"`
		ID   string `json:"id"`
		Cs   string `json:"cs"`
		Da   string `json:"da"`
		El   string `json:"el"`
		Hi   string `json:"hi"`
		No   string `json:"no"`
		Sk   string `json:"sk"`
		Uk   string `json:"uk"`
		He   string `json:"he"`
		Fi   string `json:"fi"`
		Bg   string `json:"bg"`
		Hr   string `json:"hr"`
		Lt   string `json:"lt"`
		Sl   string `json:"sl"`
	} `json:"description"`
	Links struct {
		Homepage                    []string `json:"homepage"`
		BlockchainSite              []string `json:"blockchain_site"`
		OfficialForumURL            []string `json:"official_forum_url"`
		ChatURL                     []string `json:"chat_url"`
		AnnouncementURL             []string `json:"announcement_url"`
		TwitterScreenName           string   `json:"twitter_screen_name"`
		FacebookUsername            string   `json:"facebook_username"`
		BitcointalkThreadIdentifier any      `json:"bitcointalk_thread_identifier"`
		TelegramChannelIdentifier   string   `json:"telegram_channel_identifier"`
		SubredditURL                any      `json:"subreddit_url"`
		ReposURL                    struct {
			Github    []any `json:"github"`
			Bitbucket []any `json:"bitbucket"`
		} `json:"repos_url"`
	} `json:"links"`
	Image struct {
		Thumb string `json:"thumb"`
		Small string `json:"small"`
		Large string `json:"large"`
	} `json:"image"`
	CountryOrigin                string  `json:"country_origin"`
	GenesisDate                  any     `json:"genesis_date"`
	ContractAddress              string  `json:"contract_address"`
	SentimentVotesUpPercentage   any     `json:"sentiment_votes_up_percentage"`
	SentimentVotesDownPercentage any     `json:"sentiment_votes_down_percentage"`
	WatchlistPortfolioUsers      int     `json:"watchlist_portfolio_users"`
	MarketCapRank                int     `json:"market_cap_rank"`
	CoingeckoRank                int     `json:"coingecko_rank"`
	CoingeckoScore               float64 `json:"coingecko_score"`
	//	DeveloperScore               int     `json:"developer_score"`
	CommunityScore      float64 `json:"community_score"`
	LiquidityScore      float64 `json:"liquidity_score"`
	PublicInterestStats struct {
		AlexaRank   any `json:"alexa_rank"`
		BingMatches any `json:"bing_matches"`
	} `json:"public_interest_stats"`
	StatusUpdates []any     `json:"status_updates"`
	LastUpdated   time.Time `json:"last_updated"`
}

type TokenItem

type TokenItem struct {
	Id       string
	Chain    string
	Symbol   string
	Decimals int
}

Jump to

Keyboard shortcuts

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