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_specification( &self ) -> &ContractSpecification<M::PairedCurrency>

The contract specification.

source§

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

source

pub fn starting_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 initial_leverage(&self) -> Leverage

The leverage initially set by the user.

source§

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

source

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

Create a new Config.

§Arguments:

fee_maker: The maker fee as fraction, e.g 6bp -> 0.0006 fee_taker: The taker fee as fraction 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. initial_leverage: The initial desired leverage of positions. contract_specification: More details on the actual contract traded.

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