Skip to content

Commit

Permalink
docs: Explain exchange rate terminology. (#270)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
daniel-wong-dfinity-org authored Sep 4, 2024
1 parent 0d55a30 commit bc9715a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/ic-xrc-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u64>,
Expand Down

0 comments on commit bc9715a

Please sign in to comment.