CenturionDEX

@centurion-dex/sdk-core / Exports / Price

Class: PriceTBase, TQuote

Last modified:

Type parameters

NameType
TBaseextends Currency
TQuoteextends Currency

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new PriceTBase, TQuote(...args)

Construct a price, either with the base and quote currency amount, or the

Type parameters

NameType
TBaseextends Currency
TQuoteextends Currency

Parameters

NameType
...args[TBase, TQuote, BigintIsh, BigintIsh] | [{ baseAmount: CurrencyAmountTBase ; quoteAmount: CurrencyAmountTQuote }]

Overrides

Fraction.constructor

Defined in

entities/fractions/price.ts:18

Properties

baseCurrency

Readonly baseCurrency: TBase

Defined in

entities/fractions/price.ts:10


denominator

Readonly denominator: default

Inherited from

Fraction.denominator

Defined in

entities/fractions/fraction.ts:26


numerator

Readonly numerator: default

Inherited from

Fraction.numerator

Defined in

entities/fractions/fraction.ts:25


quoteCurrency

Readonly quoteCurrency: TQuote

Defined in

entities/fractions/price.ts:11


scalar

Readonly scalar: Fraction

Defined in

entities/fractions/price.ts:12

Accessors

adjustedForDecimals

Private get adjustedForDecimals(): Fraction

Get the value scaled by decimals for formatting

Returns

Fraction

Defined in

entities/fractions/price.ts:77


asFraction

get asFraction(): Fraction

Helper method for converting any super class back to a fraction

Returns

Fraction

Inherited from

Fraction.asFraction

Defined in

entities/fractions/fraction.ts:154


quotient

get quotient(): default

Returns

default

Inherited from

Fraction.quotient

Defined in

entities/fractions/fraction.ts:42


remainder

get remainder(): Fraction

Returns

Fraction

Inherited from

Fraction.remainder

Defined in

entities/fractions/fraction.ts:47

Methods

add

add(other): Fraction

Parameters

NameType
otherBigintIsh | Fraction

Returns

Fraction

Inherited from

Fraction.add

Defined in

entities/fractions/fraction.ts:55


divide

divide(other): Fraction

Parameters

NameType
otherBigintIsh | Fraction

Returns

Fraction

Inherited from

Fraction.divide

Defined in

entities/fractions/fraction.ts:115


equalTo

equalTo(other): boolean

Parameters

NameType
otherBigintIsh | Fraction

Returns

boolean

Inherited from

Fraction.equalTo

Defined in

entities/fractions/fraction.ts:91


greaterThan

greaterThan(other): boolean

Parameters

NameType
otherBigintIsh | Fraction

Returns

boolean

Inherited from

Fraction.greaterThan

Defined in

entities/fractions/fraction.ts:99


invert

invert(): PriceTQuote, TBase

Flip the price, switching the base and quote currency

Returns

PriceTQuote, TBase

Overrides

Fraction.invert

Defined in

entities/fractions/price.ts:49


lessThan

lessThan(other): boolean

Parameters

NameType
otherBigintIsh | Fraction

Returns

boolean

Inherited from

Fraction.lessThan

Defined in

entities/fractions/fraction.ts:83


multiply

multiplyTOtherQuote(other): PriceTBase, TOtherQuote

Multiply the price by another price, returning a new price. The other price must have the same base currency as this price's quote currency

Type parameters

NameType
TOtherQuoteextends Currency

Parameters

NameTypeDescription
otherPriceTQuote, TOtherQuotethe other price

Returns

PriceTBase, TOtherQuote

Overrides

Fraction.multiply

Defined in

entities/fractions/price.ts:57


quote

quote(currencyAmount): CurrencyAmountTQuote

Return the amount of quote currency corresponding to a given amount of the base currency

Parameters

NameTypeDescription
currencyAmountCurrencyAmountTBasethe amount of base currency to quote against the price

Returns

CurrencyAmountTQuote

Defined in

entities/fractions/price.ts:67


subtract

subtract(other): Fraction

Parameters

NameType
otherBigintIsh | Fraction

Returns

Fraction

Inherited from

Fraction.subtract

Defined in

entities/fractions/fraction.ts:69


toFixed

toFixed(decimalPlaces?, format?, rounding?): string

Parameters

NameTypeDefault value
decimalPlacesnumber4
format?objectundefined
rounding?Roundingundefined

Returns

string

Overrides

Fraction.toFixed

Defined in

entities/fractions/price.ts:85


toSignificant

toSignificant(significantDigits?, format?, rounding?): string

Parameters

NameTypeDefault value
significantDigitsnumber6
format?objectundefined
rounding?Roundingundefined

Returns

string

Overrides

Fraction.toSignificant

Defined in

entities/fractions/price.ts:81