I want to create a database to store forex exchange rates using this code into PostgreSQL:
RestTemplate restTemplate = new RestTemplate();
String url = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml";
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
System.out.println(response.getBody());
I’m not sure wat table structure should be the best option to use. The only model for now that I can think of is:
currency | rate | date |
---|---|---|
EUR | 1.21 | 2011-11-2 |
JPY | 2.11 | 2011-11-2 |
GBP | 1.3 | 2011-11-2 |
CAD | 2.1 | 2011-11-2 |
EUR | 1.21 | 2012-11-2 |
JPY | 2.11 | 2012-11-2 |
GBP | 1.3 | 2012-11-2 |
CAD | 2.1 | 2012-11-2 |
Is it better to use for example direct store of a XML file into database or there is a better more optimized way?