pub struct Config<M>where
M: Currency,{ /* private fields */ }
Expand description
Define the Exchange configuration
Implementations§
source§impl<M> Config<M>where
M: Currency,
impl<M> Config<M>where
M: Currency,
sourcepub fn contract_spec(&self) -> &ContractSpecification<M::PairedCurrency>
pub fn contract_spec(&self) -> &ContractSpecification<M::PairedCurrency>
The contract specification.
source§impl<M> Config<M>where
M: Currency,
impl<M> Config<M>where
M: Currency,
sourcepub fn starting_wallet_balance(&self) -> M
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.
sourcepub fn max_num_open_orders(&self) -> usize
pub fn max_num_open_orders(&self) -> usize
The maximum number of open orders the user can have at any given time
sourcepub fn sample_returns_every_n_seconds(&self) -> u64
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,
impl<M> Config<M>where
M: Currency,
sourcepub fn new(
starting_balance: M,
max_num_open_orders: usize,
contract_specification: ContractSpecification<M::PairedCurrency>,
sample_returns_every_n_seconds: u64,
) -> Result<Self>
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