coingecko

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 9 Imported by: 1 module, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Get Token Price by Coingecko

todo

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gecko

type Gecko struct {
	ApiKey    string
	TokenList []geckoapis.CoingeckoToken
	UpdatedAt time.Time
}

func New

func New(apiKey string) (*Gecko, error)

Create a new coingeco reader.

"apiKey" is the key for pro users, to unlock the request limits.

"" can be used as the key, and you will have a request limit of 10-50 times/min.

func (*Gecko) GetChainTokenPrice added in v0.1.3

func (g *Gecko) GetChainTokenPrice(network string, currency string) (decimal.Decimal, error)

Return chain token price.

func (*Gecko) GetId

func (g *Gecko) GetId(symbol string, network string) (string, error)

Return the id accroding to symbol.

Some tokens like usdc.e on avalanche cannot be found by coingecko list, need special process.

func (*Gecko) GetPriceByAddress added in v0.1.0

func (g *Gecko) GetPriceByAddress(address string, network string, currency string, client bind.ContractBackend) (decimal.Decimal, error)

Return token price.

Some tokens like usdc.e on avalanche cannot be found by coingecko list, need special process.

func (*Gecko) GetPriceById added in v0.1.1

func (g *Gecko) GetPriceById(id string, currency string) (decimal.Decimal, error)

Return token price.

Currency can be "", "usd" will be used by default.

func (*Gecko) GetPriceBySymbol

func (g *Gecko) GetPriceBySymbol(symbol string, network string, currency string) (decimal.Decimal, error)

Return token price.

Some tokens like usdc.e on avalanche cannot be found by coingecko list, need special process.

func (*Gecko) Update

func (g *Gecko) Update()

Update the token list in gecko.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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