Skip to content

Commit

Permalink
Updated Cryptsy Market pages
Browse files Browse the repository at this point in the history
  • Loading branch information
rudy4682 committed Jun 22, 2015
1 parent 08485de commit 09e16b4
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 35 deletions.
2 changes: 1 addition & 1 deletion lib/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function get_market_data(market, cb) {
});
break;
case 'cryptsy':
cryptsy.get_data(settings.markets.coin, settings.markets.exchange, settings.markets.marketid, function(err, obj){
cryptsy.get_data(settings.markets.coin, settings.markets.exchange, settings.markets.Crymktid, function(err, obj){
return cb(err, obj);
});
break;
Expand Down
22 changes: 11 additions & 11 deletions lib/markets/cryptsy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var request = require('request');

var base_url = 'https://api.cryptsy.com/api/v2/markets';
function get_summary(coin, exchange, marketid, cb) {
function get_summary(coin, exchange, Crymktid, cb) {
var summary = [];
var req_url1 = base_url + '/' + marketid + '/ticker';
var req_url1 = base_url + '/' + Crymktid + '/ticker';
request({uri: req_url1, json: true}, function (error, response, body) {
if (error) {
return cb(error, null);
Expand All @@ -15,7 +15,7 @@ var req_url1 = base_url + '/' + marketid + '/ticker';
summary = body;
summary.data['Bid'] = body.data['bid'].toFixed(8);
summary.data['Ask'] = body.data['ask'].toFixed(8);
var req_url = base_url + '/' + marketid;
var req_url = base_url + '/' + Crymktid;
request({uri: req_url, json: true}, function (error, response, body) {
if (error) {
return cb(error, null);
Expand All @@ -36,8 +36,8 @@ var req_url = base_url + '/' + marketid;
}
);
}
function get_trades(coin, exchange, marketid, cb) {
var req_url = base_url + '/' + marketid + '/tradehistory?limit=100';
function get_trades(coin, exchange, Crymktid, cb) {
var req_url = base_url + '/' + Crymktid + '/tradehistory?limit=100';
request({uri: req_url, json: true}, function (error, response, body) {
if (body.success == true) {
return cb (null, body.data);
Expand All @@ -47,8 +47,8 @@ function get_trades(coin, exchange, marketid, cb) {
});
}

function get_orders(coin, exchange, marketid, cb) {
var req_url = base_url + '/' + marketid + '/orderbook?type=both?limit=50';
function get_orders(coin, exchange, Crymktid, cb) {
var req_url = base_url + '/' + Crymktid + '/orderbook?type=both?limit=50';
request({uri: req_url, json: true}, function (error, response, body) {
if (body.success == true) {
var orders = body.data;
Expand Down Expand Up @@ -84,13 +84,13 @@ function get_orders(coin, exchange, marketid, cb) {
}

module.exports = {
get_data: function(coin, exchange, marketid, cb) {
get_data: function(coin, exchange, Crymktid, cb) {
var error = null;
get_orders(coin, exchange, marketid, function(err, buys, sells) {
get_orders(coin, exchange, Crymktid, function(err, buys, sells) {
if (err) { error = err; }
get_trades(coin, exchange, marketid, function(err, trades) {
get_trades(coin, exchange, Crymktid, function(err, trades) {
if (err) { error = err; }
get_summary(coin, exchange, marketid, function(err, stats) {
get_summary(coin, exchange, Crymktid, function(err, stats) {
if (err) { error = err; }
return cb(error, {buys: buys, sells: sells, chartdata: [], trades: trades, stats: stats});
});
Expand Down
24 changes: 13 additions & 11 deletions lib/markets/cryptsy2.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var request = require('request');

var base_url = 'https://api.cryptsy.com/api/v2/markets';
function get_summary(coin, exchange, marketid, cb) {
function get_summary(coin, Cryexchange2, Crymktid2, cb) {
var summary = [];
var req_url1 = base_url + '/' + marketid + '/ticker';
var req_url1 = base_url + '/' + Crymktid2 + '/ticker';
request({uri: req_url1, json: true}, function (error, response, body) {
if (error) {
return cb(error, null);
Expand All @@ -13,9 +13,11 @@ var req_url1 = base_url + '/' + marketid + '/ticker';
} else {
}};
summary = body;
summary['exchange'] = Cryexchange2;
summary.data['exchange'] = Cryexchange2;
summary.data['Bid'] = body.data['bid'].toFixed(8);
summary.data['Ask'] = body.data['ask'].toFixed(8);
var req_url = base_url + '/' + marketid;
var req_url = base_url + '/' + Crymktid2;
request({uri: req_url, json: true}, function (error, response, body) {
if (error) {
return cb(error, null);
Expand All @@ -36,8 +38,8 @@ var req_url = base_url + '/' + marketid;
}
);
}
function get_trades(coin, exchange, marketid, cb) {
var req_url = base_url + '/' + marketid + '/tradehistory?limit=100';
function get_trades(coin, Cryexchange2, Crymktid2, cb) {
var req_url = base_url + '/' + Crymktid2 + '/tradehistory?limit=100';
request({uri: req_url, json: true}, function (error, response, body) {
if (body.success == true) {
return cb (null, body.data);
Expand All @@ -47,8 +49,8 @@ function get_trades(coin, exchange, marketid, cb) {
});
}

function get_orders(coin, exchange, marketid, cb) {
var req_url = base_url + '/' + marketid + '/orderbook?type=both?limit=50';
function get_orders(coin, Cryexchange2, Crymktid2, cb) {
var req_url = base_url + '/' + Crymktid2 + '/orderbook?type=both?limit=50';
request({uri: req_url, json: true}, function (error, response, body) {
if (body.success == true) {
var orders = body.data;
Expand Down Expand Up @@ -84,13 +86,13 @@ function get_orders(coin, exchange, marketid, cb) {
}

module.exports = {
get_data: function(coin, exchange, marketid, cb) {
get_data: function(coin, Cryexchange2, Crymktid2, cb) {
var error = null;
get_orders(coin, exchange, marketid, function(err, buys, sells) {
get_orders(coin, Cryexchange2, Crymktid2, function(err, buys, sells) {
if (err) { error = err; }
get_trades(coin, exchange, marketid, function(err, trades) {
get_trades(coin, Cryexchange2, Crymktid2, function(err, trades) {
if (err) { error = err; }
get_summary(coin, exchange, marketid, function(err, stats) {
get_summary(coin, Cryexchange2, Crymktid2, function(err, stats) {
if (err) { error = err; }
return cb(error, {buys: buys, sells: sells, chartdata: [], trades: trades, stats: stats});
});
Expand Down
24 changes: 13 additions & 11 deletions lib/markets/cryptsy3.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var request = require('request');

var base_url = 'https://api.cryptsy.com/api/v2/markets';
function get_summary(coin, exchange, marketid, cb) {
function get_summary(coin, Cryexchange3, Crymktid3, cb) {
var summary = [];
var req_url1 = base_url + '/' + marketid + '/ticker';
var req_url1 = base_url + '/' + Crymktid3 + '/ticker';
request({uri: req_url1, json: true}, function (error, response, body) {
if (error) {
return cb(error, null);
Expand All @@ -13,9 +13,11 @@ var req_url1 = base_url + '/' + marketid + '/ticker';
} else {
}};
summary = body;
summary.data['exchange'] = Cryexchange3;
summary['exchange'] = Cryexchange3;
summary.data['Bid'] = body.data['bid'].toFixed(8);
summary.data['Ask'] = body.data['ask'].toFixed(8);
var req_url = base_url + '/' + marketid;
var req_url = base_url + '/' + Crymktid3;
request({uri: req_url, json: true}, function (error, response, body) {
if (error) {
return cb(error, null);
Expand All @@ -36,8 +38,8 @@ var req_url = base_url + '/' + marketid;
}
);
}
function get_trades(coin, exchange, marketid, cb) {
var req_url = base_url + '/' + marketid + '/tradehistory?limit=100';
function get_trades(coin, Cryexchange3, Crymktid3, cb) {
var req_url = base_url + '/' + Crymktid3 + '/tradehistory?limit=100';
request({uri: req_url, json: true}, function (error, response, body) {
if (body.success == true) {
return cb (null, body.data);
Expand All @@ -47,8 +49,8 @@ function get_trades(coin, exchange, marketid, cb) {
});
}

function get_orders(coin, exchange, marketid, cb) {
var req_url = base_url + '/' + marketid + '/orderbook?type=both?limit=50';
function get_orders(coin, Cryexchange3, Crymktid3, cb) {
var req_url = base_url + '/' + Crymktid3 + '/orderbook?type=both?limit=50';
request({uri: req_url, json: true}, function (error, response, body) {
if (body.success == true) {
var orders = body.data;
Expand Down Expand Up @@ -84,13 +86,13 @@ function get_orders(coin, exchange, marketid, cb) {
}

module.exports = {
get_data: function(coin, exchange, marketid, cb) {
get_data: function(coin, Cryexchange3, Crymktid3, cb) {
var error = null;
get_orders(coin, exchange, marketid, function(err, buys, sells) {
get_orders(coin, Cryexchange3, Crymktid3, function(err, buys, sells) {
if (err) { error = err; }
get_trades(coin, exchange, marketid, function(err, trades) {
get_trades(coin, Cryexchange3, Crymktid3, function(err, trades) {
if (err) { error = err; }
get_summary(coin, exchange, marketid, function(err, stats) {
get_summary(coin, Cryexchange3, Crymktid3, function(err, stats) {
if (err) { error = err; }
return cb(error, {buys: buys, sells: sells, chartdata: [], trades: trades, stats: stats});
});
Expand Down
2 changes: 2 additions & 0 deletions locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@
"yobit": "Yobit",
"empoex": "Empoex",
"cryptsy": "Cryptsy",
"cryptsy2": "Cryptsy",
"cryptsy3": "Cryptsy",

// Heavy rewards view
"heavy_title": "Reward/voting information",
Expand Down
2 changes: 1 addition & 1 deletion settings.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
//supported markets: bittrex, poloniex, yobit, empoex, cryptsy * 3
//default market is loaded by default and determines last price in header
"markets": {
"coin": "DRK",
"coin": "42",
"exchange": "BTC",
"enabled": ["bittrex", "empoex", "cryptsy"],
"default": "bittrex",
Expand Down

0 comments on commit 09e16b4

Please sign in to comment.