Skip to content

Commit

Permalink
cljfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Mar 27, 2024
1 parent aa4cd8d commit 7f13122
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
15 changes: 7 additions & 8 deletions lib/indicator/src/ta/indicator.clj
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,18 @@
(roll/rolling-window-reduce r/mean n (tr bar-ds)))

#_(defn atr-mma [{:keys [n]} bar-ds]
(assert n "atr needs :n option")
(roll/rolling-window-reduce (fn [col-name]
{:column-name col-name
:reducer (fn [col]
(-> (mma n col) last))
:datatype :float64})
n (tr bar-ds)))
(assert n "atr needs :n option")
(roll/rolling-window-reduce (fn [col-name]
{:column-name col-name
:reducer (fn [col]
(-> (mma n col) last))
:datatype :float64})
n (tr bar-ds)))

(defn atr-mma [{:keys [n]} bar-ds]
(assert n "atr needs :n option")
(->> (tr bar-ds) (mma n)))


(defn add-atr [opts bar-ds]
(tc/add-column bar-ds :atr (atr opts bar-ds)))

Expand Down
7 changes: 2 additions & 5 deletions lib/indicator/src/ta/indicator/rolling.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns ta.indicator.rolling
(:require
[tech.v3.dataset.rolling :as r]
[tech.v3.datatype.functional :as dfn]
[tech.v3.datatype.functional :as dfn]
[tablecloth.api :as tc]
[ta.indicator.returns :as ret]))

Expand Down Expand Up @@ -36,20 +36,17 @@
:datatype :float64})
n (:close bar-ds)))


(defn trailing-stddev
"returns the trailing-stddev over n bars of column v.
the current row is included in the window."
[n bar-ds]
(rolling-window-reduce (fn [col-name]
(println "col: " col-name)
{:column-name col-name
:reducer dfn/standard-deviation
:reducer dfn/standard-deviation
:datatype :float64})
n (:close bar-ds)))



(defn prior-window
"this does not work!"
[ds]
Expand Down
4 changes: 0 additions & 4 deletions lib/indicator/src/ta/indicator/ta4j/ta4j.clj
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
ctor (constructor namespace "Indicator")]
(ctor class-key args)))



(defn ind-values
([ind] (ind-values (-> ind .getBarSeries .getBarCount) ind))
([n ind]
Expand Down Expand Up @@ -243,8 +241,6 @@
:WMA
:ZLEMA])



; trading rules

(defn rule [class-key & args]
Expand Down

0 comments on commit 7f13122

Please sign in to comment.