/usr/include/ql/experimental/credit/recoveryratemodel.hpp is in libquantlib0-dev 1.7.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2009 Jose Aparicio
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy of the license along with this program; if not, please email
<quantlib-dev@lists.sf.net>. The license is also available online at
<http://quantlib.org/license.shtml>.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
#ifndef quantlib_recovery_rate_model_hpp
#define quantlib_recovery_rate_model_hpp
#include <ql/settings.hpp>
#include <ql/handle.hpp>
#include <ql/experimental/credit/defaultprobabilitykey.hpp>
#include <ql/experimental/credit/recoveryratequote.hpp>
namespace QuantLib {
/*! Models of the recovery rate provide future values of a recovery
rate in the event of a default.
*/
class RecoveryRateModel : public virtual Observable {
public:
/*! returns the expected recovery rate at a future time conditional
on some default event type and seniority.
*/
virtual Real recoveryValue(const Date& defaultDate,
const DefaultProbKey& defaultKey = DefaultProbKey()) const {
// no check on dates...
return recoveryValueImpl(defaultDate, defaultKey);
}
/*! Returns true if the model will return recovery rates for
the requested seniority.
*/
virtual bool appliesToSeniority(Seniority) const = 0;
virtual ~RecoveryRateModel() {}
protected:
/*! Returns Null<Real> if unable to produce a recovery for
the requested seniority.
*/
virtual Real recoveryValueImpl(const Date&,
const DefaultProbKey& defaultKey
) const = 0;
};
/*! Simple Recovery Rate model returning the constant value of the quote
independently of the date and the seniority.
*/
class ConstantRecoveryModel : public RecoveryRateModel,
public Observer {
public:
ConstantRecoveryModel(const Handle<RecoveryRateQuote>& quote);
ConstantRecoveryModel(Real recovery,
Seniority sen = NoSeniority);
void update() { notifyObservers();}
bool appliesToSeniority(Seniority) const {return true;}
protected:
/*! Notice the quote's value is returned without a
check on a match of the seniorties of the
quote and the request.
*/
Real recoveryValueImpl(const Date&,
const DefaultProbKey&) const {
// no match on requested seniority, all pass
return quote_->value();
}
private:
Handle<RecoveryRateQuote> quote_;
};
}
#endif
|