mirror of
https://github.com/status-im/open-bounty.git
synced 2025-02-09 08:03:41 +00:00
Support for getting token USD value
* utility function for getting current USD value of a crypto token from cryptonator API
This commit is contained in:
parent
153c3dc7cb
commit
f379da4924
14
src/clj/commiteth/util/crypto_fiat_value.clj
Normal file
14
src/clj/commiteth/util/crypto_fiat_value.clj
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
(ns commiteth.util.crypto-fiat-value
|
||||||
|
(:require [clj-http.client :as http]
|
||||||
|
[clojure.data.json :as json]))
|
||||||
|
|
||||||
|
|
||||||
|
(defn get-token-usd-price [token]
|
||||||
|
(let [url (str "https://api.cryptonator.com/api/ticker/"
|
||||||
|
token
|
||||||
|
"-usd")
|
||||||
|
m (->> (http/get url)
|
||||||
|
(:body)
|
||||||
|
(json/read-str))]
|
||||||
|
(-> (get-in m ["ticker" "price"])
|
||||||
|
(read-string))))
|
Loading…
x
Reference in New Issue
Block a user