cal_croi

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 FetchHistoricalPrice

func FetchHistoricalPrice(tokenSymbol string, timeStamp int64) (*big.Int, error)

FetchHistoricalPrice fetch token historical price (USD) * 10^6

func GetCurrentHeight

func GetCurrentHeight() (int64, error)

GetCurrentHeight return current height of ethereum

func GetUniswapV2ROI

func GetUniswapV2ROI(fromTokenName, toTokenName string, poolAddr common.Address) (*big.Int, *big.Int, error)

返回$ ROI & NET ROI 百分比,结果*10^6

func MinBigInt

func MinBigInt(a, b *big.Int) *big.Int

MinBigInt get the smallest one

if a <= b: return a; else return b

func TokenDecimial

func TokenDecimial(tokenSymbol string) *big.Int

TokenDecimial return token's decimial

when tokenDecimial is 10*6
will return: *big.NewInt(1000000)

func TwoTokenWorth

func TwoTokenWorth(token0Amount, token1Amount, token0Price, token1Price *big.Int, token0Symbol, token1Symbol string) *big.Int

TwoTokenWorth return two token's worth in USD

tokenPrice should be 10^6 decimial in USD

Types

type ToUSDPrice

type ToUSDPrice struct {
	USD float64 `json:"USD"`
}

type TokenPrice

type TokenPrice struct {
	TokenName ToUSDPrice `json:"tokenName"`
}

Jump to

Keyboard shortcuts

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