Skip to main content

ConversionQuoteBook

Struct ConversionQuoteBook 

Source
pub struct ConversionQuoteBook { /* private fields */ }
Expand description

Historical FX tick store with causal, staleness-bounded lookup.

Implementations§

Source§

impl ConversionQuoteBook

Source

pub fn new(max_staleness: Duration) -> Result<Self, ConversionError>

Create a quote book with one maximum age applied to every conversion leg.

Source

pub fn max_staleness(&self) -> Duration

Configured maximum quote age.

Source

pub fn prune_replay_history(&mut self, replay_ts: NaiveDateTime) -> usize

Prune replay history while retaining each symbol’s latest causal quote.

Quotes after replay_ts are retained. This is opt-in because lookups before the retained quote are no longer available after pruning.

Source

pub fn retain_replay_causal_predecessors( &mut self, replay_ts: NaiveDateTime, required_operation_times: impl IntoIterator<Item = NaiveDateTime>, ) -> usize

Retain only causal predecessors needed by a replay schedule.

The latest quote at or before replay_ts is always retained for each symbol. Each required operation time contributes at most one additional predecessor, so intervening ticks do not accumulate while a primary series is sparse. Historical lookup behavior is unchanged unless this method is called.

Source

pub fn record_tick( &mut self, registry: &SymbolRegistry, quote: PriceQuote, ) -> Result<Option<PriceQuote>, ConversionError>

Validate and record a tick quote under its canonical FX symbol.

A quote at the same symbol and timestamp replaces the prior quote and is returned to make duplicate handling auditable by the caller.

Source

pub fn record_canonical_tick( &mut self, quote: PriceQuote, ) -> Result<Option<PriceQuote>, ConversionError>

Validate and record a caller-canonicalized tick without a symbol registry.

Source

pub fn convert_route( &self, amount: f64, operation_ts: NaiveDateTime, route: &ConversionRoute, ) -> Result<ConversionResult, ConversionError>

Convert an amount with a previously resolved route.

Source

pub fn convert_with_symbols( &self, registry: &SymbolRegistry, amount: f64, from_currency: &str, to_currency: &str, operation_ts: NaiveDateTime, available_symbols: &BTreeSet<String>, ) -> Result<ConversionResult, ConversionError>

Resolve a route from the provided source-symbol set and execute it.

Trait Implementations§

Source§

impl Clone for ConversionQuoteBook

Source§

fn clone(&self) -> ConversionQuoteBook

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConversionQuoteBook

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V