Skip to content

Commit 8e8a1fc

Browse files
committed
Merge branch 'feature/QPR-13699' into 'master'
QPR-13699: fix const and add example Closes QPR-13699 See merge request qs/oreplus!3112
2 parents 8e72f76 + 879dae6 commit 8e8a1fc

5 files changed

Lines changed: 17 additions & 3 deletions

File tree

Examples/ORE-Python/ExampleScripts/ExpectedOutput/dates.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ advance start date by 1M
1818
startDate 2020-05-01
1919
endDate 2020-06-01
2020
---------------------------
21+
May 1st, 2020
22+
May 6th, 2020
23+
May 11th, 2020
24+
2025-12-24

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
@@ -472,7 +472,7 @@ Settlement::Method parseSettlementMethod(const std::string& s) {
472472
}
473473
}
474474

475-
QuantLib::Date calculateMporDate(QuantLib::Size& mporDays, QuantLib::Date asOf, std::string mporCalendar) {
475+
QuantLib::Date calculateMporDate(const QuantLib::Size& mporDays, QuantLib::Date asOf, std::string mporCalendar) {
476476
QuantLib::Calendar mporCal = parseCalendar(mporCalendar);
477477
if (asOf == Date())
478478
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)