Closes the connection to the upstream server for this instance.
144145146147148149150151152153154
executorService.shutdown(); // Disconnect and exit System.out.println(Thread.currentThread().getName() + ": Disconnecting..."); streamingExchangeService.disconnect(); System.exit(0); } /** * Encapsulates some market data monitoring behavior
4950515253545556575859
// Demonstrate for 30 seconds. TimeUnit.SECONDS.sleep(30); // Disconnect streaming service. service.disconnect(); log.info("Streaming service disconnected."); // Interrupt consumer to exit. consumer.interrupt(); log.info("Consumer interrupted.");
242243244245246247248249250
System.out.println("\n\n\n\n\nCached Trades: "); System.out.println(((CoinfloorStreamingExchangeService) streamingExchangeService).getCachedTrades()); // Disconnect and exit System.out.println(Thread.currentThread().getName() + ": Disconnecting..."); streamingExchangeService.disconnect(); System.exit(0); } }
6263646566676869707172
2223242526272829303132
BitstampStreamingConfiguration streamCfg = new BitstampStreamingConfiguration(); // Interested in the public streaming market data feed (no authentication) StreamingExchangeService streamService = bitstamp.getStreamingExchangeService(streamCfg); streamService.connect(); generic(streamService); streamService.disconnect(); } private static void generic(StreamingExchangeService stream) throws IOException { try {