Skip to content

Instantly share code, notes, and snippets.

@guilespi
Created October 29, 2012 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guilespi/3970987 to your computer and use it in GitHub Desktop.
Save guilespi/3970987 to your computer and use it in GitHub Desktop.
QSTK Get days there was trading at the NYSE
(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