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: 2

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