Skip to content

v2.0.4

Choose a tag to compare

@clojure-finance clojure-finance released this 15 Mar 05:46
· 20 commits to main since this release

As-of join (:how :asof)

Inspired by q's aj. For each left row, finds the last right row where right-key <= left-key within an exact-match group. All left rows are always preserved.

;; Trade-quote matching
(join trades quotes :on [:sym :time] :how :asof)

;; Asymmetric key names
(join trades quotes :left-on [:sym :trade-time] :right-on [:sym :quote-time] :how :asof)

;; With cardinality validation
(join trades quotes :on [:sym :time] :how :asof :validate :m:1)

Changes

  • New datajure.asof namespace: asof-search, asof-indices, asof-match, build-result
  • datajure.join: :how :asof dispatch, :validate checks right side only
  • 19 new tests (37 assertions), added to CI
  • Fixes nil-at-midpoint bug in binary search