Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
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
|
|
|
|