# PriceAuthority Object
We rely on PriceAuthority oracles. A PriceAuthority gives reliable quotes for prices. The quotes might be based on broad surveys of prices across the ecosystem, or might come directly from an AMM (Automatic Market Maker). A PriceAuthority can either give a quote for the current price across any pair of currencies it knows about, or can immediately return a Promise resolved when a condition is true. For example, a price crossing some threshold, or at a particular time. It can also provide a price feed that updates with every price change.
# E(PriceAuthority).getQuoteIssuer(brandIn, brandOut)
Gets the ERTP Issuer of PriceQuotes for a given brandIn/brandOut pair.
const quoteIssuer = await E(PriceAuthority).getQuoteIssuer(
collateralKit.brand,
loanKit.brand
);
# E(PriceAuthority).getTimerService(brandIn, brandOut)
- brandIn: Brand
- brandOut: Brand
- Returns: TimerService | Promise<TimerService>
Gets the timer used in PriceQuotes for a given brandIn/brandOut pair.
const myTimer = E(PriceAuthority).getTimerService(collateral.brand, loanKit.brand);
# E(PriceAuthority).makeQuoteNotifier(amountIn, brandOut)
- amountIn: Amount
- brandOut: Brand
- Returns: ERef<Notifier<PriceQuote>>
Be notified of the latest PriceQuotes for a given amountIn. The issuing rate may be very different between PriceAuthorities.
const myNotifier = E(PriceAuthority).makeQuoteNotifier(quatloos100, usdBrand);
# E(PriceAuthority).quoteGiven(amountIn, brandOut)
- amountIn: Amount
- brandOut: Brand
- Returns: Promise<PriceQuote>
Gets a quote on-demand corresponding to amountIn.
const quote = await E(PriceAuthority).quoteGiven(moola500, quatloosBrand);
# E(PriceAuthority).quoteWanted(brandIn, amountOut)
- brandIn: Brand
- amountOut: Amount
- Returns: Promise<PriceQuote>
Gets a quote on-demand corresponding to amountOut.
const quote = await E(PriceAuthority).quoteWanted(quatloosBrand, moola500);
# E(PriceAuthority).quoteAtTime(deadline, amountIn, brandOut)
- deadline: Timestamp
- amountIn: Amount
- brandOut: Brand
- Returns: Promise<PriceQuote>
Resolves after deadline passes on the PriceAuthority’s timerService with the PriceQuote of amountIn at that time. Note that deadline's value is a BigInt.
const priceQuoteOnThisAtTime = E(PriceAuthority).quoteAtTime(7n, quatloosAmount34, usdBrand);
# E(PriceAuthority).quoteWhenGT(amountIn, amountOutLimit)
- amountIn: Amount
- amountOutLimit: Amount
- Returns: Promise<PriceQuote>
Resolves when a PriceQuote of amountIn exceeds amountOutLimit.
const quote = E(PriceAuthority).quoteWhenGT(
AmountMath.make(brands.In, 29n),
AmountMath.make(brands.Out, 974n)
);
# E(PriceAuthority).quoteWhenGTE(amountIn, amountOutLimit)
- amountIn: Amount
- amountOutLimit: Amount
- Returns: Promise<PriceQuote>
Resolves when a PriceQuote of amountIn reaches or exceeds amountOutLimit.
const quote = E(PriceAuthority).quoteWhenGTE(
AmountMath.make(brands.In, 29n),
AmountMath.make(brands.Out, 974n)
);
# E(PriceAuthority).quoteWhenLT(amountIn, amountOutLimit)
- amountIn Amount
- amountOutLimit Amount
- Returns: Promise<PriceQuote>
Resolves when a PriceQuote of amountIn drops below amountOutLimit.
const quote = E(PriceAuthority).quoteWhenLT(
AmountMath.make(brands.In, 29n),
AmountMath.make(brands.Out, 974n)
);
# E(PriceAuthority).quoteWhenLTE(amountIn, amountOutLimit)
- amountIn: Amount
- amountOutLimit: Amount
- Returns: Promise<PriceQuote>
Resolves when a PriceQuote of amountIn reaches or drops below amountOutLimit.
const quote = E(PriceAuthority).quoteWhenLTE(
AmountMath.make(brands.In, 29n),
AmountMath.make(brands.Out, 974n)
);
# E(PriceAuthority).mutableQuoteWhenGT(amountIn, amountOutLimit)
- amountIn: Amount
- amountOutLimit: Amount
- Returns: Promise<MutableQuote>
Resolves when a PriceQuote of amountIn exceeds amountOutLimit.
const quote = E(PriceAuthority).mutableQuoteWhenGT(
AmountMath.make(brands.In, 29n),
AmountMath.make(brands.Out, 974n)
);
# E(PriceAuthority).mutableQuoteWhenGTE(amountIn, amountOutLimit)
- amountIn: Amount
- amountOutLimit: Amount
- Returns: Promise<MutableQuote>
Resolves when a PriceQuote of amountIn reaches or exceeds amountOutLimit.
const quote = E(PriceAuthority).mutableQuoteWhenGTE(
AmountMath.make(brands.In, 29n),
AmountMath.make(brands.Out, 974n)
);
# E(PriceAuthority).mutableQuoteWhenLT(amountIn, amountOutLimit)
- amountIn: Amount
- amountOutLimit: Amount
- Returns: Promise<MutableQuote>
Resolves when a PriceQuote of amountIn drops below amountOutLimit.
const quote = E(PriceAuthority).mutableQuoteWhenLT(
AmountMath.make(brands.In, 29n),
AmountMath.make(brands.Out, 974n)
);
# E(PriceAuthority).mutableQuoteWhenLTE(amountIn, amountOutLimit)
- amountIn: Amount
- amountOutLimit: Amount
- Returns: Promise<MutableQuote>
Resolves when a PriceQuote of amountIn reaches or drops below amountOutLimit.
const quote = E(PriceAuthority).mutableQuoteWhenLTE(
AmountMath.make(brands.In, 29n),
AmountMath.make(brands.Out, 974n)
);