Documentation ¶
Index ¶
- func GetId(symbol string, tokenList []CoingeckoToken, coingeckoKey string) (id string, err error)
- func GetPriceFromCoinGecko(id string, currency string) (p float64, err error)
- func GetPriceFromSymbol(symbol string, network string, tokenList []CoingeckoToken, coingeckoKey string, ...) (price float64, err error)
- type CoingeckoToken
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.