Just to take it a little further for your particular problem,

   weekday 1928 10 1   NB. First day in data is a Monday
1
   weekday 1928 9 30   NB. So day before was Sunday
0
   todayno 1928 9 30
47023
   todate (todayno 1928 9 30)+7*i.10  NB. Generate dates for ten Sundays...
1928  9 30
1928 10  7
1928 10 14
1928 10 21
1928 10 28
1928 11  4
1928 11 11
1928 11 18
1928 11 25
1928 12  2

You can, for instance, sort these into your existing dates to establish
partition points.  If you do this, it would probably be simpler to convert
your Dow dates into daynums (and not bother converting the Sundays back into
dates) so you can work with an integer vector.


On Mon, Oct 27, 2008 at 10:45 PM, Devon McCormick <[EMAIL PROTECTED]>wrote:

> 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
>
>


-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to