Matlab 如何根据每日fts提取月度财务时间序列

Matlab 如何根据每日fts提取月度财务时间序列,matlab,Matlab,我知道我们可以在financial toolbox中使用函数“tomonthly”,但它会返回一个默认的每月数据,即每个月的最后一个工作日 如果我想要每个月的第一个工作日呢 我已尝试通过以下方式将“ED”设置为1: ftsFuture = fints (matlabDate, lnPrice); monthlyFuture = tomonthly(ftsFuture,'ED',1); ftsFuture = fints (matlabDate, lnPrice); monthlyFuture

我知道我们可以在financial toolbox中使用函数“tomonthly”,但它会返回一个默认的每月数据,即每个月的最后一个工作日

如果我想要每个月的第一个工作日呢

我已尝试通过以下方式将“ED”设置为1:

ftsFuture = fints (matlabDate, lnPrice);
monthlyFuture = tomonthly(ftsFuture,'ED',1); 
ftsFuture = fints (matlabDate, lnPrice);
monthlyFuture = tomonthly(ftsFuture,'ED',1, 'BusDays',0);  
但这只是部分成功,因为如果一个月的第一天是一个工作日,这是可以的,但是如果它不是一个工作日,它就变成了上一个工作日,也就是上一个月

我还尝试使用“BusDays”,通过以下方式将其设置为0:

ftsFuture = fints (matlabDate, lnPrice);
monthlyFuture = tomonthly(ftsFuture,'ED',1); 
ftsFuture = fints (matlabDate, lnPrice);
monthlyFuture = tomonthly(ftsFuture,'ED',1, 'BusDays',0);  
这成功地将每个条目强制为每月的1号,但显然不正确,因为其中一些日期显然不是工作日


非常感谢您的帮助

有一种方法可以从每月第一个工作日开始的每月期间的每日财务时间序列中提取数据。我们可以使用<<代码> TimeNoth< /COD>和 BubDeX/Cuff>函数来获取系列中的日期。 假设数据开始于某个月的月初,结束于某个月的月底,我们添加第一个日期,并删除操作后得到的最后一个日期

ftsFuture = fints (matlabDate, lnPrice);
monthlyFuture = tomonthly(ftsFuture);
eomDates = monthlyFuture.dates ; % getting end of month business days) 
fomDates = busdate(eomDates) ;  % getting first month bussines days)
fomDates(end)=[] ; % deleting the last date in the array (out of range otherwise).
firstday = ftsFuture.dates(1); % adding the first date of the series.
fomDates = [firstday ; fomDates];
fomDates = datestr(fomDates);
fomftsFuture = ftsFuture(fomDates);