/usr/share/quantlib-python/convertiblebonds.i is in quantlib-python 1.2-2.
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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | /*
Copyright (C) 2006, 2007 StatPro Italia srl
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_convertible_bonds_i
#define quantlib_convertible_bonds_i
%include bonds.i
%include callability.i
%include dividends.i
%include options.i
%{
using QuantLib::ConvertibleZeroCouponBond;
using QuantLib::ConvertibleFixedCouponBond;
using QuantLib::ConvertibleFloatingRateBond;
using QuantLib::BinomialConvertibleEngine;
typedef boost::shared_ptr<Instrument> ConvertibleZeroCouponBondPtr;
typedef boost::shared_ptr<Instrument> ConvertibleFixedCouponBondPtr;
typedef boost::shared_ptr<Instrument> ConvertibleFloatingRateBondPtr;
typedef boost::shared_ptr<PricingEngine> BinomialConvertibleEnginePtr;
%}
%rename(ConvertibleZeroCouponBond) ConvertibleZeroCouponBondPtr;
class ConvertibleZeroCouponBondPtr : public BondPtr {
public:
%extend {
ConvertibleZeroCouponBondPtr(
const boost::shared_ptr<Exercise>& exercise,
Real conversionRatio,
const std::vector<boost::shared_ptr<Dividend> >& dividends,
const std::vector<boost::shared_ptr<Callability> >& callability,
const Handle<Quote>& creditSpread,
const Date& issueDate,
Integer settlementDays,
const DayCounter& dayCounter,
const Schedule& schedule,
Real redemption = 100.0) {
return new ConvertibleZeroCouponBondPtr(
new ConvertibleZeroCouponBond(exercise, conversionRatio,
dividends, callability,
creditSpread,
issueDate, settlementDays,
dayCounter, schedule,
redemption));
}
}
};
%rename(ConvertibleFixedCouponBond) ConvertibleFixedCouponBondPtr;
class ConvertibleFixedCouponBondPtr : public BondPtr {
public:
%extend {
ConvertibleFixedCouponBondPtr(
const boost::shared_ptr<Exercise>& exercise,
Real conversionRatio,
const std::vector<boost::shared_ptr<Dividend> >& dividends,
const std::vector<boost::shared_ptr<Callability> >& callability,
const Handle<Quote>& creditSpread,
const Date& issueDate,
Integer settlementDays,
const std::vector<Rate>& coupons,
const DayCounter& dayCounter,
const Schedule& schedule,
Real redemption = 100.0) {
return new ConvertibleFixedCouponBondPtr(
new ConvertibleFixedCouponBond(exercise, conversionRatio,
dividends, callability,
creditSpread,
issueDate, settlementDays,
coupons, dayCounter,
schedule, redemption));
}
}
};
%rename(ConvertibleFloatingRateBond) ConvertibleFloatingRateBondPtr;
class ConvertibleFloatingRateBondPtr : public BondPtr {
public:
%extend {
ConvertibleFloatingRateBondPtr(
const boost::shared_ptr<Exercise>& exercise,
Real conversionRatio,
const std::vector<boost::shared_ptr<Dividend> >& dividends,
const std::vector<boost::shared_ptr<Callability> >& callability,
const Handle<Quote>& creditSpread,
const Date& issueDate,
Integer settlementDays,
const IborIndexPtr& index,
Integer fixingDays,
const std::vector<Spread>& spreads,
const DayCounter& dayCounter,
const Schedule& schedule,
Real redemption = 100.0) {
boost::shared_ptr<IborIndex> libor =
boost::dynamic_pointer_cast<IborIndex>(index);
return new ConvertibleFloatingRateBondPtr(
new ConvertibleFloatingRateBond(exercise, conversionRatio,
dividends, callability,
creditSpread,
issueDate, settlementDays,
libor, fixingDays, spreads,
dayCounter, schedule,
redemption));
}
}
};
%rename(BinomialConvertibleEngine) BinomialConvertibleEnginePtr;
class BinomialConvertibleEnginePtr : public boost::shared_ptr<PricingEngine> {
public:
%extend {
BinomialConvertibleEnginePtr(
const GeneralizedBlackScholesProcessPtr& process,
const std::string& type,
Size steps) {
boost::shared_ptr<GeneralizedBlackScholesProcess> bsProcess =
boost::dynamic_pointer_cast<GeneralizedBlackScholesProcess>(
process);
QL_REQUIRE(bsProcess, "Black-Scholes process required");
std::string s = boost::algorithm::to_lower_copy(type);
if (s == "crr" || s == "coxrossrubinstein")
return new BinomialConvertibleEnginePtr(
new BinomialConvertibleEngine<CoxRossRubinstein>(
bsProcess,steps));
else if (s == "jr" || s == "jarrowrudd")
return new BinomialConvertibleEnginePtr(
new BinomialConvertibleEngine<JarrowRudd>(
bsProcess,steps));
else if (s == "eqp")
return new BinomialConvertibleEnginePtr(
new BinomialConvertibleEngine<AdditiveEQPBinomialTree>(
bsProcess,steps));
else if (s == "trigeorgis")
return new BinomialConvertibleEnginePtr(
new BinomialConvertibleEngine<Trigeorgis>(
bsProcess,steps));
else if (s == "tian")
return new BinomialConvertibleEnginePtr(
new BinomialConvertibleEngine<Tian>(bsProcess,steps));
else if (s == "lr" || s == "leisenreimer")
return new BinomialConvertibleEnginePtr(
new BinomialConvertibleEngine<LeisenReimer>(
bsProcess,steps));
else if (s == "j4" || s == "joshi4")
return new BinomialConvertibleEnginePtr(
new BinomialConvertibleEngine<Joshi4>(bsProcess,steps));
else
QL_FAIL("unknown binomial engine type: "+s);
}
}
};
#endif
|