DiscountCurve





http://www.QuantTools.com
CapeTools Curves function list

Welcome | Documentation format | QuantTools Groups | QuantTools Categories | Licence

Key TAGs | Excel Index | API Index



Creates a discount curve from Tenors (or Dates) and discount factor inputs.

Whether using Tenors or Dates, the first point must be a date value equal to the ValueDate value (passed into the 'ValueDate' parameter of this function) and must have a discount value of 1. Further points most have discount value inputs of decreasing value but values greater than 0. This curve cannot be used to determine interest rate market rates (SWAP rates , CMS rates etc...).

You can use this curve to compute discount factors, forward rates and zero rates.

If you do want to use market information that can price various financial products (Bonds, Swaps, various legs etc...) use one of the following category of functions : CapeTools Curves, CapeTools XCCY Curves or CapeTools Bond Curves or you can employ a risky curve via Credit Default Curves (CapeTools Credit Curves).

(You cannot use the DiscountCurve(), ForwardCurve(), ZeroCurve() or FlatYieldCurve() functions as these do not contain enough information for pricing.).

These curves take in extra information pertaining to the interest rate market and can be used to also prices interest rate deals (in regards to the computation of fixing or reset rates).



This function creates an object and returns a string-key value to represent this created object.
The TAG value of the string-key returned (second part of the key) is : "DYC"



Note: Within Excel, the function is named - CT.CRV.DiscountCurve




High level graphic of DiscountCurve() function with parameters. Blue square node is the actual function with the parameters ordered.



Parameter Description


  1. Key parameter

    Key value to use as a handle for the created object
  2. Reload parameter

    When creating this object for the first time, set this parameter to a positive value. Within Excel, when re-computing a worksheet where you do not wish to recreate the object, set this parameter to zero (0).
  3. ValueDate parameter

    Key to an already created Valuation Date Object. (Via the ValueDateObj() function).
  4. oTenorsVals parameter

    A 2 column range of Tenors (or Dates) and discount factors.
  5. DayCount parameter

    DayCounter to use
  6. Cal parameter

    Calendar to use for the adjustment of dates that lands on a holiday or weekend, if you use the EmptyCalendar() function, no adjustments will be made
  7. BusDayConv parameter

    Business Day Convention. treatment of date adjustments
  8. Extrapolate parameter

    Whether the yieldCurve data should be extrapolated if a calculation request that uses a date that is beyond the end date of the yieldCurve (ie - a request for a 40 year discount factor, but the curve is only built up to 30 years.) If false an error will be returned. This setting is set globally for the whole curve. We strongly advise you to populate the curve up to the point you are pricing to.


Extended information

Function Syntax

VB Syntax


String CTCurves.DiscountCurve( _
String Key, _
Long Reload, _
String ValueDate, _
Variant oTenorsVals, _
DayCountEnum DayCount, _
String Cal, _
BDCEnum BusDayConv, _
Boolean Extrapolate)


Excel Spreadsheet Syntax


=CT.CRV.DiscountCurve(
Excel String Cell Key,
Excel Numeric Cell Reload,
Excel String Cell ValueDate,
XLRange oTenorsVals,
Excel String Cell DayCount,
Excel String Cell Cal,
Excel String Cell BusDayConv,
Excel Boolean Value Cell Extrapolate)


C++ Syntax


static std::string DiscountCurve(
std::string Key,
long Reload,
std::string ValueDate,
CTRangeDataCPP oTenorsVals,
DayCountEnum DayCount,
std::string Cal,
BDCEnum BusDayConv,
bool Extrapolate);


DotNET Syntax


System.String CTCurvesSA.DiscountCurve(
System.String Key,
System.Int32 Reload,
System.String ValueDate,
CTRangeData oTenorsVals,
CTIEnums.DayCountEnum DayCount,
System.String Cal,
CTIEnums.BDCEnum BusDayConv,
System.Boolean Extrapolate);

Parameter data types

ArgNameArgTypeIsKey
KeyStringFALSE
ReloadLongFALSE
ValueDateStringTRUE
oTenorsValsRangeFALSE
DayCountDayCountEnumFALSE
CalStringTRUE
BusDayConvBDCEnumFALSE
ExtrapolateBooleanFALSE


Example Inputs

The first column represents the name of the parameters. The second column specifies whether the parameters are optional or not. Finally the last column provides some sample input data.
Function call input string-keys are always in the format : "NAME.EXTTAG.TICKER" The "EXTTAG.TICKER" part is determined from the output of other, capetools, object creation functions.


