Hello,
I have some code that used the now deprecated FINTS timeseries from the financial package. In particular I need to resample a daily series to get only the points from each wednesday and, if it is a holiday, from the previous business day. The code below shows the expected behavior:
sampleDates = (datetime(2018, 11, 30):datetime(2019, 01, 31))';[dayNumber, dayName] = weekday(sampleDates, 'en_US');isWorking = isbusday(sampleDates);data = (1:length(sampleDates))';fts = fints(datenum(sampleDates), [dayNumber, isWorking, data], {'dayNumber', 'isWorking', 'data'});ftsWeekly = toweekly(fts, 'CalcMethod', 'Exact', 'BusDays', 1, 'EOW', 5, 'EndPtTol', [0, -1]);
I correctly get all wednesdays and the previous working day for the two cases (26.12.2018 and 02.01.2019) when it was a holiday, where it takes the previous working day.
How should I do the same with the recommended retime function on timeseries (since the fints will be removed)?
I tried the following:
tt = timetable(sampleDates, dayNumber, dayName, isWorking, data);ttWeekly = retime(tt, 'weekly', 'nearest');
but this gives me the sunday days and I don't see how to configure it to get the wednesdays.
Any help would be great
Best Answer