@namgold/ks-sdk-core
Version:
🛠An CORE SDK for building DMM Classic SDK, Elastic SDK and Solana SDK
31 lines (30 loc) • 1.34 kB
TypeScript
import { BigintIsh } from '../../constants';
import { Currency } from '../currency';
import { Fraction } from './fraction';
import { CurrencyAmount } from './currencyAmount';
export declare class Price<TBase extends Currency, TQuote extends Currency> extends Fraction {
readonly baseCurrency: TBase;
readonly quoteCurrency: TQuote;
/**
* Construct a price, either with the base and quote currency amount, or the
* @param args
*/
constructor(...args: [TBase, TQuote, BigintIsh, BigintIsh] | [{
baseAmount: CurrencyAmount<TBase>;
quoteAmount: CurrencyAmount<TQuote>;
}]);
/**
* Flip the price, switching the base and quote currency
*/
invert(): Price<TQuote, TBase>;
/**
* 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
* @param other the other price
*/
multiply<TOtherQuote extends Currency>(other: Price<TQuote, TOtherQuote>): Price<TBase, TOtherQuote>;
/**
* Return the amount of quote currency corresponding to a given amount of the base currency
* @param currencyAmount the amount of base currency to quote against the price
*/
quote(currencyAmount: CurrencyAmount<TBase>): CurrencyAmount<TQuote>;
}