From bc9715a7db0b414fb86ea44d885ec77ba3b9f07a Mon Sep 17 00:00:00 2001 From: daniel-wong-dfinity-org <97631336+daniel-wong-dfinity-org@users.noreply.github.com> Date: Wed, 4 Sep 2024 15:14:07 +0200 Subject: [PATCH] docs: Explain exchange rate terminology. (#270) In particular, what does "X/Y" mean? What are "base" and "quote" assets? In short in "X/Y", X is the "base" asset, and Y is the "quote" asset, and it tells you the price of X in terms of Y. At least for me, this is really not self-explanatory. --- src/ic-xrc-types/src/lib.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ic-xrc-types/src/lib.rs b/src/ic-xrc-types/src/lib.rs index ca627930..fc01519b 100644 --- a/src/ic-xrc-types/src/lib.rs +++ b/src/ic-xrc-types/src/lib.rs @@ -19,13 +19,16 @@ pub struct Asset { } /// The type the user sends when requesting a rate. +/// +/// For definitions of "base", "quote", etc, the reader is referred to +/// https://en.wikipedia.org/wiki/Currency_pair. #[derive(CandidType, Clone, Debug, Deserialize)] pub struct GetExchangeRateRequest { - /// The asset to be used as the resulting asset. For example, using - /// ICP/USD, ICP would be the base asset. + /// The base asset, i.e., the first asset in a currency pair. For example, + /// ICP is the base asset in the currency pair ICP/USD. pub base_asset: Asset, - /// The asset to be used as the starting asset. For example, using - /// ICP/USD, USD would be the quote asset. + /// The quote asset, i.e., the second asset in a currency pair. For example, + /// USD is the quote asset in the currency pair ICP/USD. pub quote_asset: Asset, /// An optional parameter used to find a rate at a specific time. pub timestamp: Option,