Handling time variant data
Consider a rate or price feed - all bankers and energy traders have to deal with this regularly.
Basically there is a set of values (the price or the rate) for a specific commodity / index / currency from a specific data source.
Now you can have values for a year, which may be further qualified by values for every month, that is again qualified by values for each day in the month - which is again qualified by values for every hour for that day and so on....(it depends on the business domain or the commodity or even on the customer) . We (developers) should not assume the precision of the time spread.
The problem is
1. How do I abstract this price information or rate information in such a way the clients can access aggregate (or summarized) values without really being concerned whether detail values (more precise) exist or not.
For example a price feed provided you hourly prices for this month, but only monthly prices for months beyond this month, only quarterly prices for the months beyond 6 months and yearly prices for anything further.
Assume today is Apr 01 1004 . How do I access the price from the abstraction for
a) April 01 2004 14:00:35
b) April 02 2004 13:00:00
c) May 05 2004
d) October 10 2004
e) April 01 2005
It means that is a specific (detail) price exist use that otherwise use the next summarized price.
I am thinking about a tree where each Node has aggregate properties based on the properties of the child nodes. Each nod then becomes a collection whose individual properties are aggregate values form the child nodes.
A DAY Node has a price property - which is the average (on type of aggregation) of the price of all its HOUR Child Nodes.
Another DAY Node does not have children at all (any specifics) - in that case the price is a fixed (allotted) price and not an aggregate price.


0 Comments:
Post a Comment
<< Home