· 8 years ago · Nov 24, 2017, 12:12 PM
1#!node
2
3const ba = require('bitcoinaverage');
4
5var publicKey = 'YjI0MThmYjY5NDUzNGIxN2I3NWQwZGIzMzRlNzNiY2Y';
6var secretKey = 'OTUwZTNkMWZiNDQ0NDMzZWJmZTkxM2FjNjRmZjE1NjI5NjkxNzQ1ODMzNTY0NjM1YTVjODNjNjIxMWI0MDYzZA';
7
8var restClient = ba.restfulClient(publicKey, secretKey);
9
10
11// Here we log the response received by https://apiv2.bitcoinaverage.com/indices/global/ticker/BTCUSD. For custom usage you just need to implement the Anonimous function and do something else instead of console.log(response);.
12restClient.tickerGlobalPerSymbol('ETHEUR', function(response) {
13 var obj = JSON.parse(response);
14 console.log(obj.last);
15});