TrueFxAdapters { public static Ticker adaptTicker(TrueFxTicker rawTicker) { Date timestamp = new Date(rawTicker.getTimestamp()); CurrencyPair pair = CurrencyPairDeserializer.getCurrencyPairFromString(rawTicker.getPair()); return new Ticker.Builder() .currencyPair(pair) .timestamp(timestamp) .bid(rawTicker.calcBid()) .ask(rawTicker.calcAsk()) .high(rawTicker.getHigh()) .low(rawTicker.getLow()) .build(); }  static Ticker adaptTicker(TrueFxTicker rawTicker);  }
@Test public void adaptTickerTest() throws JsonParseException, JsonMappingException, IOException { InputStream is = getClass().getResourceAsStream("/marketdata/example-ticker.csv"); Exchange exchange = ExchangeFactory.INSTANCE.createExchange(TrueFxExchange.class); TrueFxMarketDataServiceRaw rawService = (TrueFxMarketDataServiceRaw) exchange.getMarketDataService(); ObjectMapper mapper = rawService.createObjectMapper(); TrueFxTicker rawTicker = mapper.readValue(is, TrueFxTicker.class); Ticker ticker = TrueFxAdapters.adaptTicker(rawTicker); assertThat(ticker.getCurrencyPair()).isEqualTo(CurrencyPair.GBP_USD); assertThat(ticker.getTimestamp().getTime()).isEqualTo(1490388297563L); assertThat(ticker.getBid()).isEqualTo("1.24876"); assertThat(ticker.getAsk()).isEqualTo("1.24886"); assertThat(ticker.getLow()).isEqualTo("1.24689"); assertThat(ticker.getHigh()).isEqualTo("1.25266"); }