https://github.com/hroptatyr/thh
trading hours and holidays, or how to track rule-based recurring and one-off events efficiently
https://github.com/hroptatyr/thh
Last synced: 3 months ago
JSON representation
trading hours and holidays, or how to track rule-based recurring and one-off events efficiently
- Host: GitHub
- URL: https://github.com/hroptatyr/thh
- Owner: hroptatyr
- Created: 2011-11-26T10:23:05.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2013-02-19T15:17:35.000Z (over 12 years ago)
- Last Synced: 2025-06-01T09:46:18.929Z (4 months ago)
- Language: Common Lisp
- Homepage:
- Size: 313 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
thh
===Tracking holidays and opening hours. thh provides both a domain
specific language (DSL) to represent holidays, working hours and rules
related to them in the context of families that make sense (mostly
markets and products) as well as a compiler to produce an
easy-to-process unrolled version of the input that we call thh unrolled
file format or tuff for short.Such tuff files can be used with other tools, dateutils for instance, to
specifically answer questions like: What was the state of family X at Y,
or more specifically in the context of markets and traded products
listed at these markets: Was it possible on market X to trade product Y
on 3 Nov 2011?While the file format, tuff, is actually fixed already, the DSL is not.
We are currently gathering use cases to make sure, we can represent
anything that the markets have in store for us.Objectives
==========+ holiday rules, if they are recurring, should be represented as such
Why Common Lisp?
================Short answer, why not? See Graham's blub paradoxon and tell me what
exactly I miss out on when using lisp.Long answer:
+ object oriented (with a working class system)
+ multi dispatch
+ exceptions with restartsCommon Lisp's class system paired with closures allows proper and small
classes (in the categorical sense), other object system insist on
hierarchy, they only support small classes. I'm not an object-oriented
thinker but everyone else seems to be, so I chose a class system that
actually works in my eyes, isn't that a good compromise?Multi dispatch is not strictly necessary for such a small system but it
has proved to be useful already. More on this later.Exceptions with restarts, a must have if you're evaluating other
people's code. And in this particular scenario it's even worse,
people's code is both the outer driver as well as the guts behind the
scenes, thh is quite inbetween these two:people's rulesets people's fine-controlled rules
\ /
thh compiler /
\ .
code generated by people's rulesets but which contains code from
the people again
\ .
\ /
Exception Party