pub struct PriceRange<Exp: Integer> {
pub lower: UFix64<Exp>,
pub upper: UFix64<Exp>,
}Expand description
Spread of an asset price, with a lower and upper quote. Use lower in minting, higher in redeeming.
Fields§
§lower: UFix64<Exp>§upper: UFix64<Exp>Implementations§
Source§impl<Exp: Integer> PriceRange<Exp>
impl<Exp: Integer> PriceRange<Exp>
Sourcepub fn from_conf(
price: UFix64<Exp>,
conf: UFix64<Exp>,
) -> Result<PriceRange<Exp>>
pub fn from_conf( price: UFix64<Exp>, conf: UFix64<Exp>, ) -> Result<PriceRange<Exp>>
Pyth does not publish a “true” price but a range of values defined by a
base price and a confidence interval (μ-σ, μ+σ).
This data type either returns the lower or upper bound of that range.
See Pyth documentation
Sourcepub fn one(price: UFix64<Exp>) -> PriceRange<Exp>
pub fn one(price: UFix64<Exp>) -> PriceRange<Exp>
Makes a range of one price, useful in test scenarios.
Sourcepub fn new(lower: UFix64<Exp>, upper: UFix64<Exp>) -> PriceRange<Exp>
pub fn new(lower: UFix64<Exp>, upper: UFix64<Exp>) -> PriceRange<Exp>
Raw construction of range from lower and upper bounds.
Trait Implementations§
Source§impl<Exp: Clone + Integer> Clone for PriceRange<Exp>
impl<Exp: Clone + Integer> Clone for PriceRange<Exp>
Source§fn clone(&self) -> PriceRange<Exp>
fn clone(&self) -> PriceRange<Exp>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<Exp: Copy + Integer> Copy for PriceRange<Exp>
impl<Exp: Eq + Integer> Eq for PriceRange<Exp>
impl<Exp: Integer> StructuralPartialEq for PriceRange<Exp>
Auto Trait Implementations§
impl<Exp> Freeze for PriceRange<Exp>
impl<Exp> RefUnwindSafe for PriceRange<Exp>where
Exp: RefUnwindSafe,
impl<Exp> Send for PriceRange<Exp>where
Exp: Send,
impl<Exp> Sync for PriceRange<Exp>where
Exp: Sync,
impl<Exp> Unpin for PriceRange<Exp>where
Exp: Unpin,
impl<Exp> UnwindSafe for PriceRange<Exp>where
Exp: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more