# Bootstrap Default Probability Curve from Market `CDS` Instruments

This example shows how to use `defprobstrip` to bootstrap a `defprobcurve` object based on market `CDS` instruments.

### Create `ratecurve` Object for Zero-Rate Curve

Create a `ratecurve` object using `ratecurve`.

```Settle = datetime(2017,9,15); ZeroTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20 30])]; ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307]'; ZeroDates = Settle + ZeroTimes; ZeroCurve = ratecurve("zero",Settle,ZeroDates,ZeroRates);```

### Market CDS Spreads and Vector of Market `CDS` Instruments

Define the market CDS spreads and use `fininstrument` to create a vector of market `CDS` instrument objects.

```SpreadTimes = [1 2 3 4 5 7 10 20 30]'; Spread = [140 175 210 265 310 360 410 460 490]'; MarketDates = datemnth(Settle,12*SpreadTimes); NumMarketInst = length(MarketDates); ContractSpreadBP = zeros(NumMarketInst,1); MarketCDSInstruments(NumMarketInst,1) = fininstrument("cds", ... 'ContractSpread', ContractSpreadBP(end), 'Maturity', MarketDates(end)); for k = 1:NumMarketInst MarketCDSInstruments(k,1) = fininstrument("cds", ... 'ContractSpread', ContractSpreadBP(k), 'Maturity', MarketDates(k)); end```

Use `defprobstrip` to create a `defprobcurve` object.

`DefaultProbCurve = defprobstrip(ZeroCurve,MarketCDSInstruments, Spread)`
```DefaultProbCurve = defprobcurve with properties: Settle: 15-Sep-2017 Basis: 2 Dates: [9x1 datetime] DefaultProbabilities: [9x1 double] ```