6.893 Architecture of Database Systems
Term Project
Internal Representation of Data
The first task was to choose an internal representation for the WSTD datatype.
Clearly, the WSTD needs to be associated with DJIA information so my first instinct
was to create the WSTD as a struct containing three elements - year, day and DJIA value.
However, after thinking about this a little more, it seems a little strange for a user
to have to know the DJIA when creating a new WSTD object. I decided therefore that the
internal representation of the WSTD should be kept simple hence should contain only the
year and the day. Everything else would be implemented as functions. The following is the
definition of WSTD in wstd.h.
typedef struct wstd
{
int year;
int day;
} wstd;
Understanding the Wall Street Calendar
I found this component of the project to be more complicated that the coding. There are
built in functions which will allow us to determine which day of the week a particular
date will fall on and in fact, a formula exists which allows us to calculate this for
ourselves if necessary, but how do we calculate the date corresponding to a given Wall
Street trading day when you have to take into account public holidays, etc.? This was
a problem that stumped me for quite a while. Fortunately, I figured this out....
Data on Dow Jones Industrial Average
While searching the web, I found data for the Dow Jone Industrial Averages for each trading day from
1 Jan 1987 to 9 Sep 2001! This was the solution I had been looking for. With this table,
I was able to determine the correspondence between Wall Street Trading days and actual calendar
dates without having to worry about public holidays just by doing a table lookup, which is really
what a database is good for!