class YahooCurrencyProvider implements LatestRateProvider {

	@Override
	public List<Quote> getRates() throws IOException {
		YahooModel result = rt.getForObject(url, YahooModel.class);

		return result.getQuoteResponse().getResult().stream()
				.map(yf -> {
					Matcher m = FOREX_PATTERN.matcher(yf.getSymbol());

					m.matches();
					String source = m.group(1);
					String target = m.group(2);

					if (target == null) {
						target = source;
						source = CurrencyUtils.USD;
					}

					Instant inst = Instant.ofEpochSecond(yf.getRegularMarketTime());
					
					return new Quote(source, target, BigDecimal.valueOf(yf.getRegularMarketPrice()), inst);
				})
				.collect(Collectors.toList());
	}

}