Created
October 29, 2012 02:05
-
-
Save guilespi/3970987 to your computer and use it in GitHub Desktop.
QSTK Get days there was trading at the NYSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn get-NYSE-days | |
"Create a set of timestamps between startday and endday | |
that correspond to the days there was trading at the NYSE" | |
[start-date end-date time-of-day] | |
(let [dates-file (str *QS* "/qstkutil/NYSE_dates.txt") | |
NYSE-dates (incanter.io/read-dataset dates-file) | |
fmt (formatter "MM/dd/yyyy") | |
dates (incanter.core/$map #(parse fmt %) :col0 NYSE-dates)] | |
(set (filter (fn [d] (within? (interval start-date end-date) d)) | |
(map #(plus % time-of-day) dates))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment