Documentation ¶
Index ¶
- Constants
- Variables
- func Add(x, y uint64) (z decimal.Decimal)
- func AddDecimal(X, Y decimal.Decimal) (z decimal.Decimal)
- func BigAdd(x, y int64) (z int64)
- func BigDiv(x, y int64) (z int64)
- func BigMul(x, y int64) (z int64)
- func BigSub(x, y int64) (z int64)
- func Div(x, y uint64) (z decimal.Decimal)
- func DivDecimal(X, Y decimal.Decimal) (z decimal.Decimal)
- func LessFee(amount, feeAsBasisPoint uint64) (withFee, calculatedFee uint64)
- func Mul(x, y uint64) (z decimal.Decimal)
- func MulDecimal(X, Y decimal.Decimal) (z decimal.Decimal)
- func PlusFee(amount, feeAsBasisPoint uint64) (withFee, calculatedFee uint64)
- func Sub(x, y uint64) (z decimal.Decimal)
- func SubDecimal(X, Y decimal.Decimal) (z decimal.Decimal)
Constants ¶
const TenThousands = 10000
TenThousands ...
Variables ¶
var ( //BigOne represents a single unit of an asset with precision 8 BigOne = uint64(math.Pow10(8)) //BigOneDecimal represents a single unit of an asset with precision 8 as decimal.Decimal BigOneDecimal = decimal.NewFromInt(int64(BigOne)) )
Functions ¶
func Add ¶
Add takes two uint64 numbers and sum them x + y and returns the result as decimal.Decimal
func AddDecimal ¶
AddDecimal takes two decimal.Decimal numbers and sum them x + y and returns the result as decimal.Decimal
func Div ¶
Div takes two uint64 numbers and divides them x / y and returns the result as decimal.Decimal
func DivDecimal ¶
DivDecimal takes two decimal.Decimal numbers and divides them x / y and returns the result as decimal.Decimal
func LessFee ¶
LessFee calculates an amount with a subtracted given a int64 amount and a fee expressed in basis point (ie. 0.25 = 25)
func Mul ¶
Mul takes two int64 numbers and multiply them x * y and returns the result as decimal.Decimal
func MulDecimal ¶
MulDecimal takes two decimal.Decimal numbers and multiply them x * y and returns the result as decimal.Decimal
func PlusFee ¶
PlusFee calculates an amount with a fee added given a int64 amount and a fee expressed in basis point (ie. 0.25 = 25)
Types ¶
This section is empty.