diff options
Diffstat (limited to 'python/yieldcurve.py')
| -rw-r--r-- | python/yieldcurve.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/python/yieldcurve.py b/python/yieldcurve.py index 8978ecb5..65ef71bf 100644 --- a/python/yieldcurve.py +++ b/python/yieldcurve.py @@ -64,8 +64,8 @@ def get_futures_data(date = datetime.date.today()): quotes = [float(line.split(",")[1]) for line in fh] return quotes -def rate_helpers(currency="USD", MarkitData=None): - """Util function to build a list of RateHelpers +def rate_helpers(currency="USD", MarkitData=None, evaluation_date=None): + """Utility function to build a list of RateHelpers Parameters ---------- @@ -80,13 +80,15 @@ def rate_helpers(currency="USD", MarkitData=None): List of QuantLib RateHelpers """ settings = Settings() + if evaluation_date is None: + evaluation_date = pydate_from_qldate(settings.evaluation_date) if not MarkitData: - MarkitData = getMarkitIRData(pydate_from_qldate(settings.evaluation_date), currency) - if MarkitData['effectiveasof'] != pydate_from_qldate(settings.evaluation_date): + MarkitData = getMarkitIRData(evaluation_date, currency) + if MarkitData['effectiveasof'] != evaluation_date: warnings.warn("Yield curve effective date: {0} doesn't " \ "match the evaluation date: {1}".format( MarkitData['effectiveasof'], - pydate_from_qldate(settings.evaluation_date)), + evaluation_date), RuntimeWarning) settings.evaluation_date = Date.from_datetime(MarkitData['effectiveasof']) calendar = WeekendsOnly() |
