Skip to content

Commit

Permalink
removed old algo feed
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Aug 31, 2023
1 parent ce8c374 commit 71c007c
Show file tree
Hide file tree
Showing 16 changed files with 217 additions and 585 deletions.
2 changes: 1 addition & 1 deletion app/demo/src/demo/algo/moon.clj
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
{:signal-text {:type "chars"
:char "!"
:textColor (color :steelblue)
;:title "moon-phase-fullmoon" ; title is not working
:title "moon-phase-fullmoon" ; title should show up in pane settings
}}
{:volume {:type "line" :plottype (plot-type :columns)}}]
:shapes moon-phase-shapes ; fixed-shapes
Expand Down
10 changes: 5 additions & 5 deletions app/demo/src/demo/goldly/page/backtest.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
[ui.highcharts :refer [highstock]]
[input]
[ta.tradingview.goldly.tradingview :refer [ tradingview-chart]]
[ta.tradingview.goldly.interact :refer [tv-widget-atom wrap-chart-ready add-shape]]
[ta.tradingview.goldly.interact2 :refer [set-symbol chart-active]]
[ta.tradingview.goldly.interact :refer [tv-widget-atom ]]
[ta.tradingview.goldly.interact2 :refer [set-symbol chart-active wrap-chart-ready add-shape]]
[demo.goldly.lib.ui :refer [link-href]]
[demo.goldly.view.backtest :refer [navs-chart navs-view roundtrips-view metrics-view]]
[demo.goldly.view.aggrid :refer [study-table]]
Expand Down Expand Up @@ -64,7 +64,7 @@
(defn add-marks-to-tv [tradingview-server]
(when-let [marks (:marks tradingview-server)]
;(println "adding " (count marks) "marks to tv")
(doall (map #(add-shape (:points %) (assoc (:override %) :disableUndo true)) marks)))
(doall (map #(add-shape @tv-widget-atom (:points %) (assoc (:override %) :disableUndo true)) marks)))
)

(defn clear-marks-tv []
Expand All @@ -77,7 +77,7 @@
(when (not (= [algo opts] tradingview-state))
;(info (str "changing tv data for running algo for: " algo "opts: " opts))
(swap! algo-state assoc :tradingview-state [algo opts])
(wrap-chart-ready
(wrap-chart-ready @tv-widget-atom
(fn []
(clear-marks-tv)
(set-symbol @tv-widget-atom (:symbol opts) "1D")
Expand All @@ -86,7 +86,7 @@

(defn tv-data [tradingview-server]
(when tradingview-server
(wrap-chart-ready
(wrap-chart-ready @tv-widget-atom
(fn []
(add-marks-to-tv tradingview-server)))
nil))
Expand Down
1 change: 0 additions & 1 deletion app/demo/src/demo/goldly/page/tvalgo.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns demo.goldly.page.tvalgo
(:require
[reagent.core :as r]
[re-frame.core :as rf]
[goldly.service.core :refer [run-a]]
[goldly.page :as page]
[input]
Expand Down
6 changes: 5 additions & 1 deletion app/demo/src/demo/goldly/repl/tradingview/admin.clj
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,8 @@
;widget.activeChart () .getAllShapes () .forEach (({name}) => console.log (name));
;widget.activeChart().setPriceToBarRatio(0.7567, { disableUndo: true });
;widget.activeChart () .getPanes () [1] .moveTo (0);
;widget.activeChart () .getTimeScaleLogicalRange ()
;widget.activeChart () .getTimeScaleLogicalRange ()


(eval-code!
(ta.tradingview.goldly.interact2/set-layout "2h"))
5 changes: 3 additions & 2 deletions lib/tradingview/src/ta/tradingview/chart/plot.clj
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,16 @@
(defn shape [shape-kw]
(or (get shape-types shape-kw)
(:cross shape-types)))


;; TEXT-SIZE

(def text-sizes
{:auto "auto"
:tiny "tiny"
:small "small"
:normal "normal"
:large "large"
:huge "huge"})


(defn text-size [size-kw]
(or (get text-sizes size-kw)
Expand Down
42 changes: 18 additions & 24 deletions lib/tradingview/src/ta/tradingview/goldly/algo/indicator.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -30,41 +30,35 @@
(:type spec)))

(def default-plot-styles
{"line" {:linestyle 0
:visible true
{"line" {:visible true
:transparency 0
:linestyle 0
:trackPrice false ; Show price line (horizontal line with last price)
:linewidth 2 ; Make the line thinner
:plottype 2 ; Plot type is Line
:trackPrice true ; Show price line (horizontal line with last price)
:color "#880000" ; Set the plotted line color to dark red
:transparency 0
}
"chars" {:visible true
:transparency 0
:trackPrice false ; Show price line (horizontal line with last price)
:char "*"
:location "AboveBar" ; AboveBar BelowBar Top Bottom Right Left Absolute AbsoluteUp AbsoluteDown
:trackPrice false ; Show price line (horizontal line with last price)
:textColor "#ffff00" ; Set the plotted line color to dark red
:size "small"}
"shape" {:visible true
:transparency 0
:size "small"
}
"cols" {:linestyle 0
:visible true
:linewidth 1 ; Make the line thinner
:plottype 5 ; Plot type is Column
:trackPrice false ; Show price line (horizontal line with last price)
:color "#880000" ; Set the plotted line color to dark red
:transparency 0
}
:trackPrice false ; Show price line (horizontal line with last price)
:style "xcross"
:location "AboveBar" ; AboveBar BelowBar Top Bottom Right Left Absolute AbsoluteUp AbsoluteDown

:color "#880000" ; Set the plotted line color to dark red
:textColor "#ffff00"}
"arrows" {:visible true
:colorup "#880000"
:colordown "#00ff00"
:transparency 0
}

;"chars" {:visible true
; :char "X"
; :location "AboveBar"
; :color "#880000"
; }
:trackPrice false
:location "AboveBar" ; AboveBar BelowBar Top Bottom Right Left Absolute AbsoluteUp AbsoluteDown
:colorup "#880000"
:colordown "#00ff00"}

})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,15 @@
[promesa.core :as p]
[goldly.service.core :refer [clj]]
[ta.tradingview.goldly.indicator.bar-colorer :refer [study-bar-colorer]]
[ta.tradingview.goldly.indicator.clj :refer [study-clj]]
[ta.tradingview.goldly.indicator.clj-main :refer [study-clj-main]]
[ta.tradingview.goldly.indicator.clj-col :refer [study-clj-col]]
[ta.tradingview.goldly.indicator.clj-char :refer [study-clj-char]]
[ta.tradingview.goldly.algo.indicator :refer [study-chart-studies all-algo->studies]]
[ta.tradingview.goldly.algo.context :as c]
))
[ta.tradingview.goldly.algo.context :as c]))


(defn custom-indicator-promise [PineJS]
(println "custom-indicator-promise getter running...")
(let [s (clj->js [study-bar-colorer
;(js/equitystudy PineJS)
(study-clj PineJS)
(study-clj-main PineJS)
(study-clj-col PineJS)
(study-clj-char PineJS)])]
])]
(set! (.-pine js/window) PineJS)
(.log js/console s)
(.resolve js/Promise s)))
Expand Down
188 changes: 0 additions & 188 deletions lib/tradingview/src/ta/tradingview/goldly/feed/algo.cljs

This file was deleted.

5 changes: 3 additions & 2 deletions lib/tradingview/src/ta/tradingview/goldly/feed/algo2.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
(:require
[promesa.core :as p]
[goldly.service.core :refer [run-cb clj]]
[ta.tradingview.goldly.interact :as interact]
[ta.tradingview.goldly.interact2 :refer [add-shape]]
[ta.tradingview.goldly.interact :refer [tv-widget-atom]]
[ta.tradingview.goldly.helper :refer [extract-period]]
[ta.tradingview.goldly.algo.context :as c]))

Expand Down Expand Up @@ -100,7 +101,7 @@
(let [{:keys [result _error]} data
batch-add (fn []
(doall
(map #(interact/add-shape (:points %) (:override %)) result)))]
(map #(add-shape @tv-widget-atom (:points %) (:override %)) result)))]
;(println "SHAPES RCVD: " result)
;[{:points [{:time 1649791880}], :override {:shape vertical_line}}
(js/setTimeout batch-add 1300)))]
Expand Down
Loading

0 comments on commit 71c007c

Please sign in to comment.