Historical data, how to copy them

I often had to use this method to copy fixings data from one environment to another (Especially inflation data). So here’s how I am copying historical data from one place to another.

What is an historical data file?

Historical data files store the past fixings. Through the GUI, they’re attached to indexes under the name archiving group. One historical data file might contain multiple indices: different currencies (rates), different frequencies (rates), different publication time (FX), etc…

To identify the one that contains the data you need, best is to use DBX Request (search the blog for earlier posts 🙂 ) with a trigger on HBS, You will get something like BXXXXXX_HBS. The XXXX is the historical data file number you need to use, it is unique for each archiving group and if you create the same archiving group in 2 different environments, nothing guarantees that you end up with the same number.

How is the historical data structured?

You have a header and a body. Header file sits as HXXXXXX_H1S (or H2S) and the body is BXXXXXX_HBS. Header determines how is the unique ID for the body assigned: what currency, what frequency. The body has the following info: unique ID, date, rate and effective date (if used). So if you retrieve the unique ID you need (for instance EUR 6M index) from the header, you can then simply retrieve the rows you need from the body (or update them).

How to copy the historical data?

If you understood the above, it becomes then quite simple! Find the historical file you need to copy from and the one you need to copy to. Simply insert the lines from the source into the destination (if you’re copying the whole table, a simple sp_rename on the table does the trick). Once copied, update the unique ID in the body table to match the ID you have in the header. And that’s it.

If you need to do it cross environments, you can use the transfer from RDB to DBF to dump the table onto unix. Copy the file into the destination environment and DBF to RDB to re-upload the table.

There are of course other ways to do it (such as using MDRS) but I tend it to find them more cumbersome and not at all as efficient. This method is fast and easy to repeat. The only downside is that it is hard to completely automate given the uniqueness of the archiving file ID.

If anyone else has a better method (or recommendations), feel more than welcome to share!