Price
@uniswap/sdk-core / Exports / Price
Class: Price<TBase, TQuote>
Type parameters
Name | Type |
---|---|
TBase | extends Currency |
TQuote | extends Currency |
Hierarchy
↳
Price
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• new Price<TBase
, TQuote
>(...args
)
Construct a price, either with the base and quote currency amount, or the
Type parameters
Name | Type |
---|---|
TBase | extends Currency |
TQuote | extends Currency |
Parameters
Name | Type |
---|---|
...args | [TBase , TQuote , BigintIsh , BigintIsh ] | [{ baseAmount : CurrencyAmount <TBase > ; quoteAmount : CurrencyAmount <TQuote > }] |
Overrides
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
Defined in
entities/fractions/fraction.ts:26
numerator
• Readonly
numerator: default
Inherited from
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
Defined in
entities/fractions/price.ts:77
asFraction
• get
asFraction(): Fraction
Helper method for converting any super class back to a fraction
Returns
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
Inherited from
Fraction.remainder
Defined in
entities/fractions/fraction.ts:47
Methods
add
▸ add(other
): Fraction
Parameters
Name | Type |
---|---|
other | BigintIsh | Fraction |
Returns
Inherited from
Defined in
entities/fractions/fraction.ts:55
divide
▸ divide(other
): Fraction
Parameters
Name | Type |
---|---|
other | BigintIsh | Fraction |
Returns
Inherited from
Defined in
entities/fractions/fraction.ts:115
equalTo
▸ equalTo(other
): boolean
Parameters
Name | Type |
---|---|
other | BigintIsh | Fraction |
Returns
boolean
Inherited from
Defined in
entities/fractions/fraction.ts:91
greaterThan
▸ greaterThan(other
): boolean
Parameters
Name | Type |
---|---|
other | BigintIsh | Fraction |
Returns
boolean
Inherited from
Defined in
entities/fractions/fraction.ts:99
invert
▸ invert(): Price
<TQuote
, TBase
>
Flip the price, switching the base and quote currency
Returns
Price
<TQuote
, TBase
>
Overrides
Defined in
entities/fractions/price.ts:49
lessThan
▸ lessThan(other
): boolean
Parameters
Name | Type |
---|---|
other | BigintIsh | Fraction |
Returns
boolean
Inherited from
Defined in
entities/fractions/fraction.ts:83
multiply
▸ multiply<TOtherQuote
>(other
): Price
<TBase
, 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
Name | Type |
---|---|
TOtherQuote | extends Currency |
Parameters
Name | Type | Description |
---|---|---|
other | Price <TQuote , TOtherQuote > | the other price |
Returns
Price
<TBase
, TOtherQuote
>
Overrides
Defined in
entities/fractions/price.ts:57
quote
▸ quote(currencyAmount
): CurrencyAmount
<TQuote
>
Return the amount of quote currency corresponding to a given amount of the base currency
Parameters
Name | Type | Description |
---|---|---|
currencyAmount | CurrencyAmount <TBase > | the amount of base currency to quote against the price |
Returns
CurrencyAmount
<TQuote
>
Defined in
entities/fractions/price.ts:67
subtract
▸ subtract(other
): Fraction
Parameters
Name | Type |
---|---|
other | BigintIsh | Fraction |
Returns
Inherited from
Defined in
entities/fractions/fraction.ts:69
toFixed
▸ toFixed(decimalPlaces?
, format?
, rounding?
): string
Parameters
Name | Type | Default value |
---|---|---|
decimalPlaces | number | 4 |
format? | object | undefined |
rounding? | Rounding | undefined |
Returns
string
Overrides
Defined in
entities/fractions/price.ts:85
toSignificant
▸ toSignificant(significantDigits?
, format?
, rounding?
): string
Parameters
Name | Type | Default value |
---|---|---|
significantDigits | number | 6 |
format? | object | undefined |
rounding? | Rounding | undefined |
Returns
string