forked from jjttjj/trateg
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Sep 13, 2023
1 parent
37ed7ef
commit 5ae58c9
Showing
9 changed files
with
314 additions
and
9 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 |
---|---|---|
|
@@ -22,14 +22,29 @@ | |
; forex | ||
; http://www.kibot.com/Files/2/Forex_tickbidask.txt | ||
|
||
|
||
; dividends/splits: | ||
; Request URL | ||
; http://api.kibot.com?action=adjustments&symbol=[symbol]&startdate=[startdate]&enddate=[enddate]&splitsonly=[splitsonly]÷ndsonly=[dividendsonly]&symbolsonly=[symbolsonly] | ||
; | ||
; Response | ||
;The server returns TAB separated values with the first line defining the fields and their order. Here is an example: | ||
; Date Symbol Company Action Description | ||
; 2/16/2010 MSFT Microsoft Corp. 0.1300 Dividend | ||
; 5/18/2010 MSFT Microsoft Corp. 0.1300 Dividend | ||
|
||
; ftp://hoertlehner%40gmail.com:[email protected]/ | ||
|
||
|
||
|
||
;; ApiKey Management | ||
|
||
(defonce api-key (atom {:user "guest" :password "guest"})) | ||
|
||
(defn set-key! | ||
"to use api, call at least once set-key! api-key" | ||
[key] | ||
(info "setting kibot key..") | ||
(warn "setting kibot key..") | ||
(reset! api-key key) | ||
nil ; Important not to return by chance the key, as this would be shown in the repl. | ||
) | ||
|
@@ -108,6 +123,46 @@ | |
|
||
|
||
|
||
(defn snapshot [opts] | ||
(let [{:keys [user password]} @api-key] | ||
;(info "login user: " user "pwd: " password) | ||
(info "kibot snapshot: " opts) | ||
(make-request base-url | ||
(merge | ||
{:action "snapshot" | ||
:user user | ||
:password password} | ||
opts)))) | ||
|
||
; This example will work even if you do not have a subscription: | ||
; http://api.kibot.com/?action=snapshot&symbol=$NDX,AAPL | ||
; return format: Symbol,Date,Time,LastPrice,LastVolume,Open,High,Low,Close,Volume,ChangePercent,TimeZone. | ||
|
||
(comment | ||
|
||
(snapshot {:symbol ["$NDX" "AAPL"]}) | ||
|
||
(snapshot {:type "future" | ||
:symbol "ESZ23"}) | ||
|
||
(snapshot {:type "future" | ||
:symbol "JYZ23"}) | ||
|
||
|
||
(snapshot {:symbol ["$NDX" | ||
"AAPL" | ||
"FCEL" | ||
"MSFT" | ||
#_"BZ0"]}) | ||
|
||
(snapshot {:symbol ["AAPL" "DAX0" "MSFT"]}) | ||
|
||
; | ||
) | ||
|
||
|
||
|
||
|
||
(comment | ||
|
||
(history {:symbol "AAPL" | ||
|
@@ -132,6 +187,14 @@ | |
:timezone "UTC" | ||
:splitadjusted 1}) | ||
|
||
(history {:symbol "SIL" ; SIL - FUTURE | ||
:type "futures" ; Can be stocks, ETFs forex, futures. | ||
:interval "daily" | ||
:period 1 | ||
:timezone "UTC" | ||
:splitadjusted 1}) | ||
|
||
|
||
(history {:symbol "SIL" ; SIL - FUTURE | ||
:type "futures" ; Can be stocks, ETFs forex, futures. | ||
:interval "daily" | ||
|
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,30 @@ | ||
(ns joseph.lib.quote-table | ||
(:require | ||
[clojure.string :as str] | ||
[goldly.js :refer [to-fixed]] | ||
[tick.goldly] | ||
[tick.core :as tick] | ||
[ui.aggrid :refer [aggrid]] | ||
)) | ||
|
||
|
||
|
||
(defn quote-table [quotes] | ||
[aggrid {:box :fl | ||
:data quotes | ||
:columns [{:field :symbol} | ||
{:field :date} | ||
{:field :time} | ||
;{:field :timezone} | ||
{:field :open} | ||
{:field :high} | ||
{:field :low} | ||
{:field :close} | ||
{:field :volume} | ||
{:field :changepercent} | ||
;{:field :lastprice} | ||
;{:field :lastvolume} | ||
] | ||
|
||
:pagination :false | ||
:paginationAutoPageSize false}]) |
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.