There are handy date functions in ~system/main/dates.ijs. For instance, load '~system\main\dates.ijs' (2008 10,"(1 0)20+i.10),.weekday 2008 10,"(1 0)20+i.10 NB. Some consecutive days this month 2008 10 20 1 2008 10 21 2 2008 10 22 3 2008 10 23 4 2008 10 24 5 2008 10 25 6 2008 10 26 0 2008 10 27 1 2008 10 28 2 2008 10 29 3
This tells us that 10/26/2008 was a Sunday. I've been doing a little study of the DJI using daily data from Yahoo! - take a look at http://www.jsoftware.com/jwiki/NYCJUG/2008-10-14 for a sample. On Mon, Oct 27, 2008 at 9:37 PM, Hahn, Harvey <[EMAIL PROTECTED]> wrote: > I have a more challenging question for the group: > > I've been honing some of my beginning J skills using downloaded stock > market data (DJIA) as a convenient "real" (and of practical interest) > array to practice with (of course, AFTER "getting it right" with small > sample arrays!). The data I have is daily from 1928 (getting prior data > someday soon), varying anywhere from, theoretically, 1 to 6 trading days > per week. I'd like to derive some weekly figures from the daily data, > but the variability of the trading week is a "fly in the ointment", so > one can't just take every so many days of data. Slightly redefined, the > trading week is all trading days between Sundays, which are easy to > calculate. However, another "fly in the ointment" is that Sunday dates > are not included in the downloaded market data, seemingly excluding the > use of any kind of "cut" operation on the sequence of data in the array. > > Is there any way to use a "Sunday" formula to pass against > Monday-through-Saturday data in an array (Yahoo data consists of date, > open, high, low, close, volume, adjusted close; I'd probably be using > the first and last columns here), so that some processing (via another > function) could be performed on whatever data exists BETWEEN the > Sundays? Or does one have to insert all the Sunday dates (with perhaps > zero data values) into the array, using perhaps J (or some other > language) and then attempt to do a "cut" operation using the added info? > Or is there some other approach? > > I've been giving a lot of thought for the past week or so to this > problem, but my meager knowledge at this point seems not yet enough to > solve the problem. Thanks in advance for any insights you can share! > > Harvey > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Devon McCormick, CFA ^me^ at acm. org is my preferred e-mail ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
