Skip to content

Commit

Permalink
florian v4
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Oct 11, 2024
1 parent 8df9f19 commit eff2859
Showing 1 changed file with 28 additions and 15 deletions.
43 changes: 28 additions & 15 deletions lib/calendar/src/quanta/calendar/florian.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,47 @@
[ta.calendar.calendars :as caldb]
[ta.calendar.helper :as calhelp]))


(-> (caldb/get-calendar :us)
:timezone
)
;; => "America/New_York"


(-> (caldb/get-calendar :crypto)
:timezone)

(-> (caldb/get-calendar :crypto)
:timezone)

(defn market-info [market-kw]
(let [cal (caldb/get-calendar market-kw)
dt (t/instant)
open? (calhelp/time-open? cal dt)
business? (calhelp/day-open? cal dt)]
dt-cal (-> dt
(t/zoned-date-time)
(t/in (:timezone cal)))
open? (calhelp/time-open? cal dt-cal)
business? (calhelp/day-open? cal dt-cal)]
{:market market-kw
:open? open?
:business business?
:as-of-dt dt}))
:as-of-dt dt-cal}))

(t/instant)
;; => #time/instant "2024-10-11T21:00:48.086343931Z"

;; (t/time (t/instant))
;; => #time/time "16:00:31.179972012"


(market-info :crypto)
;; => {:market :crypto, :open? true, :business true, :as-of-dt #time/instant "2024-10-11T20:57:54.366650110Z"}
;; => {:market :crypto, :open? true, :business true, :as-of-dt #time/zoned-date-time "2024-10-11T21:10:02.760020057Z[UTC]"}


(market-info :eu)
;; => {:market :eu, :open? true, :business true, :as-of-dt #time/instant "2024-10-11T20:58:03.620756893Z"}



;; => {:market :eu,
;; :open? false,
;; :business true,
;; :as-of-dt #time/zoned-date-time "2024-10-11T23:09:51.853464621+02:00[Europe/Berlin]"}

(market-info :jp)
;; => {:market :jp, :open? true, :business true, :as-of-dt #time/instant "2024-10-11T20:58:13.100221665Z"}

;; => {:market :jp,
;; :open? false,
;; :business false,
;; :as-of-dt #time/zoned-date-time "2024-10-12T06:09:57.855540184+09:00[Asia/Tokyo]"}

0 comments on commit eff2859

Please sign in to comment.