Bot now takes a vec of pairs directly

This commit is contained in:
Giulio De Pasquale 2021-03-02 17:16:27 +00:00
parent 78b5b4d0f7
commit fbe445f712

View File

@ -20,18 +20,12 @@ impl BfxBot {
// TODO: change constructor to take SymbolPairs and not Symbol // TODO: change constructor to take SymbolPairs and not Symbol
pub fn new( pub fn new(
exchanges: Vec<ExchangeDetails>, exchanges: Vec<ExchangeDetails>,
trading_symbols: Vec<Symbol>, trading_pairs: Vec<SymbolPair>,
quote: Symbol,
tick_duration: Duration, tick_duration: Duration,
) -> Self { ) -> Self {
let pairs: Vec<_> = trading_symbols
.iter()
.map(|x| SymbolPair::new(quote.clone(), x.clone()))
.collect();
let exchange_managers = exchanges let exchange_managers = exchanges
.iter() .iter()
.map(|x| ExchangeManager::new(x, &pairs)) .map(|x| ExchangeManager::new(x, &trading_pairs))
.collect(); .collect();
BfxBot { BfxBot {