public PooledBitfinexApiBroker(final BitfinexWebsocketConfiguration config, final BitfinexApiCallbackRegistry callbacks,
final SequenceNumberAuditor seqNoAuditor, final int channelsPerConnection) {
configuration = new BitfinexWebsocketConfiguration(config);
callbackRegistry = callbacks;
sequenceNumberAuditor = seqNoAuditor;
maxChannelsPerClient = channelsPerConnection;
connectEventManager = new EventsInTimeslotManager(1, configuration.getConnectionEstablishingDelay(), TimeUnit.MILLISECONDS);
quoteManager = new QuoteManager(this, configuration.getExecutorService());
orderbookManager = new OrderbookManager(this, configuration.getExecutorService());
rawOrderbookManager = new RawOrderbookManager(this, configuration.getExecutorService());
orderManager = new OrderManager(this, configuration.getExecutorService());
tradeManager = new TradeManager(this, configuration.getExecutorService());
positionManager = new PositionManager(this, configuration.getExecutorService());
walletManager = new WalletManager(this, configuration.getExecutorService());
connectionFeatureManager = new ConnectionFeatureManager(this, configuration.getExecutorService());
callbackRegistry.onSubscribeChannelEvent(sym -> pendingSubscriptions.forEach((client, symbols) -> symbols.remove(sym)));
callbackRegistry.onUnsubscribeChannelEvent(sym -> pendingSubscriptions.forEach((client, symbols) -> symbols.remove(sym)));
SimpleBitfinexApiBroker authClient = new SimpleBitfinexApiBroker(configuration, callbackRegistry, seqNoAuditor, true);
clients.put(numberOfClients.getAndIncrement(), authClient);
pendingSubscriptions.put(authClient, ConcurrentHashMap.newKeySet());
}