}
@Test
public void testAdaptTicker() throws IOException {
Ticker expectedTicker =
new Ticker.Builder().currencyPair(CurrencyPair.BTC_USD).ask(new BigDecimal("723.09")).bid(new BigDecimal("723.09")).last(new BigDecimal("719.79")).low(
new BigDecimal("718.2")).high(new BigDecimal("723.11")).build();
InputStream is = CoinbaseAdapterTest.class.getResourceAsStream("/marketdata/example-price-data.json");
ObjectMapper mapper = new ObjectMapper();
CoinbasePrice price = mapper.readValue(is, CoinbasePrice.class);
CoinbaseMoney spotPrice = new CoinbaseMoney(Currencies.USD, new BigDecimal("719.79"));
is = CoinbaseAdapterTest.class.getResourceAsStream("/marketdata/example-spot-rate-history-data.json");
String spotPriceHistoryString;
Scanner scanner = null;
try {
scanner = new Scanner(is);
spotPriceHistoryString = scanner.useDelimiter("\\A").next();
} finally {
scanner.close();
}
CoinbaseSpotPriceHistory spotPriceHistory = CoinbaseSpotPriceHistory.fromRawString(spotPriceHistoryString);
Ticker ticker = CoinbaseAdapters.adaptTicker(CurrencyPair.BTC_USD, price, price, spotPrice, spotPriceHistory);
assertThat(ticker).isEqualsToByComparingFields(expectedTicker);
}