coingecko

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 6 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 gecko.

func (*Gecko) GetId

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

Get the id accroding to symbol. Some tokens like usdc.e on avalanche cannot be found by coingecko list, need special process.

func (*Gecko) GetPrice

func (g *Gecko) GetPrice(id string, currency string) (float64, error)

Get price by coingecko id. Currency can be "", "usd" will be used by default.

func (*Gecko) GetPriceBySymbol

func (g *Gecko) GetPriceBySymbol(symbol string, network string, currency string) (float64, error)

Get token price by its symbol. Some tokens like usdc.e on avalanche cannot be found by coingecko list, need special process.

func (*Gecko) Update

func (g *Gecko) Update() (*Gecko, error)

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