Skip to main content

ConfiguredClient

Struct ConfiguredClient 

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

A configured Dukascopy client instance with its own cache and settings.

Implementations§

Source§

impl ConfiguredClient

Source

pub fn config(&self) -> &ClientConfig

Returns the client configuration.

Source

pub fn default_quote_currency(&self) -> Option<&str>

Returns configured default quote currency if set.

Source

pub fn get_instrument_config(&self, from: &str, to: &str) -> InstrumentConfig

Returns the instrument configuration for a currency pair.

Source

pub async fn get_tick_data( &self, pair: &CurrencyPair, timestamp: DateTime<Utc>, ) -> Result<Vec<u8>, DukascopyError>

Fetches tick data for a currency pair at a specific time.

Source

pub async fn get_exchange_rate( &self, pair: &CurrencyPair, timestamp: DateTime<Utc>, ) -> Result<CurrencyExchange, DukascopyError>

Fetches the exchange rate for a currency pair at a specific timestamp.

Source

pub async fn get_exchange_rate_for_request( &self, request: &RateRequest, timestamp: DateTime<Utc>, ) -> Result<CurrencyExchange, DukascopyError>

Fetches exchange rate for unified request type (pair or symbol).

Source

pub async fn get_exchange_rate_for_symbol( &self, symbol: &str, timestamp: DateTime<Utc>, ) -> Result<CurrencyExchange, DukascopyError>

Fetches exchange rate for a symbol using configured default quote currency.

Source

pub async fn get_exchange_rate_for_symbol_with_path( &self, symbol: &str, timestamp: DateTime<Utc>, ) -> Result<ResolvedExchange, DukascopyError>

Fetches exchange rate for a symbol and returns conversion path metadata.

Source

pub async fn get_exchange_rate_in_quote( &self, symbol: &str, quote: &str, timestamp: DateTime<Utc>, ) -> Result<CurrencyExchange, DukascopyError>

Fetches exchange rate for a symbol in target quote currency.

Source

pub async fn get_exchange_rate_in_quote_with_path( &self, symbol: &str, quote: &str, timestamp: DateTime<Utc>, ) -> Result<ResolvedExchange, DukascopyError>

Fetches exchange rate for a symbol in target quote currency with path metadata.

Source

pub async fn get_exchange_rates_range( &self, pair: &CurrencyPair, start: DateTime<Utc>, end: DateTime<Utc>, interval: Duration, ) -> Result<Vec<CurrencyExchange>, DukascopyError>

Fetches exchange rates over a time range.

Source

pub fn build_url( &self, pair_symbol: &str, year: i32, month: u32, day: u32, hour: u32, ) -> String

Builds a URL for fetching tick data.

Source

pub fn clear_cache(&self) -> Result<(), DukascopyError>

Clears the cache.

Source

pub fn cache_len(&self) -> Result<usize, DukascopyError>

Returns the current number of cached entries.

Trait Implementations§

Source§

impl Debug for ConfiguredClient

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more