Skip to content

Commit 42d8ad6

Browse files
committed
QPR-13699: fix const and add example
1 parent 1b6f3de commit 42d8ad6

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

Examples/ORE-Python/ExampleScripts/dates.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,13 @@
4646
print("startDate", startDate.to_date())
4747
print("endDate ", endDate.to_date())
4848
print('---------------------------')
49+
50+
mporDays = 3
51+
52+
print(startDate)
53+
print(ore.calculateMporDate(mporDays))
54+
print(ore.calculateMporDate(mporDays, startDate))
55+
print(ore.calculateMporDate(mporDays, startDate, calendarString))
56+
57+
print(ore.calculateMporDate(mporDays).to_date())
58+

ORE-SWIG/OREData-SWIG/SWIG/ored_parsers.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ QuantLib::Settlement::Type parseSettlementType(const std::string& s);
104104
QuantLib::Exercise::Type parseExerciseType(const std::string& s);
105105
QuantLib::Option::Type parseOptionType(const std::string& s);
106106
QuantLib::Date parseDate(const std::string& s);
107-
QuantLib::Date calculateMporDate(QuantLib::Size& mporDays, QuantLib::Date asOf = QuantLib::Date(), std::string mporCalendar = "US");
107+
QuantLib::Date calculateMporDate(const QuantLib::Size& mporDays, QuantLib::Date asOf = QuantLib::Date(), std::string mporCalendar = "US");
108108

109109
%template(StringCalMap) std::map<std::string, Calendar>;
110110

OREData/ored/utilities/parsers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ Settlement::Method parseSettlementMethod(const std::string& s) {
469469
}
470470
}
471471

472-
QuantLib::Date calculateMporDate(QuantLib::Size& mporDays, QuantLib::Date asOf, std::string mporCalendar) {
472+
QuantLib::Date calculateMporDate(const QuantLib::Size& mporDays, QuantLib::Date asOf, std::string mporCalendar) {
473473
QuantLib::Calendar mporCal = parseCalendar(mporCalendar);
474474
if (asOf == Date())
475475
asOf = Settings::instance().evaluationDate();

OREData/ored/utilities/parsers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ MporCashFlowMode parseMporCashFlowMode(const std::string& s);
615615
/*!
616616
\ingroup utilities
617617
*/
618-
QuantLib::Date calculateMporDate(QuantLib::Size& mporDays, QuantLib::Date asOf = QuantLib::Date(),
618+
QuantLib::Date calculateMporDate(const QuantLib::Size& mporDays, QuantLib::Date asOf = QuantLib::Date(),
619619
std::string mporCalendar = "US");
620620

621621
//! Write MporCashFlowMode to stream

0 commit comments

Comments
 (0)