christian - 2007-10-08

Short Stocks which had a negative trading day when fed decrease interest rates for the following 2 days.

Test Set = Nasdaq 100

The following Query return all Stock which had a negative trading day after the FED interest decrease on 2007-09-19:

   select q.fi_id from fimi.quote q
    where 1=1
      and q."date" = '2007-09-19'
      and q.values[4] - q.values[1] < 0

-> 66 Rows Selected

And now show all stocks which have 2 nagative following trading days.

select distinct fi.caption from fimi.fi fi, (
   select q.fi_id from fimi.quote q
    where 1=1
      and q."date" = '2007-09-19'
      and q.values[4] - q.values[1] < 0 ) as tmp
where fi.fi_id IN (SELECT CASE WHEN fimi.last(values[4]) - fimi.first(values[1]) < 0 THEN
                                    fi_id
                               ELSE
                                    NULL
                           END
                     FROM fimi.quote
                    WHERE 1=1 AND fi_id = tmp.fi_id
                      AND "date" BETWEEN '2007-09-20' AND '2007-10-21'
                    GROUP BY fi_id, "date" ORDER BY "date" ASC)

-> 66 Rows Selected

Hmmm ... seems interesting - what do you mean?

Chris