token_price

package
v0.0.0-...-8b20efb Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcCurrentTokenValueByAmount

func CalcCurrentTokenValueByAmount(tokenAddr common.Address, tokenAmount *big.Int) (*big.Int, error)

CalcCurrentTokenValueByAmount will calc tokenvalue by tokenAddr & tokenAmount; token value is: output / 10**18 USD

func GetCurrentPriceOfToken

func GetCurrentPriceOfToken(tokenAddr common.Address) (float64, error)

func GetDailyPrice

func GetDailyPrice(tokenAddr string, timestamp int64) (float64, error)

GetDailyPrice return tokenPrice at 8 am. of the same day as timestamp

func NewTokenPrice

func NewTokenPrice() error

func UpdateTokenPrice

func UpdateTokenPrice(ctx context.Context)

Types

type TokenPrice

type TokenPrice struct {
	FilePath string
	Data     map[string]map[int64]float64 // map[tokenAddr]map[timestamp]price FilePath string

}
var (
	TokenPriceInfo TokenPrice
)

func (*TokenPrice) UpdatePriceInfo

func (t *TokenPrice) UpdatePriceInfo() error

UpdatePriceInfo Get Token Price in 8 AM

type TokenPriceRecord

type TokenPriceRecord struct {
	TokenAddr string
	Timestamp int64
	Price     float64
}

Jump to

Keyboard shortcuts

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