public SwapManager( IAccount account, ISwapClient swapClient, ICurrencyQuotesProvider quotesProvider, IMarketDataRepository marketDataRepository) { _account = account ?? throw new ArgumentNullException(nameof(account)); _swapClient = swapClient ?? throw new ArgumentNullException(nameof(swapClient)); _quotesProvider = quotesProvider; _marketDataRepository = marketDataRepository ?? throw new ArgumentNullException(nameof(marketDataRepository)); var currencySwaps = _account.Currencies .Select(c => { var currencySwap = CurrencySwapCreator.Create( currency: c, account: _account); currencySwap.InitiatorPaymentConfirmed += InitiatorPaymentConfirmed; currencySwap.AcceptorPaymentConfirmed += AcceptorPaymentConfirmed; currencySwap.AcceptorPaymentSpent += AcceptorPaymentSpent; currencySwap.SwapUpdated += SwapUpdatedHandler; return(currencySwap); }); _currencySwaps = currencySwaps.ToDictionary(cs => cs.Currency); }
public SwapManager(IAccount account, ISwapClient swapClient) { _account = account ?? throw new ArgumentNullException(nameof(account)); _swapClient = swapClient ?? throw new ArgumentNullException(nameof(swapClient)); _currencySwaps = _account.Currencies .Select(c => { var currencySwap = CurrencySwapCreator.Create( currency: c, account: _account, swapClient: swapClient); currencySwap.InitiatorPaymentConfirmed += InitiatorPaymentConfirmed; currencySwap.AcceptorPaymentConfirmed += AcceptorPaymentConfirmed; currencySwap.AcceptorPaymentSpent += AcceptorPaymentSpent; currencySwap.SwapUpdated += SwapUpdatedHandler; return(currencySwap); }) .ToDictionary(cs => cs.Currency); _semaphores = new ConcurrentDictionary <long, SemaphoreSlim>(); }