CREATE TABLE history_data (
      currency_id varchar
    , curs_date timestamptz
    , num_code smallint
    , char_code varchar
    , nominal integer
    , currency_value DECIMAL(19,4)
    , unique (currency_id, curs_date)
);

CREATE INDEX id_date_code
ON history_data (currency_id, curs_date, char_code);

CREATE TABLE currency (
      currency_id varchar
    , naming varchar
);