Skip to content

Instantly share code, notes, and snippets.

@cryptorex
Created September 27, 2017 19:54
Show Gist options
  • Save cryptorex/c7123ba689a21b661bba5584be217481 to your computer and use it in GitHub Desktop.
Save cryptorex/c7123ba689a21b661bba5584be217481 to your computer and use it in GitHub Desktop.
callback json api
var request = require('request');
var base_url = 'https://trade.cryptobroker.io/api/v2';
var bresponse = undefined
function get_summary(coin, exchange, cb) {
var req_url = base_url + '/tickers/' + coin + exchange + '.json';
request({uri: req_url, json: true}, function (error, response, body) {
bresponse = body;
cb()
})
}
var lastprice = function get_ticker() {
var lastprice = bresponse.ticker.last
console.log(lastprice)
};
get_summary("btz", "btc", get_ticker());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment