diff --git a/lib/protocol/exchanges/custom_ticker.js b/lib/protocol/exchanges/custom_ticker.js deleted file mode 100644 index e8a61228..00000000 --- a/lib/protocol/exchanges/custom_ticker.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -// TODO: refactor this with bitpay_ticker.js - -var https = require('https'); -var _ = require('underscore'); - -var CustomTicker = function(config) { - this.config = config; -}; - -CustomTicker.factory = function factory(config) { - return new CustomTicker(config); -}; - -CustomTicker.prototype.ticker = function ticker(currency, cb) { - var self = this; - https.get(this.config.uri, function(res) { - var buf = ''; - res.setEncoding('utf8'); - res.on('data', function(chunk) { - buf += chunk; - }) - .on('end', function() { - var json = null; - try { - json = JSON.parse(buf); - } catch(e) { - cb(new Error('Couldn\'t parse JSON response')); - return; - } - var rec = _.findWhere(json, {code: currency}); - - if (!rec) { - cb(new Error('Currency not listed: ' + currency)); - return; - } - cb(null, rec.rate); - }); - }).on('error', function(e) { - cb(e); - }); -}; - -module.exports = CustomTicker;