coingecko

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetId

func GetId(symbol string, tokenList []CoingeckoToken, coingeckoKey string) (id string, err error)

Get token id from token symbol. If already has a local tokenList, will use the local one; otherwise you can use nil. If coingeckoKey is "", use no key and has a request limit.

func GetPriceFromCoinGecko

func GetPriceFromCoinGecko(id string, currency string) (p float64, err error)

Use token id to get token price. If currency is "", use default currency "usd".

func GetPriceFromSymbol

func GetPriceFromSymbol(symbol string, network string, tokenList []CoingeckoToken, coingeckoKey string, currency string) (price float64, err error)

Use token symbol to get token price. If already has a local tokenList, will use the local one; otherwise you can use nil. If coingeckoKey is "", use no key and has a request limit. If currency is "", use default currency "usd".

Types

type CoingeckoToken

type CoingeckoToken struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Symbol string `json:"symbol"`
}

func GetCoingeckoTokenList

func GetCoingeckoTokenList(coingeckoKey string) (list []CoingeckoToken, err error)

Get token list to pair token symbol with token id. If coingeckoKey is "", use no key and has a request limit.

Jump to

Keyboard shortcuts

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