private static void generic(Exchange exchange) throws IOException { // Interested in the public market data feed (no authentication). MarketDataService marketDataService = exchange.getMarketDataService(); // Get the latest 500 trade data for BTC/CNY. Trades trades = marketDataService.getTrades(CurrencyPair.BTC_CNY); System.out.println(trades); System.out.println( "Trades count: " + trades.getTrades().size() + ", LastID: " + trades.getlastID()); // Get 500 trades which tid > 0 trades = marketDataService.getTrades(CurrencyPair.BTC_CNY, 0); System.out.println(trades); System.out.println( "Trades count: " + trades.getTrades().size() + ", LastID: " + trades.getlastID()); }
private static void generic(Exchange okcoinExchange) throws IOException { // Interested in the public market data feed (no authentication) MarketDataService marketDataService = okcoinExchange.getMarketDataService(); // Get the latest trade data for BTC_CNY Trades trades = marketDataService.getTrades(CurrencyPair.BTC_USD, FuturesContract.ThisWeek); System.out.println(trades); System.out.println("Trades(0): " + trades.getTrades().get(0).toString()); System.out.println("Trades size: " + trades.getTrades().size()); // Get the latest trades data for BTC_CNY for the past couple of trades trades = marketDataService.getTrades(CurrencyPair.BTC_CNY, trades.getlastID() - 10); System.out.println(trades); System.out.println("Trades size: " + trades.getTrades().size()); }
public void demoTrades(CurrencyPair currencyPair) throws IOException { Trades trades = mdService.getTrades(currencyPair); log.info("trades: {}", trades.getTrades()); log.info("last ID: {}", trades.getlastID()); }