CDBinarySwapObj





http://www.QuantTools.com
CapeTools Credit Default Swaps function list

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

Key TAGs | Excel Index | API Index



Creates a Credit Default Swap object.



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 : "CDSBOBJ"



Note: Within Excel, the function is named - CT.CDS.CDBinarySwapObj




High level graphic of CDBinarySwapObj() 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. payPremium parameter

    Whether we are paying the premium rate.
  4. StartDate parameter

    Initial Start Date.
  5. EndDate parameter

    Final End Date.
  6. PayOffRate parameter

    The PayOff Rate.
  7. Premium parameter

    Premium
  8. FixedPremiums parameter

    A two-column (Date, PremiumValue) fixed premiums table. Premiums before the start and after the end date of the Credit default swap contract will be ignored.
  9. Notional parameter

    Notional
  10. premiumFreq parameter

    Premium Frequency. Can use any of the Frequency codes contained within the 'CapeTools Frequency Enums' category of functions.
  11. DefaultFreq parameter

    The frequency of default within a premium period. Can use any of the Frequency codes contained within the 'CapeTools Frequency Enums' category of functions. This frequency should be equal to or less than (in terms of the length of the frequency period) the 'premiumFreq' parameter.
  12. payaccrued parameter

    Whether any accrued premiums are paid upon default.
  13. DayCount parameter

    DayCounter to use
  14. 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
  15. BusDayConv parameter

    Business Day Convention. treatment of date adjustments
  16. CDCKey parameter

    Key to an already constructed Credit Default Curve object.


Extended information

Function Syntax

VB Syntax


String CTCreditDefaultSwaps.CDBinarySwapObj( _
String Key, _
Long Reload, _
Boolean payPremium, _
Long StartDate, _
Long EndDate, _
Double PayOffRate, _
Double Premium, _
Variant FixedPremiums, _
Double Notional, _
FreqEnum premiumFreq, _
FreqEnum DefaultFreq, _
Boolean payaccrued, _
DayCountEnum DayCount, _
String Cal, _
BDCEnum BusDayConv, _
String CDCKey)


Excel Spreadsheet Syntax


=CT.CDS.CDBinarySwapObj(
Excel String Cell Key,
Excel Numeric Cell Reload,
Excel Boolean Value Cell payPremium,
Excel Numeric Cell StartDate,
Excel Numeric Cell EndDate,
Excel Numeric Cell PayOffRate,
Excel Numeric Cell Premium,
XLRange FixedPremiums,
Excel Numeric Cell Notional,
Excel String Cell premiumFreq,
Excel String Cell DefaultFreq,
Excel Boolean Value Cell payaccrued,
Excel String Cell DayCount,
Excel String Cell Cal,
Excel String Cell BusDayConv,
Excel String Cell CDCKey)


C++ Syntax


static std::string CDBinarySwapObj(
std::string Key,
long Reload,
bool payPremium,
long StartDate,
long EndDate,
double PayOffRate,
double Premium,
CTRangeDataCPP FixedPremiums,
double Notional,
FreqEnum premiumFreq,
FreqEnum DefaultFreq,
bool payaccrued,
DayCountEnum DayCount,
std::string Cal,
BDCEnum BusDayConv,
std::string CDCKey);


DotNET Syntax


System.String CTCreditDefaultSwapsSA.CDBinarySwapObj(
System.String Key,
System.Int32 Reload,
System.Boolean payPremium,
System.Int32 StartDate,
System.Int32 EndDate,
System.Double PayOffRate,
System.Double Premium,
CTRangeData FixedPremiums,
System.Double Notional,
CTIEnums.FreqEnum premiumFreq,
CTIEnums.FreqEnum DefaultFreq,
System.Boolean payaccrued,
CTIEnums.DayCountEnum DayCount,
System.String Cal,
CTIEnums.BDCEnum BusDayConv,
System.String CDCKey);

Parameter data types

ArgNameArgTypeIsKey
KeyStringFALSE
ReloadLongFALSE
payPremiumBooleanFALSE
StartDateLongFALSE
EndDateLongFALSE
PayOffRateDoubleFALSE
PremiumDoubleFALSE
FixedPremiumsRangeFALSE
NotionalDoubleFALSE
premiumFreqFreqEnumFALSE
DefaultFreqFreqEnumFALSE
payaccruedBooleanFALSE
DayCountDayCountEnumFALSE
CalStringTRUE
BusDayConvBDCEnumFALSE
CDCKeyStringTRUE


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
KeyFALSEMyCDBinarySwapObj
ReloadFALSE1
payPremiumFALSEfalse
StartDateFALSE21/Jul/2006 (serial date type)
EndDateFALSE21/Jul/2011 (serial date type)
PayOffRateFALSE0.4
PremiumFALSE0.04
FixedPremiumsTRUECDBinarySwapObj_FixedPremiums_Range (creates a range object)
NotionalFALSE1000000
premiumFreqFALSEQ
DefaultFreqFALSEM
payaccruedFALSEfalse
DayCountFALSEACT365F
CalFALSECalNAME.EXTTAG.TICKER (from a function call)
BusDayConvFALSEModifiedFollowing
CDCKeyFALSECDCKeyNAME.EXTTAG.TICKER (from a function call)


Example range for parameter : FixedPremiums

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

21/Jul/20061

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



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

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

CDBinarySwapObj_FixedPremiums_builder.Append("{");
CDBinarySwapObj_FixedPremiums_builder.Append("#21/Jul/2006#	 | 1");
CDBinarySwapObj_FixedPremiums_builder.Append("}");

// Parse the string into the Range object.
CDBinarySwapObj_FixedPremiums.RangeFromStr( CDBinarySwapObj_FixedPremiums_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.CreditDerivatives20 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 CDBinarySwapObj() 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 CDBinarySwapObj() function call


MyCDBinarySwapObj_2.CDSBOBJ.0

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