Skip to content

Commit

Permalink
Merge pull request lballabio#444.
Browse files Browse the repository at this point in the history
Update for interpolation and cash flows.
  • Loading branch information
lballabio authored Feb 18, 2022
2 parents 6513254 + d4d2d28 commit 0ff0103
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions SWIG/cashflows.i
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ class OvernightIndexedCoupon : public FloatingRateCoupon {
const std::vector<Date>& valueDates() const;
};

%inline %{
ext::shared_ptr<OvernightIndexedCoupon> as_overnight_indexed_coupon(
const ext::shared_ptr<CashFlow>& cf) {
return ext::dynamic_pointer_cast<OvernightIndexedCoupon>(cf);
}
%}

%{
using QuantLib::CappedFlooredCoupon;
%}
Expand Down
2 changes: 2 additions & 0 deletions SWIG/discountcurve.i
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ using QuantLib::InterpolatedDiscountCurve;
%shared_ptr(InterpolatedDiscountCurve<LogLinear>);
%shared_ptr(InterpolatedDiscountCurve<MonotonicLogCubic>);
%shared_ptr(InterpolatedDiscountCurve<SplineCubic>);
%shared_ptr(InterpolatedDiscountCurve<KrugerLog>);

template <class Interpolator>
class InterpolatedDiscountCurve : public YieldTermStructure {
Expand All @@ -52,5 +53,6 @@ class InterpolatedDiscountCurve : public YieldTermStructure {
%template(DiscountCurve) InterpolatedDiscountCurve<LogLinear>;
%template(MonotonicLogCubicDiscountCurve) InterpolatedDiscountCurve<MonotonicLogCubic>;
%template(NaturalCubicDiscountCurve) InterpolatedDiscountCurve<SplineCubic>;
%template(KrugerLogDiscountCurve) InterpolatedDiscountCurve<KrugerLog>;

#endif
2 changes: 2 additions & 0 deletions SWIG/zerocurve.i
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ using QuantLib::InterpolatedZeroCurve;
%shared_ptr(InterpolatedZeroCurve<SplineCubic>);
%shared_ptr(InterpolatedZeroCurve<DefaultLogCubic>);
%shared_ptr(InterpolatedZeroCurve<MonotonicCubic>);
%shared_ptr(InterpolatedZeroCurve<Kruger>);

template <class Interpolator>
class InterpolatedZeroCurve : public YieldTermStructure {
Expand All @@ -59,6 +60,7 @@ class InterpolatedZeroCurve : public YieldTermStructure {
%template(NaturalCubicZeroCurve) InterpolatedZeroCurve<SplineCubic>;
%template(LogCubicZeroCurve) InterpolatedZeroCurve<DefaultLogCubic>;
%template(MonotonicCubicZeroCurve) InterpolatedZeroCurve<MonotonicCubic>;
%template(KrugerZeroCurve) InterpolatedZeroCurve<Kruger>;


#endif

0 comments on commit 0ff0103

Please sign in to comment.