Documentation ¶
Index ¶
- Variables
- type CurrencyAmount
- func (ca *CurrencyAmount) Add(other *CurrencyAmount) *CurrencyAmount
- func (ca *CurrencyAmount) Raw() *big.Int
- func (ca *CurrencyAmount) Subtract(other *CurrencyAmount) *CurrencyAmount
- func (ca *CurrencyAmount) ToExact(format interface{}) string
- func (ca *CurrencyAmount) ToFixed(decimalPlaces int, format interface{}, rounding big.RoundingMode) string
- func (ca *CurrencyAmount) ToSignificant(significantDigits int, format interface{}, rounding Rounding) string
- type Fraction
- func (f *Fraction) Add(other *Fraction) *Fraction
- func (f *Fraction) AsDecimal() decimal.Decimal
- func (f *Fraction) AsFraction() *Fraction
- func (f *Fraction) Divide(other *Fraction) *Fraction
- func (f *Fraction) EqualTo(other *Fraction) bool
- func (f *Fraction) GreaterThan(other *Fraction) bool
- func (f *Fraction) Invert() *Fraction
- func (f *Fraction) LessThan(other *Fraction) bool
- func (f *Fraction) Multiply(other *Fraction) *Fraction
- func (f *Fraction) Quotient() *big.Int
- func (f *Fraction) Remainder() *Fraction
- func (f *Fraction) Subtract(other *Fraction) *Fraction
- func (f *Fraction) ToFixed(decimalPlaces int, format interface{}, rounding big.RoundingMode) string
- func (f *Fraction) ToSignificant(significantDigits int, format interface{}, rounding Rounding) string
- type Percent
- func (p *Percent) Add(other *Percent) *Percent
- func (p *Percent) Divide(other *Percent) *Percent
- func (p *Percent) Multiply(other *Percent) *Percent
- func (p *Percent) Subtract(other *Percent) *Percent
- func (p *Percent) ToFixed(decimalPlaces int, format interface{}, rounding big.RoundingMode) string
- func (p *Percent) ToSignificant(significantDigits int, format interface{}, rounding Rounding) string
- type Price
- func (p *Price) Adjusted() *Fraction
- func (p *Price) AdjustedForDecimals() *Fraction
- func (p *Price) Invert() *Price
- func (p *Price) Multiply(other *Price) *Price
- func (p *Price) Quote(currencyAmount CurrencyAmount) *CurrencyAmount
- func (p *Price) Raw() *Fraction
- func (p *Price) ToFixed(decimalPlaces int, format interface{}, rounding big.RoundingMode) string
- func (p *Price) ToSignificant(significantDigits int, format interface{}, rounding Rounding) string
- type Rounding
- type TokenAmount
Constants ¶
This section is empty.
Variables ¶
View Source
var OneHundredPercent = Percent{ Fraction: *NewFraction(big.NewInt(constants.NHUNDRED), big.NewInt(1)), // contains filtered or unexported fields }
Functions ¶
This section is empty.
Types ¶
type CurrencyAmount ¶
func NewCurrencyAmount ¶
func NewCurrencyAmount(currency *entities.Currency, amount *big.Int) *CurrencyAmount
func (*CurrencyAmount) Add ¶
func (ca *CurrencyAmount) Add(other *CurrencyAmount) *CurrencyAmount
func (*CurrencyAmount) Raw ¶
func (ca *CurrencyAmount) Raw() *big.Int
func (*CurrencyAmount) Subtract ¶
func (ca *CurrencyAmount) Subtract(other *CurrencyAmount) *CurrencyAmount
func (*CurrencyAmount) ToExact ¶
func (ca *CurrencyAmount) ToExact(format interface{}) string
func (*CurrencyAmount) ToFixed ¶
func (ca *CurrencyAmount) ToFixed(decimalPlaces int, format interface{}, rounding big.RoundingMode) string
func (*CurrencyAmount) ToSignificant ¶
func (ca *CurrencyAmount) ToSignificant(significantDigits int, format interface{}, rounding Rounding) string
type Fraction ¶
type Fraction struct { Numerator *big.Int `json:"numerator,omitempty"` Denominator *big.Int `json:"denominator,omitempty"` }
func NewFraction ¶
func (*Fraction) AsFraction ¶
func (*Fraction) GreaterThan ¶
type Percent ¶
type Percent struct { Fraction // contains filtered or unexported fields }
type Price ¶
type Price struct { Fraction BaseCurrency entities.Currency `json:"base_currency,omitempty"` QuoteCurrency entities.Currency `json:"quote_currency,omitempty"` Scalar Fraction `json:"scalar,omitempty"` }
func (*Price) AdjustedForDecimals ¶
func (*Price) Quote ¶
func (p *Price) Quote(currencyAmount CurrencyAmount) *CurrencyAmount
type TokenAmount ¶
func NewTokenAmount ¶
func NewTokenAmount(token entities.Token, amount *big.Int) *TokenAmount
func (*TokenAmount) Add ¶
func (ta *TokenAmount) Add(other *TokenAmount) *TokenAmount
func (*TokenAmount) AsCurrencyAmount ¶
func (ta *TokenAmount) AsCurrencyAmount() *CurrencyAmount
func (*TokenAmount) Raw ¶
func (ta *TokenAmount) Raw() *big.Int
func (*TokenAmount) Subtract ¶
func (ta *TokenAmount) Subtract(other *TokenAmount) *TokenAmount
Click to show internal directories.
Click to hide internal directories.