pub struct TwapInputs { /* private fields */ }Expand description
A validated continuous arithmetic-Asian / partially fixed TWAP quote.
Unlike a vanilla European quote, TWAP validity is relational: the remaining
averaging window cannot exceed time to expiry, and the fixed average must be
present exactly when the fixed weight is non-zero. Construction checks those
relations once; Self::price then calls the raw kernel with the same
validated state.
Implementations§
Source§impl TwapInputs
impl TwapInputs
Sourcepub const fn from_raw(
s: u128,
k: u128,
r: u128,
q: u128,
sigma: u128,
t: u128,
averaging_time: u128,
fixed_average: u128,
fixed_weight: u128,
) -> Result<Self, SolMathError>
pub const fn from_raw( s: u128, k: u128, r: u128, q: u128, sigma: u128, t: u128, averaging_time: u128, fixed_average: u128, fixed_weight: u128, ) -> Result<Self, SolMathError>
Validate raw fixed-point instruction data in one shot.
Sourcepub fn price(&self) -> Result<AsianOptionResult, SolMathError>
pub fn price(&self) -> Result<AsianOptionResult, SolMathError>
Price the validated partially fixed TWAP state.
Sourcepub const fn averaging_time(&self) -> u128
pub const fn averaging_time(&self) -> u128
Remaining averaging-window length in years at SCALE.
Sourcepub const fn fixed_weight(&self) -> u128
pub const fn fixed_weight(&self) -> u128
Fraction of the final average already fixed, in [0, SCALE].
Sourcepub const fn fixed_average(&self) -> Price
pub const fn fixed_average(&self) -> Price
Average of the already-fixed observations.
Trait Implementations§
Source§impl Clone for TwapInputs
impl Clone for TwapInputs
Source§fn clone(&self) -> TwapInputs
fn clone(&self) -> TwapInputs
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for TwapInputs
Source§impl Debug for TwapInputs
impl Debug for TwapInputs
impl Eq for TwapInputs
Source§impl PartialEq for TwapInputs
impl PartialEq for TwapInputs
impl StructuralPartialEq for TwapInputs
Auto Trait Implementations§
impl Freeze for TwapInputs
impl RefUnwindSafe for TwapInputs
impl Send for TwapInputs
impl Sync for TwapInputs
impl Unpin for TwapInputs
impl UnsafeUnpin for TwapInputs
impl UnwindSafe for TwapInputs
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