Stock market data.

Stock market only trades on Business days and not weekends and holidays.

The database contains stock data. One row per trading day.

What I want to do is to get all the data from a start date to end date only
into individual sets.

To determine if the set is complete, there would clearly be data rows PRIOR
to the start date and data rows that FOLLOW the end date. This is how I'd
determine that a set is complete with all available data for those 'sample
date windows'.

I want them in SETS for comparison purposes, to later compare one SET to
another without any regard to what year (or dual years) the sets are derived
from.

In my code I intend to number each set from 1 to whatever number of total
sets there are.

That's why I'm trying to finalize the SQL statement to grab the SETS. From
there, I can do the rest with code.

I'm thinking that due to the limitations of SQL that it may be better that I
use what I have in SQL, shown below (with your help) with the addition of
ORDER BY Date..., and then strip off the partial set at either end using
code.

    'This SQL statement will pull out the data in SETS. Ex: lngStartMth/Day
to lngEndMth/Day, even cross year divide.
    sSQL = "SELECT Date, Year, Month, Day, Open, High, Low, Close FROM [" &
gsTableName & "] " & _
            "WHERE ((Month - " & lngStartMth & ")*100 + (Day - " &
lngStartDay & ") + 1300) % 1300 <= ((" & _
            lngEndMth - lngStartMth & ") * 100 + (" & lngEndDay -
lngStartDay & ") + 1300) % 1300 " & _
            "ORDER BY Date, Year, ((Month - " & lngStartMth & ")*100 + (Day
- " & lngStartDay & ") + 1300) % 1300"

Thanks.

Rick
 
 

#>-----Original Message-----
#>From: sqlite-users-boun...@sqlite.org 
#>[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik
#>Sent: Wednesday, November 11, 2009 12:38 PM
#>To: sqlite-users@sqlite.org
#>Subject: Re: [sqlite] Reverse Referencing Rows
#>
#>Rick Ratchford <r...@amazingaccuracy.com>
#>wrote: 
#>> Only business days are in the data sets. No weekends or Holidays.
#>> 
#>> So I was happy with the other sets because they ARE full sets.
#>> 
#>> A full set is ALL THE BUSINESS DAYS from the Start to End Date.
#>
#>Do you have a table that lists all the business days in a 
#>year, or something? Otherwise, I don't see how you can 
#>formally define the notion of a "complete set". And without 
#>formally defining it, you won't be able to produce a query to 
#>implement it.
#>
#>Igor Tandetnik
#>
#>
#>_______________________________________________
#>sqlite-users mailing list
#>sqlite-users@sqlite.org
#>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
#>
#>


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to