Last active
February 23, 2022 18:31
-
-
Save KolevDarko/4ec6c404806da155f49743c2c9efe8c3 to your computer and use it in GitHub Desktop.
Get Dogecoin price with JavaScript
This file contains hidden or 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
// npm i bitcoinaverage | |
const ba = require('bitcoinaverage'); | |
var publicKey = 'ZGUyZTQ3NTJiNDQ5NDkzM2I4YTRjNjE2YTY1Y2Y0ZjE'; | |
var restClient = ba.restfulClient(publicKey); | |
restClient.getTickerDataPerSymbol('crypto', 'DOGEUSD', function(response) { | |
console.log(response); | |
}, function(error){ | |
console.log(error); | |
}); | |
// Response is in the following format | |
/* | |
{ | |
"ask": 0.21944992, | |
"bid": 0.21788128, | |
"last": 0.21833955, | |
"high": 0.23199863, | |
"low": 0.19238372, | |
"volume": 506088554.97042447, | |
"open": { | |
"hour": 0.22255737, | |
"day": 0.19742508, | |
"week": 0.18248238, | |
"month": 0.23840021, | |
"month_3": "", | |
"month_6": "", | |
"year": "" | |
}, | |
"averages": { | |
"day": 0.20758051, | |
"week": 0.18883814, | |
"month": 0.21464995 | |
}, | |
"changes": { | |
"price": { | |
"hour": -0.00421782, | |
"day": 0.02091447, | |
"week": 0.03585717, | |
"month": -0.02006066, | |
"month_3": "", | |
"month_6": "", | |
"year": "" | |
}, | |
"percent": { | |
"hour": -1.90000000, | |
"day": 10.59000000, | |
"week": 19.65000000, | |
"month": -8.41000000, | |
"month_3": "", | |
"month_6": "", | |
"year": "" | |
} | |
}, | |
"timestamp": 1627306075, | |
"display_timestamp": "Mon, 26 Jul 2021 13:27:55 +0000", | |
"display_symbol": "DOGE-USD" | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When i tried it, i just got null. I used the exact code