Skip to content

Commit

Permalink
bybit with import working
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Sep 3, 2023
1 parent 97488af commit c074b7f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
25 changes: 25 additions & 0 deletions lib/data/src/ta/data/api_ds/bybit.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
(ns ta.data.api-ds.bybit
(:require
[tick.core :as tick] ; tick uses cljc.java-time
[tech.v3.dataset :as tds]
[ta.data.api.bybit :as bybit]))


(defn bybit-result->dataset [response]
(-> response
(tds/->dataset)))


(defn symbol->provider [symbol]
; {:keys [category] :as instrument} (db/instrument-details symbol)
symbol)

(def start-date-bybit (tick/date-time "2018-11-01T00:00:00"))

(defn get-series [symbol interval _range _opts]
(let [symbol (symbol->provider symbol)]
(-> (bybit/get-history {:symbol symbol
:start start-date-bybit
:interval interval})
(bybit-result->dataset))))

19 changes: 14 additions & 5 deletions lib/data/src/ta/data/import.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
(:require
[taoensso.timbre :refer [info warn error]]
[tablecloth.api :as tc]
[ta.data.api-ds.kibot :as kibot]
[ta.data.api-ds.alphavantage :as av]
[ta.warehouse :as wh]
[ta.data.settings :refer [determine-wh]]
[ta.warehouse.symbollist :refer [load-list]]
; providers
[ta.data.api-ds.kibot :as kibot]
[ta.data.api-ds.alphavantage :as av]
[ta.data.api-ds.bybit :as bybit]
))

(def dict-provider
{:kibot kibot/get-series
:alphavantage av/get-series
:bybit bybit/get-series
})


Expand All @@ -35,16 +38,22 @@
symbols))))

(comment
;; ALPHAVANTAGE
; stored in :stocks warehouse
(import-series :alphavantage "MSFT" "D" :full {})
(import-series :alphavantage "EURUSD" "D" :full {})
; stored in :fx warehouse
(import-series :alphavantage "EURUSD" "D" :full {})
; gets stored in :crypto warehouse
(import-series :alphavantage "BTCUSD" "D" :full {})

;; KIBOT
(import-series :kibot "SIL0" "D" :full {})

(import-symbols :kibot ["SIL0" "NG0" "IBM"] "D" :full {})
(import-symbols :kibot "joseph" "D" :full {})

(import-symbols :kibot "futures-kibot" "D" :full {})

;; BYBIT
(import-symbols :bybit "crypto" "D" :full {})

;
)

0 comments on commit c074b7f

Please sign in to comment.