List<CryptsyMarketData> marketData = marketsReturnData.getReturnValue();
String label = currencyPair.toString().replace("_", "/");
CryptsyMarketData targetMarket = null;
for (CryptsyMarketData currMarket : marketData) {
if (currMarket.getLabel().equalsIgnoreCase(label)) {
targetMarket = currMarket;
break;
}
}
BigDecimal last = targetMarket.getLast();
BigDecimal bid = null;
BigDecimal ask = null;
BigDecimal high = targetMarket.getHigh();
BigDecimal low = targetMarket.getLow();
BigDecimal volume = targetMarket.get24hVolume();
Date timestamp = new Date();
return new Ticker.Builder().currencyPair(currencyPair).last(last).bid(bid).ask(ask).high(high).low(low).volume(volume).timestamp(timestamp).build();
}