public OrderbookManager(final BitfinexWebsocketClient client, ExecutorService executorService) { super(client, executorService); this.channelCallbacks = new BiConsumerCallbackManager<>(executorService, client); client.getCallbacks().onOrderbookEvent((sym,entries) -> { entries.forEach(e -> handleNewOrderbookEntry(sym, e)); }); }
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()); }
public SimpleBitfinexApiBroker(final BitfinexWebsocketConfiguration config, final BitfinexApiCallbackRegistry callbackRegistry, final SequenceNumberAuditor sequenceNumberAuditor, final boolean skipConnectionStateNotification) { this.configuration = new BitfinexWebsocketConfiguration(config); this.callbackRegistry = callbackRegistry; this.skipConnectionStateNotification = skipConnectionStateNotification; this.channelIdToHandlerMap = new ConcurrentHashMap<>(); this.permissions = BitfinexApiKeyPermissions.NO_PERMISSIONS; this.sequenceNumberAuditor = sequenceNumberAuditor; this.lastHeartbeat = new AtomicLong(0); this.orderbookManager = new OrderbookManager(this, configuration.getExecutorService()); this.rawOrderbookManager = new RawOrderbookManager(this, configuration.getExecutorService()); this.orderManager = new OrderManager(this, configuration.getExecutorService()); this.tradeManager = new TradeManager(this, configuration.getExecutorService()); this.positionManager = new PositionManager(this, configuration.getExecutorService()); this.walletManager = new WalletManager(this, configuration.getExecutorService()); this.quoteManager = new QuoteManager(this, configuration.getExecutorService()); this.connectionFeatureManager = new ConnectionFeatureManager(this, configuration.getExecutorService()); setupCommandCallbacks(); }