ArgNameIsOptional (Excel only)Example
KeyFALSEMyDiscountCurve
ReloadFALSE1
ValueDateFALSEValueDateNAME.EXTTAG.TICKER (from a function call)
oTenorsValsFALSEDiscountCurve_oTenorsVals_Range (creates a range object)
DayCountFALSEACT365F
CalFALSECalNAME.EXTTAG.TICKER (from a function call)
BusDayConvFALSEModifiedFollowing
ExtrapolateFALSEtrue


Example range for parameter : oTenorsVals

Within Excel, a range such as this can be passed directly into the oTenorsVals parameter.

19/Jul/20051True
1M0.99063True
2M0.98346True
3M0.978True
4M0.96907True
5M0.96083True
6M0.9537True
7M0.94659True
8M0.94095True
9M0.9316True
10M0.92534True
2Y0.90893True
3Y0.90012True
4Y0.88864True
5Y0.87439True
6Y0.85604True
7Y0.83928True
8Y0.82466True
9Y0.80644True
10Y0.7979True
11Y0.78079True
12Y0.76786True
13Y0.7525True
14Y0.73447True
15Y0.71935True
16Y0.7116True
17Y0.69605True
18Y0.68124True
19Y0.67117True
20Y0.65283True
21Y0.63903True

Example C# API usage for setting the range data for parameter : oTenorsVals



CTQL.CTRangeData DiscountCurve_oTenorsVals = new CTQL.CTRangeData();

System.Text.StringBuilder DiscountCurve_oTenorsVals_builder =
new System.Text.StringBuilder(100);

DiscountCurve_oTenorsVals_builder.Append("{");
DiscountCurve_oTenorsVals_builder.Append("#19/Jul/2005#	 | 1	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'1M'	 | 0.99063	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'2M'	 | 0.98346	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'3M'	 | 0.978	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'4M'	 | 0.96907	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'5M'	 | 0.96083	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'6M'	 | 0.9537	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'7M'	 | 0.94659	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'8M'	 | 0.94095	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'9M'	 | 0.9316	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'10M'	 | 0.92534	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'2Y'	 | 0.90893	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'3Y'	 | 0.90012	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'4Y'	 | 0.88864	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'5Y'	 | 0.87439	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'6Y'	 | 0.85604	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'7Y'	 | 0.83928	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'8Y'	 | 0.82466	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'9Y'	 | 0.80644	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'10Y'	 | 0.7979	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'11Y'	 | 0.78079	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'12Y'	 | 0.76786	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'13Y'	 | 0.7525	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'14Y'	 | 0.73447	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'15Y'	 | 0.71935	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'16Y'	 | 0.7116	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'17Y'	 | 0.69605	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'18Y'	 | 0.68124	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'19Y'	 | 0.67117	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'20Y'	 | 0.65283	 | True ;");
DiscountCurve_oTenorsVals_builder.Append("'21Y'	 | 0.63903	 | True");
DiscountCurve_oTenorsVals_builder.Append("}");

// Parse the string into the Range object.
DiscountCurve_oTenorsVals.RangeFromStr( DiscountCurve_oTenorsVals_builder.ToString() );



Example function usage


The C# example below contains all the sub-function calls leading up to this function call. As a result, the example can contain a lot of code.

The VB.NET, J#, C++.NET, Java, Excel VBA, Visual Basic 6 (via COM) and C++ examples below contain function code stubs for the calls leading up to this function call. However, the function call for this function is displayed.
You can easily reproduce the stub functions code from the C# example.


If you are accessing this functrion via the MiniXL libraries, this function is present within the CT.QL.Curves20 MiniXL Excel Addin.

Within our Excel Example Addin Generator, we have used the following QuantTools sub-functions in order to prepare the arguments needed to call the DiscountCurve() function. If you are executing this function via the MiniXL libraries, the module addin name, (in brackets, to the right of the sub-functions listed below), indicates the MiniXL library in which the sub-function is held. You will need to load this library into your Excel session (along with any other libraries that the sub-function call within the addin requires (ie - CT.QT.Utils20 addin in almost all cases) in order for the example to compute successfully.

These are the financial QuantTools sub-function calls that are used within the examples :





The objects generated by these sub-functions are inter-connected in the following way :




The following four examples demostrate calling this function within a Microsoft .NET environment

The following four examples demostrate calling this function within a non .NET environment

The following is a sample output from executing the DiscountCurve() function call


MyDiscountCurve_3.DYC.0

Copyright (c) 2003-2007 CapeTools - All Rights Reserved.