I'm doing some research around cryptocurrencies and when getting to the technical aspects of it I found a problem that maybe its more common and someone already found a solution.
I have found a database with historic information by product and it has different tables for the different combinations but the structure of the table is the same.
I have design this DBO, nothing rocket science:
public class ProductHistoryDbo {
private long id;
private long startTime;
private long endTime;
private float low;
private float high;
private float open;
private float close;
private float volume;
}
And the database has one table per (exchange, currency_in, currency_to)
product_history_gdax_bch_btc
product_history_gdax_bch_eur
...
There are 12 tables with the same structure and one additional with all the other tables that you can find inside.
So my idea is to have only one Entity and Repository but dynamically change, if possible, from which table to retrieve the data in spring-boot in order to adapt if in the future new tables are added without the need of adding boilerplate code.
Final E2E is to have an admin page with a combobox with all the tuples which will do a request to this server and changes in the database will not imply a change in the backend code.