This is a common issue in programming with time series data and esp. in finance. Given two lists with dates, how can you join them together so that events from the same date are matched -up?
Assuming the lists are sorted, you can always recursively generate a paired list with a recursive function. An example:
zipper[e_, {}, acc_] := acc
zipper[{}, e_, acc_] := acc
zipper[{{date1_, val1_}, rest1___}, {{date2_, val2_}, rest2___}, acc_] :=
Switch[Sign@DateDifference[date1, date2],
0, zipper[{rest1}, {rest2}, Append[acc, {date1, {val1, val2}}]],
1, zipper[{rest1}, Join[{{date2, val2}}, {rest2}], acc] ,
-1, zipper[Join[{{date1, val1}}, {rest1}], {rest2}, acc]
]
This joins the list like so:
msft = {{{2010, 1, 5}, 28.1}, {{2010, 1, 6}, 27.93}, {{2010, 1, 7}, 27.64}, {{2010, 1, 8}, 27.83}};
goog = {{{2010, 1, 4}, 626.75}, {{2010, 1, 5}, 623.99}, {{2010, 1, 6}, 608.26}};
zipper[msft, goog, {}]
{{{2010, 1, 5}, {28.1, 623.99}}, {{2010, 1, 6}, {27.93, 608.26}}}
Only the dates which show up in both lists are kept. For each date we hav a list of pairs.