diff options
| author | Adam Soltys <[email protected]> | 2013-11-01 19:35:02 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2013-11-01 19:35:02 -0700 |
| commit | 2e18f69d99deacca727054d301b21a7c357fd6dc (patch) | |
| tree | 71c6cea18b1822e8e6505eed81fb9fe90d984fee | |
| parent | 011aff062b50351f3608dea40b1f3aaf1c56708e (diff) | |
| download | coinos-server-2e18f69d99deacca727054d301b21a7c357fd6dc.tar.gz coinos-server-2e18f69d99deacca727054d301b21a7c357fd6dc.zip | |
Use bitcoinaverage for ticker
| -rw-r--r-- | routes/calculator.coffee | 10 |
1 files 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, |
