class RateController {

	@GetMapping("/history")
	public List<DateValueDTO> findHistoricalValues(@RequestParam String fromcur, @RequestParam String tocur, 
			@DateTimeFormat(iso = ISO.DATE_TIME) Instant startDate,
			@DateTimeFormat(iso = ISO.DATE_TIME) Instant endDate) {

		if (startDate == null) {
			startDate = rateService.getOldestRateDate(fromcur, tocur);
		}

		if (endDate == null) {
			endDate = rateService.getNewestRateDate(fromcur, tocur);
		}

		return dateValueMapper.toDateValueDto(rateService.getHistoricalValues(fromcur, tocur, startDate, endDate));
	}

}