forked from jjttjj/trateg
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
awb99
committed
Aug 31, 2023
1 parent
71c007c
commit c8cfa8c
Showing
11 changed files
with
172 additions
and
90 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,6 @@ | |
{:volume "column"}] | ||
:options {:show-moon false} | ||
:marks astro-marks}) | ||
|
||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(ns demo.goldly.repl.tradingview.menu | ||
(:require | ||
[reval.cljs-eval :refer [eval-code!]])) | ||
|
||
|
||
|
||
|
||
(eval-code! | ||
(ta.tradingview.goldly.interact2/add-header-button | ||
@ta.tradingview.goldly.interact/tv-widget-atom | ||
"re-gann" "my tooltip" | ||
(fn [] | ||
(js/alert "re-gann button clicked ")))) | ||
|
||
|
||
(eval-code! | ||
(ta.tradingview.goldly.interact2/add-context-menu | ||
@ta.tradingview.goldly.interact/tv-widget-atom | ||
[{"position" "top" | ||
"text" (str "First top menu item"); , time: " unixtime ", price: " price) | ||
"click" (fn [] (js/alert "First clicked."))} | ||
{:text "-" | ||
:position "top"} | ||
{:text "-Paste"} ; Removes the existing item from the menu | ||
{:text "-" ; Adds a separator between buttons | ||
:position "top"} | ||
{:position "top" | ||
:text "Second top menu item 2" | ||
:click (fn [] (js/alert "second clicked."))} | ||
{:position "bottom" | ||
:text "Bottom menu item" | ||
:click (fn [] (js/alert "third clicked."))}])) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
(ns demo.goldly.repl.tradingview.move | ||
(:require | ||
[ta.helper.date :as dt :refer [parse-date ->epoch-second epoch-second->datetime]] | ||
[reval.cljs-eval :refer [eval-code!]])) | ||
|
||
(eval-code! | ||
(ta.tradingview.goldly.interact2/get-range | ||
@ta.tradingview.goldly.interact/tv-widget-atom | ||
)) | ||
;; {:from 1644796800, :to 1697155200} | ||
|
||
(eval-code! | ||
(ta.tradingview.goldly.interact/track-range)) | ||
|
||
|
||
|
||
(defn epoch [yyyy-mm-dd] | ||
(-> yyyy-mm-dd parse-date ->epoch-second)) | ||
|
||
(epoch "2023-01-01") | ||
;; => 1672531200 | ||
|
||
(epoch "2023-12-31") | ||
;; => 1703980800 | ||
|
||
(epoch "2022-01-01") | ||
;; => 1640995200 | ||
|
||
(epoch "2022-12-31") | ||
;; => 1672444800 | ||
|
||
(epoch "2019-04-01") | ||
;; => 1554076800 | ||
|
||
;; => Syntax error compiling at (src/demo/goldly/repl/tradingview/move.clj:32:1). | ||
;; Unable to resolve symbol: epoch in this context | ||
|
||
;; => 1672444800 | ||
(eval-code! ; year 2023 | ||
(let [p (ta.tradingview.goldly.interact2/set-range | ||
@ta.tradingview.goldly.interact/tv-widget-atom | ||
{:from 1672531200 | ||
:to 1703980800 } | ||
;{:percentRightMargin 5} | ||
{} | ||
)] | ||
(.then p (fn [] | ||
(println "new visible range applied!") | ||
;widget.activeChart () .refreshMarks (); | ||
)))) | ||
|
||
(eval-code! ; year 2022 | ||
(let [p (ta.tradingview.goldly.interact2/set-range | ||
@ta.tradingview.goldly.interact/tv-widget-atom | ||
{:from 1640995200 | ||
:to 1672444800} | ||
{} | ||
;{:percentRightMargin 5} | ||
)] | ||
(.then p (fn [] | ||
(println "new visible range applied!") | ||
;widget.activeChart () .refreshMarks (); | ||
)))) | ||
|
||
|
||
(eval-code! ; 2019-04-01 (as midpoint in the chart) | ||
(ta.tradingview.goldly.interact2/goto-date! | ||
@ta.tradingview.goldly.interact/tv-widget-atom | ||
1554076800)) | ||
;set-visible-range {:from 1545868800, :to 1562284800} {:percentRightMargin 5} | ||
|
||
(epoch-second->datetime 1554076800) | ||
(epoch-second->datetime 1545868800) | ||
(epoch-second->datetime 1562284800) | ||
|
||
; widget.onChartReady(() => { | ||
; const chart = widget.chart(); | ||
; chart.setTimeFrame({val: {type: 'period-back', value: '12M'}, res: '1W'}); | ||
; }); |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.