Created
July 9, 2023 20:50
-
-
Save nathanvy/277392d6776f895d6558266fa90992e3 to your computer and use it in GitHub Desktop.
Predicate to determine if market is open today
This file contains hidden or 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
(defun run-today-p () | |
"Should we run zalgo today?" | |
(local-time:with-decoded-timestamp | |
(:day-of-week weekday :day today-day) (local-time:now) | |
(when (or (= weekday 0) (= weekday 6)) (return-from run-today-p nil)) | |
(let ((markets-list (get-markets-list))) | |
(loop for market in markets-list | |
do (if (string= (gethash "name" market) "NYSE") | |
(local-time:with-decoded-timestamp | |
(:day d) (local-time:parse-timestring (gethash "startTime" market)) | |
(if (= today-day d) (return-from run-today-p t) nil))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment