The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

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
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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')));



Thank you - Kelvin

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.