convert monthly data from daily data series
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dear Friend, I have a time series of SP500 daily prices since 1950. I want to find out the monthly end prices, how can I handle this problem? I am aware there is one function convertto, which uses financial times series object as input arguement. It will be better not to use this function. there is also another function eomday, but this function may also have problems if I need to handle many time series data, some are closing last calender day, some are closing last buz day. it may cause problems. Is there some general method to handle this? thanks
0 comentarios
Respuesta aceptada
Kelly Kearney
el 24 de Jun. de 2013
Assuming t is a vector of datenumbers and x is your corresponding data, the following code will return the last instance of each year-month combo found in your dataset:
dv = datevec(t);
[unq, ia] = unique(dv(:,1:2), 'rows', 'last');
tlast = t(ia);
xlast = x(ia);
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!