Join GitHub today
Simple UK Gas Forward Sample
The following sample captures the physical and cash flows found in a simple monthly UK Gas Forward delivering 1000 Therms per day on the UK NBP Market for each day in April 2012, at a price of 67 pence per therm. There is a generic fee (a 'generalFee' - these are defined in a separate configuration file) of 100 GBP which is paid at the moment of acquisition.
import Common contract = forward (fixedFee generalFee 100) (Market gas thm nbp) 1000 0.67 gbp cash [ date 2012 4 d | d <- [1..30] ] [ date 2012 4 d | d <- [1..30] ]
This is the Syntax Tree in SVG, as created by the Visualise command line tool. You may want to open it full screen by clicking here. You may notice that the lower right elements contain nothing but an elipsis (...) - this is because the depth exceeded the limit used as a command line argument to the visualise tool. This can be set to any arbitrary number, however, for very complex contracts this can lead to very large SVG files.
Looking at the Syntax Tree, it is clear that there are two key paths through this contract - the Physical gas in one path, and the Financial cash in the other. These are separate to allow for independent schedules for the Physical Gas and the Financial cash flows, as is normally found.
This is the Decision Tree in SVG, as created by the Visualise command line tool with the contract aquisition date/time set to 00:00:00 on 2011-1-1. Note that it also uses the elipsis representation for items beyond the configured depth limit. You may want to open it full screen by clicking here.