(* :Title: Template *) (* :Context: QuantLib`Template` *) (* :Author: Niels Elken Sønderby *) (* :Mathematica Version: 4.0 *) (* :Copyright: Copyright (C) 2003 Niels Elken Sønderby *) (* :License: This file is part of QuantLib for Mathematica, a Mathematica extension for QuantLib, a free-software/open-source financial C++ library - http://www.nielses.dk/quantlib/mma/ - http://quantlib.org/ QuantLib for Mathematica is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email ferdinando@ametrano.net The license is also available online at http://quantlib.org/html/license.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. *) BeginPackage["QuantLib`Template`", "QuantLib`Options`" (* Needs models from `Options` *) ] (* Usage messages *) Template::usage = "Template[{y, m, d}] gives ... " Begin["`Private`"] (* Give access to QuantLib`Private` context as LinkPatterns for external program are there. Does a more elegant solution exist? *) AppendTo[$ContextPath, "QuantLib`Private`"] Template[{y_, m_, d_}, days_, opts___?OptionQ] := Module[{holidaycal, calnum}, holidaycal = HolidayCalendar /. {opts} /. Options[ShiftDate]; If[holidaycal === None, calnum=0, calnum=SymbolToNumber[holidaycal, HolidayCalendarNumbers]]; qlShiftDate[y,m,d,0,0,days,calnum] ] Options[DaysPlus] := { HolidayCalendar -> None } End[] EndPackage[]