Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: A faster way to insert nontrading days using Financial Time Series object?
Replies: 2   Last Post: Mar 3, 2013 1:47 AM

 Messages: [ Previous | Next ]
 Kelvin Posts: 29 Registered: 2/20/12
A faster way to insert nontrading days using Financial Time Series object?
Posted: Mar 2, 2013 12:44 PM

Hi Pros,

Let say I have a financial time series object called "obj.TimeSeries" which stores daily close price of a stock e.g. GOOG and the data source is from Yahoo. As you know, the series will only include data for trading dates. So does anyone know a faster way of adding nontrading dates and its interpolated close price into the financial time series object?

Currently I'm using the function below to get this job done, but it seems that this function is not fast enough so I'd like to see if you know a better way to do this.

===============================

function value = getFullDateReturnClose(obj)

datesbound = ftsbound(obj.TimeSeries);
firstDateNum = datenum(datesbound(1));
datenumber = firstDateNum:firstDateNum + length(obj.TimeSeries);
tempDateAndTime = [datenumber', zeros(numel(datenumber), 1)];
tsobj = fints(tempDateAndTime, datenumber');
tsobj = merge(tsobj, obj.TimeSeries.CLOSE);
value = tick2ret(fillts(rmfield(tsobj, 'series1')));

end

===============================

Thank you - Kelvin

Date Subject Author
3/2/13 Kelvin
3/2/13 Phil Goddard
3/3/13 Kelvin