Skip to content

Commit c57e1d9

Browse files
committed
Merge remote-tracking branch 'origin/master' into QPR-11995
2 parents 62b8f82 + 8b1751e commit c57e1d9

6 files changed

Lines changed: 85 additions & 12 deletions

File tree

OREAnalytics-SWIG/SWIG/orea_app.i

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ class OREApp {
268268
std::vector<std::string> getErrors();
269269

270270
Real getRunTime();
271-
};
271+
272+
std::string version();
273+
};
272274

273275
%shared_ptr(Analytic)
274276
class Analytic {

OREData-SWIG/SWIG/ored.i

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@
4141
%}
4242

4343

44+
%include ored_calendarAdjustmentConfig.i
4445
%include ored_conventions.i
45-
%include ored_parsers.i
46-
%include ored_market.i
47-
%include ored_portfolio.i
48-
%include ored_log.i
4946
%include ored_loader.i
47+
%include ored_log.i
48+
%include ored_market.i
5049
%include ored_marketdatum.i
50+
%include ored_parsers.i
51+
%include ored_portfolio.i
5152
%include ored_reports.i
52-
%include ored_calendarAdjustmentConfig.i
53+
%include ored_volcurves.i
5354

5455
#endif

OREData-SWIG/SWIG/ored_volcurves.i

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,19 @@
1919
#ifndef ored_volcurves_i
2020
#define ored_volcurves_i
2121

22+
%include std_set.i
23+
2224
%{
23-
using ore::data::GenerticYieldVolCurve
24-
using ore::data::SwaptionVolCurve
25+
using ore::data::GenericYieldVolCurve;
26+
using ore::data::SwaptionVolCurve;
27+
using ore::data::BlackScholesModelBuilderBase;
28+
using ore::data::LocalVolModelBuilder;
2529
using namespace std;
2630
%}
2731

32+
%template(DateSet) std::set<Date>;
33+
34+
/*
2835
%shared_ptr(GenericYieldVolCurve)
2936
class GenericYieldVolCurve {
3037
public:
@@ -50,5 +57,33 @@ class SwaptionVolCurve : public GenericYieldVolCurve {
5057
const SwaptionVolatilityCurveSpec& spec() const;
5158
5259
};
60+
*/
61+
62+
%template(GeneralizedBlackScholesProcessVector) std::vector<ext::shared_ptr<GeneralizedBlackScholesProcess> >;
63+
64+
%shared_ptr(LocalVolModelBuilder)
65+
class LocalVolModelBuilder : public BlackScholesModelBuilderBase {
66+
public:
67+
enum class Type { Dupire, DupireFloored, AndreasenHuge };
68+
LocalVolModelBuilder(const std::vector<Handle<YieldTermStructure>>& curves,
69+
const std::vector<ext::shared_ptr<GeneralizedBlackScholesProcess>>& processes,
70+
const std::set<Date>& simulationDates = {},
71+
const std::set<Date>& addDates = {},
72+
const Size timeStepsPerYear = 1,
73+
const Type lvType = Type::Dupire,
74+
const std::vector<Real>& calibrationMoneyness = { -2.0, -1.0, 0.0, 1.0, 2.0 },
75+
const bool dontCalibrate = false);
76+
LocalVolModelBuilder(const Handle<YieldTermStructure>& curve,
77+
const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
78+
const std::set<Date>& simulationDates = {},
79+
const std::set<Date>& addDates = {},
80+
const Size timeStepsPerYear = 1,
81+
const Type lvType = Type::Dupire,
82+
const std::vector<Real>& calibrationMoneyness = { -2.0, -1.0, 0.0, 1.0, 2.0 },
83+
const bool dontCalibrate = false);
84+
85+
std::vector<ext::shared_ptr<GeneralizedBlackScholesProcess>> getCalibratedProcesses() const override;
86+
};
5387

5488

89+
#endif

QuantExt-SWIG/SWIG/qle_indexes.i

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ class Name : public OvernightIndex {
288288
};
289289
%enddef
290290

291-
qle_export_xibor_instance(AUDbbsw);
292291
qle_export_xibor_instance(CZKPribor);
293292
qle_export_xibor_instance(DEMLibor);
294293
qle_export_xibor_instance(DKKCibor);
@@ -302,8 +301,6 @@ qle_export_xibor_instance(MYRKlibor);
302301
qle_export_xibor_instance(NOKNibor);
303302
qle_export_xibor_instance(NZDBKBM);
304303
qle_export_xibor_instance(PHPPhiref);
305-
qle_export_xibor_instance(PLNWibor);
306-
qle_export_xibor_instance(RUBMosprime);
307304
qle_export_xibor_instance(SEKStibor);
308305
qle_export_xibor_instance(SGDSibor);
309306
qle_export_xibor_instance(SGDSor);

QuantExt-SWIG/SWIG/qle_instruments.i

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ using QuantExt::OvernightIndexedBasisSwap;
4343
using QuantExt::Deposit;
4444
using QuantExt::DepositEngine;
4545
using QuantExt::DiscountingSwapEngineMultiCurve;
46+
using QuantExt::VarianceSwap2;
47+
using QuantExt::GeneralisedReplicatingVarianceSwapEngine;
4648
%}
4749

4850

@@ -247,4 +249,40 @@ public:
247249
QuantLib::Handle<QuantLib::YieldTermStructure> discountCurve();
248250
};
249251

252+
253+
%shared_ptr(VarianceSwap2)
254+
class VarianceSwap2 : public Instrument {
255+
public:
256+
VarianceSwap2(Position::Type position, Real strike, Real notional,
257+
const Date& startDate, const Date& maturityDate,
258+
const Calendar& calendar, bool addPastDividends);
259+
};
260+
261+
%shared_ptr(GeneralisedReplicatingVarianceSwapEngine)
262+
class GeneralisedReplicatingVarianceSwapEngine : public PricingEngine {
263+
public:
264+
class VarSwapSettings {
265+
public:
266+
enum class Scheme { GaussLobatto, Segment };
267+
enum class Bounds { Fixed, PriceThreshold };
268+
VarSwapSettings() {}
269+
Scheme scheme = Scheme::GaussLobatto;
270+
Bounds bounds = Bounds::PriceThreshold;
271+
Real accuracy = 1E-5;
272+
Size maxIterations = 1000;
273+
Size steps = 100;
274+
Real priceThreshold = 1E-10;
275+
Size maxPriceThresholdSteps = 100;
276+
Real priceThresholdStep = 0.1;
277+
Real fixedMinStdDevs = -5.0;
278+
Real fixedMaxStdDevs = 5.0;
279+
};
280+
281+
GeneralisedReplicatingVarianceSwapEngine(const ext::shared_ptr<QuantLib::Index>& index,
282+
const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
283+
const Handle<YieldTermStructure>& discountingTS,
284+
const VarSwapSettings settings = VarSwapSettings(),
285+
const bool staticTodaysSpot = true);
286+
};
287+
250288
#endif

QuantLib-SWIG

0 commit comments

Comments
 (0)