pub struct ConversionQuoteBook { /* private fields */ }Expand description
Historical FX tick store with causal, staleness-bounded lookup.
Implementations§
Source§impl ConversionQuoteBook
impl ConversionQuoteBook
Sourcepub fn new(max_staleness: Duration) -> Result<Self, ConversionError>
pub fn new(max_staleness: Duration) -> Result<Self, ConversionError>
Create a quote book with one maximum age applied to every conversion leg.
Sourcepub fn max_staleness(&self) -> Duration
pub fn max_staleness(&self) -> Duration
Configured maximum quote age.
Sourcepub fn prune_replay_history(&mut self, replay_ts: NaiveDateTime) -> usize
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.
Sourcepub fn retain_replay_causal_predecessors(
&mut self,
replay_ts: NaiveDateTime,
required_operation_times: impl IntoIterator<Item = NaiveDateTime>,
) -> usize
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.
Sourcepub fn record_tick(
&mut self,
registry: &SymbolRegistry,
quote: PriceQuote,
) -> Result<Option<PriceQuote>, ConversionError>
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.
Sourcepub fn record_canonical_tick(
&mut self,
quote: PriceQuote,
) -> Result<Option<PriceQuote>, ConversionError>
pub fn record_canonical_tick( &mut self, quote: PriceQuote, ) -> Result<Option<PriceQuote>, ConversionError>
Validate and record a caller-canonicalized tick without a symbol registry.
Sourcepub fn convert_route(
&self,
amount: f64,
operation_ts: NaiveDateTime,
route: &ConversionRoute,
) -> Result<ConversionResult, ConversionError>
pub fn convert_route( &self, amount: f64, operation_ts: NaiveDateTime, route: &ConversionRoute, ) -> Result<ConversionResult, ConversionError>
Convert an amount with a previously resolved route.
Sourcepub 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>
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
impl Clone for ConversionQuoteBook
Source§fn clone(&self) -> ConversionQuoteBook
fn clone(&self) -> ConversionQuoteBook
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more