Struct lfest::prelude::Config

source ·
pub struct Config<M>
where M: Currency,
{ /* private fields */ }
Expand description

Define the Exchange configuration

Implementations§

source§

impl<M> Config<M>
where M: Currency,

source

pub fn contract_spec(&self) -> &ContractSpecification<M::PairedCurrency>

The contract specification.

source§

impl<M> Config<M>
where M: Currency,

source

pub fn starting_wallet_balance(&self) -> M

The starting balance of account (denoted in margin currency). The concrete Currency here defines the futures type. If QuoteCurrency is used as the margin currency, then its a linear futures contract. If BaseCurrency is used as the margin currency, then its an inverse futures contract.

source

pub fn max_num_open_orders(&self) -> usize

The maximum number of open orders the user can have at any given time

source

pub fn sample_returns_every_n_seconds(&self) -> u64

The interval by which to sample the returns of user balances. This is used to analyze the trading performance later on, to enable things like sharpe, sortino, anything based on returns.

source§

impl<M> Config<M>
where M: Currency,

source

pub fn new( starting_balance: M, max_num_open_orders: usize, contract_specification: ContractSpecification<M::PairedCurrency>, sample_returns_every_n_seconds: u64, ) -> Result<Self>

Create a new Config.

§Arguments:

starting_balance: Initial Wallet Balance, denoted in QUOTE if using linear futures, denoted in BASE for inverse futures max_num_open_orders: The maximum number of open ordes a user can have at any time. contract_specification: More details on the actual contract traded. sample_returns_every_n_seconds: How often to sample the user balances for computing the returns. Is used for computing for example the sharpe ratio or anything else that requires ln returns.

§Returns:

Either a valid Config or an Error

Trait Implementations§

source§

impl<M> Clone for Config<M>

source§

fn clone(&self) -> Config<M>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<M> Debug for Config<M>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<M> Freeze for Config<M>
where M: Freeze, <M as Currency>::PairedCurrency: Freeze,

§

impl<M> RefUnwindSafe for Config<M>

§

impl<M> Send for Config<M>

§

impl<M> Sync for Config<M>
where M: Sync, <M as Currency>::PairedCurrency: Sync,

§

impl<M> Unpin for Config<M>
where M: Unpin, <M as Currency>::PairedCurrency: Unpin,

§

impl<M> UnwindSafe for Config<M>

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> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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