#[repr(C)]pub struct VariableParameters {
pub volatility_accumulator: u32,
pub volatility_reference: u32,
pub index_reference: i32,
pub _padding: [u8; 4],
pub last_update_timestamp: i64,
pub _padding_1: [u8; 8],
}Expand description
Parameters that changes based on dynamic of the market
Fields§
§volatility_accumulator: u32Volatility accumulator measure the number of bin crossed since reference bin ID. Normally (without filter period taken into consideration), reference bin ID is the active bin of last swap. It affects the variable fee rate
volatility_reference: u32Volatility reference is decayed volatility accumulator. It is always <= volatility_accumulator
index_reference: i32Active bin id of last swap.
_padding: [u8; 4]Padding for bytemuck safe alignment
last_update_timestamp: i64Last timestamp the variable parameters was updated
_padding_1: [u8; 8]Padding for bytemuck safe alignment
Implementations§
Source§impl VariableParameters
impl VariableParameters
Sourcepub fn update_volatility_accumulator(
&mut self,
active_id: i32,
static_params: &StaticParameters,
) -> Result<()>
pub fn update_volatility_accumulator( &mut self, active_id: i32, static_params: &StaticParameters, ) -> Result<()>
volatility_accumulator = min(volatility_reference + num_of_bin_crossed, max_volatility_accumulator)
Sourcepub fn update_references(
&mut self,
active_id: i32,
current_timestamp: i64,
static_params: &StaticParameters,
) -> Result<()>
pub fn update_references( &mut self, active_id: i32, current_timestamp: i64, static_params: &StaticParameters, ) -> Result<()>
Update id, and volatility reference
pub fn update_volatility_parameter( &mut self, active_id: i32, current_timestamp: i64, static_params: &StaticParameters, ) -> Result<()>
Trait Implementations§
Source§impl Clone for VariableParameters
impl Clone for VariableParameters
Source§fn clone(&self) -> VariableParameters
fn clone(&self) -> VariableParameters
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 VariableParameters
Source§impl Debug for VariableParameters
impl Debug for VariableParameters
Source§impl Default for VariableParameters
impl Default for VariableParameters
Source§fn default() -> VariableParameters
fn default() -> VariableParameters
Returns the “default value” for a type. Read more
impl Pod for VariableParameters
Source§impl Space for VariableParameters
impl Space for VariableParameters
const INIT_SPACE: usize
Auto Trait Implementations§
impl Freeze for VariableParameters
impl RefUnwindSafe for VariableParameters
impl Send for VariableParameters
impl Sync for VariableParameters
impl Unpin for VariableParameters
impl UnsafeUnpin for VariableParameters
impl UnwindSafe for VariableParameters
Blanket Implementations§
impl<T> AnyBitPattern for Twhere
T: Pod,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.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