Converting from Running to Upfront

A CDS market quote is given in terms of a standard spread (usually 100 bp or 500 bp) and an upfront payment, or in terms of an equivalent running or breakeven spread, with no upfront payment. The functions `cdsbootstrap`, `cdsspread`, and `cdsprice` perform upfront to running or running to upfront conversions.

For example, to convert the market quotes to upfront quotes for a standard spread of 100 bp:

```Settle = '17-Jul-2009'; % valuation date for the CDS MarketDates = datenum({'20-Sep-10','20-Sep-11','20-Sep-12','20-Sep-14',... '20-Sep-16'}); MarketSpreads = [140 175 210 265 310]'; MarketData = [MarketDates MarketSpreads]; ZeroDates = datenum({'17-Jan-10','17-Jul-10','17-Jul-11','17-Jul-12',... '17-Jul-13','17-Jul-14'}); ZeroRates = [1.35 1.43 1.9 2.47 2.936 3.311]'/100; ZeroData = [ZeroDates ZeroRates]; [ProbData,HazData] = cdsbootstrap(ZeroData,MarketData,Settle); Maturity3 = MarketData(:,1); Spread3Run = MarketData(:,2); Spread3Std = 100*ones(size(Maturity3)); Price3 = cdsprice(ZeroData,ProbData,Settle,Maturity3,Spread3Std); Upfront3 = Price3/10000000; % Standard notional of 10MM display(Upfront3);```

This resulting value is:

```Upfront3 = 0.0047 0.0158 0.0327 0.0737 0.1182 ```

The conversion can be reversed to convert upfront quotes to market quotes:

```ProbData3Upf = cdsbootstrap(ZeroData,[Maturity3 Upfront3 Spread3Std],Settle); Spread3RunFromUpf = cdsspread(ZeroData,ProbData3Upf,Settle,Maturity3); display([Spread3Run Spread3RunFromUpf]); ```

Comparing the results of this conversion to the original market spread demonstrates the reversal:

```ans = 140.0000 140.0000 175.0000 175.0000 210.0000 210.0000 265.0000 265.0000 310.0000 310.0000```

Under the flat-hazard rate (FHR) quoting convention, a single market quote is used to calibrate a probability curve. This convention yields a single point in the probability curve, and a single hazard rate value. For example, assume a four-year (standard dates) CDS contract with a current FHR-based running spread of 550 bp needs conversion to a CDS contract with a standard spread of 500 bp:

```Maturity4 = datenum('20-Sep-13'); Spread4Run = 550; ProbData4Run = cdsbootstrap(ZeroData,[Maturity4 Spread4Run],Settle); Spread4Std = 500; Price4 = cdsprice(ZeroData,ProbData4Run,Settle,Maturity4,Spread4Std); Upfront4 = Price4/10000000; fprintf('A running spread of %5.2f is equivalent to\n',Spread4Run); fprintf(' a standard spread of %5.2f with an upfront of %8.7f\n',... Spread4Std,Upfront4);```
```A running spread of 550.00 is equivalent to a standard spread of 500.00 with an upfront of 0.0167576```

To reverse the conversion:

```ProbData4Upf = cdsbootstrap(ZeroData,[Maturity4 Upfront4 Spread4Std],Settle); Spread4RunFromUpf = cdsspread(ZeroData,ProbData4Upf,Settle,Maturity4); fprintf('A standard spread of %5.2f with an upfront of %8.7f\n',... Spread4Std,Upfront4); fprintf(' is equivalent to a running spread of %5.2f\n',Spread4RunFromUpf);```
```A standard spread of 500.00 with an upfront of 0.0167576 is equivalent to a running spread of 550.00```

As discussed in Beumee et. al., 2009 (see Credit Derivatives), the FHR approach is a quoting convention only, and leads to quotes inconsistent with market data. For example, calculating the upfront for the three-year (standard dates) CDS contract with a standard spread of 100 bp using the FHR approach and comparing the results to the upfront amounts previously calculated, demonstrates that the FHR-based approach yields a different upfront amount:

```Maturity5 = MarketData(3,1); Spread5Run = MarketData(3,2); ProbData5Run = cdsbootstrap(ZeroData,[Maturity5 Spread5Run],Settle); Spread5Std = 100; Price5 = cdsprice(ZeroData,ProbData5Run,Settle,Maturity5,Spread5Std); Upfront5 = Price5/10000000; fprintf('Relative error of FHR-based upfront amount: %3.1f%%\n',... ((Upfront5-Upfront3(3))/Upfront3(3))*100);```
`Relative error of FHR-based upfront amount: -0.8%`