Skip to content

Commit e94eb74

Browse files
committed
Merge branch 'master' into 'master'
merge from master Closes QPR-12152 and QPR-12142 See merge request qs/oreswig-github!5
2 parents d62dfd0 + e25c377 commit e94eb74

4 files changed

Lines changed: 62 additions & 2 deletions

File tree

Docker/Dockerfile-ORESWIG-App

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RUN apt-get update \
1212
&& apt-get clean \
1313
&& rm -rf /var/lib/apt/lists/*
1414

15-
RUN pip3 install matplotlib pandas nose nose_xunitmp datacompy jupyter
15+
RUN pip3 install matplotlib pandas nose nose_xunitmp datacompy jupyter jsondiff xmldiff
1616

1717
WORKDIR /
1818
RUN mkdir /oreswig
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<CalendarAdjustments>
2+
<Calendar name= "Japan">
3+
<AdditionalHolidays>
4+
<Date>2020-06-01</Date>
5+
</AdditionalHolidays>
6+
<AdditionalBusinessDays>
7+
<Date>2020-05-05</Date>
8+
</AdditionalBusinessDays>
9+
</Calendar>
10+
</CalendarAdjustments>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
import ORE as ore
3+
4+
startDateString = '2020-05-01'
5+
calendarString = 'Japan'
6+
tenorString = '1M'
7+
businessDayConventionString = 'F'
8+
calAdjXml = "Input/caladj.xml"
9+
10+
startDate = ore.parseDate(startDateString)
11+
calendar = ore.parseCalendar(calendarString)
12+
tenor = ore.parsePeriod(tenorString)
13+
bdc = ore.parseBusinessDayConvention(businessDayConventionString)
14+
endOfMonth = False
15+
16+
## ADVANCE DATE -- pre adjustment
17+
endDate = calendar.advance(startDate, tenor, bdc, endOfMonth)
18+
print('---------------------------')
19+
print("advance start date by", tenorString)
20+
print("startDate", startDate.to_date())
21+
print("endDate ", endDate.to_date())
22+
23+
## EXPLORE QL/ORE JAPAN CALENDAR
24+
print('---------------------------')
25+
print('holidays (pre adjustment):')
26+
holidayList = calendar.holidayList(startDate, endDate)
27+
for idx in holidayList:
28+
print(idx.to_date())
29+
30+
## MAKE USE OF CALENDAR ADJUSTMENT
31+
## new holiday : 2020-06-01
32+
## new business day (previously holiday) : 2020-05-05
33+
calAdj = ore.CalendarAdjustmentConfig()
34+
calAdj.fromFile(calAdjXml)
35+
36+
print('---------------------------')
37+
print('holidays (post adjustment):')
38+
holidayList = calendar.holidayList(startDate, endDate)
39+
for idx in holidayList:
40+
print(idx.to_date())
41+
42+
## ADVANCE DATE -- post adjustment
43+
endDate = calendar.advance(startDate, tenor, bdc, endOfMonth)
44+
print('---------------------------')
45+
print("advance start date by", tenorString)
46+
print("startDate", startDate.to_date())
47+
print("endDate ", endDate.to_date())
48+
print('---------------------------')

OREData-SWIG/SWIG/ored_calendarAdjustmentConfig.i

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ class CalendarAdjustmentConfig {
5151
const string& getBaseCalendar(const string& calname);
5252

5353
void append(const CalendarAdjustmentConfig& c);
54-
54+
55+
void fromFile(const std::string& name);
56+
5557
};
5658

5759

0 commit comments

Comments
 (0)