pub struct Pair {
pub base: String,
pub quote: String,
}Expand description
A pair of assets, e.g. BTC/USD
This is a simple struct that holds the base and quote assets. It is used to represent a pair of assets in the system. Base and quote are always in UPPERCASE.
Fields§
§base: String§quote: StringImplementations§
Source§impl Pair
impl Pair
Sourcepub fn create_routed_pair(base_pair: &Self, quote_pair: &Self) -> Self
pub fn create_routed_pair(base_pair: &Self, quote_pair: &Self) -> Self
Creates a routed pair from two pairs that share a common quote currency.
e.g. “BTC/USD” and “ETH/USD” -> “BTC/ETH”
Sourcepub fn from_currencies(base: &str, quote: &str) -> Self
pub fn from_currencies(base: &str, quote: &str) -> Self
Creates a new pair from base and quote currencies.
Sourcepub fn from_stable_pair(pair: &str) -> Option<Self>
pub fn from_stable_pair(pair: &str) -> Option<Self>
Creates a pair from a stable pair string with or without delimiters
e.g. “BTCUSDT” -> BTC/USD, “ETH-USDC” -> ETH/USD, “SOL_USDT” -> SOL/USD
Sourcepub fn format_with_separator(&self, separator: &str) -> String
pub fn format_with_separator(&self, separator: &str) -> String
Format pair with a custom separator
Sourcepub fn to_pair_id(&self) -> String
pub fn to_pair_id(&self) -> String
Get the pair ID in standard format without consuming self
Trait Implementations§
impl Eq for Pair
impl StructuralPartialEq for Pair
Auto Trait Implementations§
impl Freeze for Pair
impl RefUnwindSafe for Pair
impl Send for Pair
impl Sync for Pair
impl Unpin for Pair
impl UnwindSafe for Pair
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more