Documentation ¶
Index ¶
- func CalcCurrentTokenValueByAmount(tokenAddr common.Address, tokenAmount *big.Int) (*big.Int, error)
- func GetCurrentPriceOfToken(tokenAddr common.Address) (float64, error)
- func GetDailyPrice(tokenAddr string, timestamp int64) (float64, error)
- func NewTokenPrice() error
- func UpdateTokenPrice(ctx context.Context)
- type TokenPrice
- type TokenPriceRecord
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 GetDailyPrice ¶
GetDailyPrice return tokenPrice at 8 am. of the same day as timestamp
func NewTokenPrice ¶
func NewTokenPrice() error
func UpdateTokenPrice ¶
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 ¶
Click to show internal directories.
Click to hide internal directories.