From 2e18f69d99deacca727054d301b21a7c357fd6dc Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 1 Nov 2013 19:35:02 -0700 Subject: Use bitcoinaverage for ticker --- routes/calculator.coffee | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/routes/calculator.coffee b/routes/calculator.coffee index aa4fb063..0ca7eee6 100644 --- a/routes/calculator.coffee +++ b/routes/calculator.coffee @@ -9,17 +9,13 @@ exports.show = (req, res) -> exports.ticker = (req, res) -> options = - host: 'bitcoincharts.com', - path: "/t/depthcalc.json?symbol=#{req.query.symbol}&type=#{req.query.type}&amount=#{req.query.amount}¤cy=true" + host: 'api.bitcoinaverage.com', + path: "/exchanges/CAD" require('http').get(options, (r) -> r.setEncoding('utf-8') r.on('data', (chunk) -> - try - exchange = req.query.amount / JSON.parse(chunk).out - exchange = (Math.ceil(exchange * 100) / 100).toString() - catch e - exchange = "" + exchange = JSON.parse(chunk).cavirtex.rates[req.query.type].toString() res.writeHead(200, 'Content-Length': exchange.length, -- cgit v1.2.3