Market/Exchange cleanup

-The following defunct exchanges have been removed: bleutrade, crex24, txbit and unnamed
This commit is contained in:
Joe Uhren
2023-10-11 18:56:11 -06:00
parent 74c85a4df3
commit b3eda54981
7 changed files with 3 additions and 642 deletions
+1 -5
View File
@@ -92,17 +92,13 @@ Table of Contents
- **Movement:** Displays latest blockchain transactions that are greater than a certain configurable amount
- **Network:** Displays a list of peers that have connected to the coind wallet in the past 24 hours, along with useful addnode data that can be used to connect your own wallets to the network easier
- **Top 100:** Displays the top 100 richest wallet addresses, the top 100 wallet addresses that have the highest total number of coins received based on adding up all received transactions, as well as a table and pie chart breakdown of wealth distribution. Additional support for omitting burned coins from top 100 lists
- **Markets:** Displays a number of exchange-related metrics including market summary, 24 hour chart, most recent buy/sell orders and latest trade history. The last known default exchange price is automatically converted to USD using the coingecko api from [https://www.coingecko.com/en/api](https://www.coingecko.com/en/api). The following 12 cryptocurrency exchanges are supported:
- **Markets:** Displays a number of exchange-related metrics including market summary, 24 hour chart, most recent buy/sell orders and latest trade history. The last known default exchange price is automatically converted to USD using the coingecko api from [https://www.coingecko.com/en/api](https://www.coingecko.com/en/api). The following 8 cryptocurrency exchanges are supported:
- [AltMarkets](https://altmarkets.io)
- [Bittrex](https://bittrex.com)
- [Bleutrade](https://bleutrade.com)
- [Crex24](https://crex24.com)
- [Dex-Trade](https://dex-trade.com)
- [FreiExchange](https://freiexchange.com)/[FreiXLite](https://freixlite.com) *\*no chart support due to a lack of OHLCV api data*
- [Poloniex](https://poloniex.com)
- [SouthXchange](https://southxchange.com)
- [Txbit](https://txbit.io) *\*no chart support due to a lack of OHLCV api data*
- [Unnamed](https://unnamed.exchange)
- [Xeggex](https://xeggex.com) *\*no chart support due to a lack of OHLCV api data*
- [Yobit](https://yobit.io) *\*no chart support due to a lack of OHLCV api data*
- **API:** A listing of available public API's that can be used to retrieve information from the network without the need for a local wallet. The following public API's are supported:
-144
View File
@@ -1,144 +0,0 @@
var request = require('postman-request');
var base_url = 'https://bleutrade.com/api/v3/public';
const market_url_template = 'https://bleutrade.com/en/trade/pro/{coin}/{base}';
function get_summary(coin, exchange, cb) {
var req_url = base_url + '/getmarketsummary?market=' + coin + '_' + exchange;
request({uri: req_url, json: true}, function (error, response, body) {
if (error)
return cb(error, null);
else {
if (body.message)
return cb(body.message, null);
else {
var retVal = {
'high': body.result.High,
'low': body.result.Low,
'volume': body.result.Volume,
'bid': body.result.Bid,
'ask': body.result.Ask,
'last': body.result.Last,
'prev': body.result.PrevDay
};
return cb (null, retVal);
}
}
});
}
function get_trades(coin, exchange, cb) {
var req_url = base_url + '/getmarkethistory?market=' + coin + '_' + exchange + '&count=50';
request({uri: req_url, json: true}, function (error, response, body) {
if (body.success) {
var trades = [];
if (body.result.length > 0) {
for (var i = 0; i < body.result.length; i++) {
var trade = {
ordertype: body.result[i]['OrderType'],
price: body.result[i]['Price'],
quantity: body.result[i]['Quantity'],
total: body.result[i]['Total'],
timestamp: parseInt(new Date(body.result[i]['TimeStamp']).getTime()/1000)
};
trades.push(trade);
}
}
return cb(null, trades);
} else
return cb(body.message, null);
});
}
function get_orders(coin, exchange, cb) {
var req_url = base_url + '/getorderbook?market=' + coin + '_' + exchange + '&type=all' + '&depth=50';
request({uri: req_url, json: true}, function (error, response, body) {
if (body.success) {
var orders = body.result;
var buys = [];
var sells = [];
if (orders['buy'].length > 0) {
for (var i = 0; i < orders['buy'].length; i++) {
var order = {
price: orders.buy[i].Rate,
quantity: orders.buy[i].Quantity
};
buys.push(order);
}
}
if (orders['sell'].length > 0) {
for (var i = 0; i < orders['sell'].length; i++) {
var order = {
price: orders.sell[i].Rate,
quantity: orders.sell[i].Quantity
};
sells.push(order);
}
}
return cb(null, buys, sells);
} else
return cb(body.message, [], []);
});
}
function get_chartdata(coin, exchange, cb) {
var end = Date.now();
end = end / 1000;
start = end - 86400;
var req_url = base_url + '/getcandles/?market=' + coin + '_' + exchange + '&period=1h';
request({ uri: req_url, json: true}, function (error, response, chartdata) {
if (error)
return cb(error, []);
else {
if (chartdata.success) {
var processed = [];
for (var i = 0; i < chartdata.result.length; i++) {
// only take values more recent than the last 24 hours
if (new Date(chartdata.result[i].TimeStamp).getTime()/1000 > start)
processed.push([new Date(chartdata.result[i].TimeStamp).getTime(), parseFloat(chartdata.result[i].Open), parseFloat(chartdata.result[i].High), parseFloat(chartdata.result[i].Low), parseFloat(chartdata.result[i].Close)]);
}
return cb(null, processed);
} else
return cb(chartdata.message, []);
}
});
}
module.exports = {
market_name: 'Bleutrade',
market_logo: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF8WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDIgNzkuMTY0NDYwLCAyMDIwLzA1LzEyLTE2OjA0OjE3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1wOkNyZWF0b3JUb29sP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WS2hTgDO5fnCPNBUXUBxj3/0OJ8l5US+DxQlYmtlpqxp2XjoEZBosSjkNVYA4I85BCxAcplk6jaYHlBxkyoI3iM54hWZWN+DBA40zK0cPghMAR4Iq9il4Ckj1b5LFyUdipf8Cba+9zaJkr9qMf7GT9HC1HxwVxuD2+DbwIHqX4uxBqpcug/SzEOxpFAbcDz9k1id/At3gdXn7zpxjdKXaHcDNC4hCR4aL83HZAbSeLSzL7R2aQLxrGFR1A9Hx35frm18y69NFYCuBc62z09Zmthwmw1aU9Aslzxspbqq0QFKydttR+qoYxI21J/at+dOPXpA31pZFEONfwAie3PFmXOIAAAAASUVORK5CYII=',
market_url_template: market_url_template,
market_url_case: 'u',
get_data: function(settings, cb) {
var error = null;
get_chartdata(settings.coin, settings.exchange, function (err, chartdata) {
if (err) { chartdata = []; error = err; }
get_orders(settings.coin, settings.exchange, function(err, buys, sells) {
if (err) { error = err; }
get_trades(settings.coin, settings.exchange, function(err, trades) {
if (err) { error = err; }
get_summary(settings.coin, settings.exchange, function(err, stats) {
if (err) { error = err; }
return cb(error, {buys: buys, sells: sells, chartdata: chartdata, trades: trades, stats: stats});
});
});
});
});
}
};
-139
View File
@@ -1,139 +0,0 @@
var request = require('postman-request');
var base_url = 'https://api.crex24.com/v2/public';
const market_url_template = 'https://crex24.com/exchange/{coin}-{base}';
function get_summary(coin, exchange, cb) {
var url=base_url + '/tickers?instrument=' + coin.toUpperCase() + '-' + exchange.toUpperCase();
request({uri: url, json: true}, function (error, response, body) {
if (error)
return cb(error, null);
else if (body.error !== true) {
var summary = {};
summary['ask'] = body[0]['ask'];
summary['bid'] = body[0]['bid'];
summary['volume'] = body[0]['baseVolume'];
summary['volume_btc'] = body[0]['volumeInBtc'];
summary['high'] = body[0]['high'];
summary['low'] = body[0]['low'];
summary['last'] = body[0]['last'];
summary['change'] = body[0]['percentChange'];
return cb(null, summary);
} else
return cb(error, null);
});
}
function get_trades(coin, exchange, cb) {
var req_url = base_url + '/recentTrades?instrument=' + coin.toUpperCase() + '-' + exchange.toUpperCase();
request({ uri: req_url, json: true}, function (error, response, body) {
if (error)
return cb(error, null);
else if (body.error !== true) {
var trades = [];
for (var i = 0; i < body.length; i++) {
var trade = {
ordertype: body[i].side,
quantity: body[i].volume,
price: body[i].price,
timestamp: parseInt(new Date(body[i].timestamp).getTime()/1000)
};
trades.push(trade);
}
return cb(null, trades);
} else
return cb(body.Message, null);
});
}
function get_orders(coin, exchange, cb) {
var req_url = base_url + '/orderBook?instrument=' + coin.toUpperCase() + '-' + exchange.toUpperCase();
request({ uri: req_url, json: true}, function (error, response, body) {
if (error)
return cb(error, null);
else if (body.error !== true) {
var buys = [];
var sells = [];
if (body['buyLevels'].length > 0) {
for (var i = 0; i < body['buyLevels'].length; i++) {
var order = {
price: body['buyLevels'][i].price,
quantity: body['buyLevels'][i].volume
};
buys.push(order);
}
}
if (body['sellLevels'].length > 0) {
for (var i = 0; i < body['sellLevels'].length; i++) {
var order = {
price: body['sellLevels'][i].price,
quantity: body['sellLevels'][i].volume
};
sells.push(order);
}
}
return cb(null, buys, sells);
} else
return cb(body.Message, [], []);
});
}
function get_chartdata(coin, exchange, cb) {
var end = Date.now();
end = end / 1000;
start = end - 86400;
var req_url = base_url + '/ohlcv?instrument=' + coin.toUpperCase() + '-' + exchange.toUpperCase() + '&granularity=15m&limit=100';
request({ uri: req_url, json: true}, function (error, response, chartdata) {
if (error)
return cb(error, []);
else {
var processed = [];
for (var i = 0; i < chartdata.length; i++) {
// only keep values from within the last 24 hours
if (new Date(chartdata[i].timestamp).getTime()/1000 > start)
processed.push([new Date(chartdata[i].timestamp).getTime(), parseFloat(chartdata[i].open), parseFloat(chartdata[i].high), parseFloat(chartdata[i].low), parseFloat(chartdata[i].close)]);
}
return cb(null, processed);
}
});
}
module.exports = {
market_name: 'Crex24',
market_logo: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFyGlUWHRYTUw6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qWv68CCMWWQwrutDL5rHEMEajiXI0RNFAgFXwAYKSOPWUd/Gj3GOCd1QRwlbuFG1FL6tAHHSL84Z8rKKO7RUwDryuFIhS1JcxSYaeMSLKc44PmNRBdTk5TKayKpiWQ0HsK96Wp7ZsjYucGkVv7BiBVTUsHiXQg4L6OJDNcjzHoroOAJe7e15cjT85V4Cpv45PFgnbubNQo4yLGsU6wfI/p/iGs8+A6r2FoXMAfL762cI6kMyiSMff3v317AKSqImhwSfeMMDdhDX/T08PJuH3XSmHgAAAABJRU5ErkJggg==',
market_url_template: market_url_template,
market_url_case: 'u',
get_data: function(settings, cb) {
var error = null;
get_chartdata(settings.coin, settings.exchange, function (err, chartdata) {
if (err) { chartdata = []; error = err; }
get_orders(settings.coin, settings.exchange, function(err, buys, sells) {
if (err) { error = err; }
get_trades(settings.coin, settings.exchange, function(err, trades) {
if (err) { error = err; }
get_summary(settings.coin, settings.exchange, function(err, stats) {
if (err) { error = err; }
return cb(error, {buys: buys, sells: sells, chartdata: chartdata, trades: trades, stats: stats});
});
});
});
});
}
};
-121
View File
@@ -1,121 +0,0 @@
const request = require('postman-request');
const base_url = 'https://api.txbit.io/api/public/';
const market_url_template = 'https://txbit.io/Trade/{coin}/{base}';
function get_summary(coin, exchange, cb) {
var summary = {};
request({ uri: base_url + 'getmarketsummary?market=' + coin + '/' + exchange, json: true}, function (error, response, body) {
if (error)
return cb(error, null);
else if (body.success == null || body.success == false)
return cb(body.message, null);
else {
summary['bid'] = body.result.Bid;
summary['ask'] = body.result.Ask;
summary['high'] = body.result.High;
summary['low'] = body.result.Low;
summary['volume'] = body.result.Volume;
summary['volume_btc'] = body.result.BaseVolume;
summary['last'] = body.result.Last;
summary['prev'] = body.result.PrevDay;
return cb(null, summary);
}
}).on('error', function(err) {
return cb(error, null);
});
}
function get_trades(coin, exchange, cb) {
var req_url = base_url + 'getmarkethistory?market=' + coin + '/' + exchange;
request({ uri: req_url, json: true}, function (error, response, body) {
if (error)
return cb(error, null);
else if (body.success == null || body.success == false)
return cb(body.message, null);
else {
var trade_body = body.result;
var trades = [];
for (var i = 0; i < trade_body.length; i++) {
trades.push({
ordertype: trade_body[i].OrderType,
price: trade_body[i].Price,
quantity: trade_body[i].Quantity,
timestamp: parseInt(new Date(trade_body[i].TimeStamp).getTime()/1000)
});
}
return cb(null, trades);
}
}).on('error', function(err) {
return cb(error, null);
});
}
function get_orders(coin, exchange, cb) {
var req_url = base_url + 'getorderbook?market=' + coin + '/' + exchange + '&type=both';
request({ uri: req_url, json: true}, function (error, response, body) {
if (error)
return cb(error, [], []);
else if (body.success == null || body.success == false)
return cb(body.message, null);
else {
var orders = body.result;
var buys = [];
var sells = [];
const max_records = 250;
if (orders['buy'].length > 0) {
for (var i = 0; i < orders['buy'].length; i++) {
if (i < max_records) {
buys.push({
price: orders['buy'][i].Rate,
quantity: orders['buy'][i].Quantity
});
} else
break;
}
}
if (orders['sell'].length > 0) {
for (var i = orders['sell'].length - 1; i >= 0; i--) {
if (orders['sell'].length <= max_records || (orders['sell'].length - 1) - i < max_records) {
sells.push({
price: orders['sell'][i].Rate,
quantity: orders['sell'][i].Quantity
});
} else
break;
}
}
return cb(null, buys, sells);
}
}).on('error', function(err) {
return cb(error, null, null);
});
}
module.exports = {
market_name: 'Txbit',
market_logo: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABF1BMVEUAAAD/rwD/swD/sAD/pwD/sQA2fuH/tAD/sgA5gOH/swAteN//tAD/swD/pwA4f+E5f+H/8r3/vTP///84f+H/swC81vv/qQDz9/3/swA4f+H/swD/+bb/tABCheL+swA4f+E5gOH///83f+H/swA5gOH/pwA8geIbbN0UaNz/sAAjcd4LYtv/qgAweuD/9tn/uBzm8v/c6fqkxPF4qexQj+ZFiOMpdd//3Ir/zlT/vyb/sgD/pAD/owD/mgDN4v/I4P++2v////vW5fnJ3Pe0zvOSuvKKtvJypOproOn/+eb/+OZUkOVNjOQRZtsAWNj/88//4qz/4p7/5Iz/4on/3n//3Hr/0W//x1L/yUv/wkH/sxP/tQC42zL+AAAAInRSTlMAGOLOzsW+rZqUfHdu9/Xs6Ofny8mhmpCOjoaBdjYzJyEVZSx5kAAAANRJREFUGNMtylViAkEQRdEaNATi7slrm+5R3Im7u7H/ddAwnL+69WjMKeXTmXzJoandedOPf013bja519EZ/OBOdjlfI6uoyi+vwF/ALbs5Ct1zoBUMpDS2OFTUF8C9/P/8aBs55DuUa17e1BDBimLJs7SovCddwWm9cYUoMClaYEzoB1R8/XyNtkzRKrPFrVUboSfw3kvT9jgIVzPl1/HV26JDNqFC3ztGJzggKiQT97aMlpwhKyeU5z+e4OxbZmmi0BRV4C3u239if3NlaTmzsUfWCENmIl5ka+2dAAAAAElFTkSuQmCC',
market_url_template: market_url_template,
market_url_case: 'u',
get_data: function(settings, cb) {
var error = null;
get_orders(settings.coin.toUpperCase(), settings.exchange.toUpperCase(), function(err, buys, sells) {
if (err) { error = err; }
get_trades(settings.coin.toUpperCase(), settings.exchange.toUpperCase(), function(err, trades) {
if (err) { error = err; }
get_summary(settings.coin.toUpperCase(), settings.exchange.toUpperCase(), function(err, stats) {
if (err) { error = err; }
return cb(error, {buys: buys, sells: sells, trades: trades, stats: stats});
});
});
});
}
};
-141
View File
@@ -1,141 +0,0 @@
const request = require('postman-request');
const base_url = 'https://api.unnamed.exchange/v1/Public/';
const market_url_template = 'https://www.unnamed.exchange/Exchange?market={coin}_{base}';
function get_summary(coin, exchange, cb) {
var summary = {};
request({ uri: base_url + 'Ticker?market=' + coin + '_' + exchange, json: true}, function (error, response, body) {
if (error)
return cb(error, null);
else if (body.error != null)
return cb(body.error, null);
else {
summary['bid'] = body.highestBuy;
summary['ask'] = body.lowestSell;
summary['high'] = body.high;
summary['low'] = body.low;
summary['volume'] = body.volume;
summary['volume_btc'] = body.baseVolume;
summary['last'] = body.close;
summary['prev'] = body.open;
summary['change'] = (body.change);
return cb(null, summary);
}
}).on('error', function(err) {
return cb(error, null);
});
}
function get_trades(coin, exchange, cb) {
var req_url = base_url + 'TradeHistory?market=' + coin + '_' + exchange;
request({ uri: req_url, json: true}, function (error, response, body) {
if (error)
return cb(error, null);
else if (body.error != null)
return cb(body.error, null);
else {
var trades = [];
for (var i = 0; i < body.length; i++) {
trades.push({
ordertype: body[i].type,
price: body[i].price,
quantity: body[i].amount,
timestamp: parseInt(new Date(body[i].timestamp).getTime()/1000)
});
}
return cb(null, trades);
}
}).on('error', function(err) {
return cb(error, null);
});
}
function get_orders(coin, exchange, cb) {
var req_url = base_url + 'OrderBook?market=' + coin + '_' + exchange;
request({ uri: req_url, json: true}, function (error, response, body) {
if (error)
return cb(error, [], []);
else if (body.error != null)
return cb(body.error, null);
else {
var buys = [];
var sells = [];
if (body['buy'].length > 0) {
for (var i = 0; i < body['buy'].length; i++) {
buys.push({
price: body['buy'][i].price,
quantity: body['buy'][i].amount
});
}
}
if (body['sell'].length > 0) {
for (var i = 0; i < body['sell'].length; i++) {
sells.push({
price: body['sell'][i].price,
quantity: body['sell'][i].amount
});
}
}
return cb(null, buys, sells);
}
}).on('error', function(err) {
return cb(error, null, null);
});
}
function get_chartdata(coin, exchange, cb) {
var end = Date.now();
end = end / 1000;
start = end - 86400;
var req_url = base_url + 'Chart?market=' + coin + '_' + exchange + '&minutes=15';
request({uri: req_url, json: true}, function (error, response, chartdata) {
if (error)
return cb(error, []);
else {
if (chartdata.error == null) {
var processed = [];
for (var i = 0; i < chartdata.length; i++)
processed.push([chartdata[i].openTime, parseFloat(chartdata[i].open), parseFloat(chartdata[i].high), parseFloat(chartdata[i].low), parseFloat(chartdata[i].close)]);
return cb(null, processed);
} else
return cb(chartdata.error, []);
}
});
}
module.exports = {
market_name: 'Unnamed',
market_logo: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABDlBMVEUAAADX4OwlPZ4mPp+wweDT3ezI1um8zeUkN5q4zOURFYMaMZjZ4e3T3esxc8fJ1ecgKZA3dsgxP5wUHos/TqSKrdtIgcyPqNVjebxQarZbjtETG4kRFYQRFYQQEoETGogTG4kVJI4PD38VJI4PD3/n6vDm6e8ucMYPEIDf5e7P2uvI1unI1ukfLZMmOJkiOZwYJY4oQqEaKpKkvuE+e8o9eslIWaoUHYpIWqsVIYwmOZqOsNw4Z7tiktKjt9uBms6Cmc1Gbbyhs9lmislXesGPpdOSpNB2isR3kMkPEYAPD38RFYMWJI4THIgPD38PD38TGocPD38PD38fQaQPD38ucMYPD3/x8fLu7/IQE4IIR+7cAAAAVXRSTlMA8+HY1PHm3t7c0Sv07+vj4t/f3tbR0dDOzszEvKaNe2EuIBsF/fv5+fbu6efm5N/e3dzZ2NbW1tXV1NHQzszMzMvKycnGxsbEv7SenJSPZ01FKh8NaswLygAAALtJREFUGNN1z8UaglAUReGDlIDdXWB3d3fnJd7/RYT7OXCga7b/2YY/JXn+8b3vDopy3I7dsAS4q8vu9dpdOVkTjSldOtYQQmO6J2tPfb8OAbqF9HyWgCwAiPysaEM4p2XaF2DvV2j0Ka34wxArVwrZIcdxbNNmrVdPABBhR0zQ4wkSTjYCRlFqzphTKRPRpqIYYosVYwYwEb7JGUN8syxhCK3jGBLbvDrQQc3sEhiEGkm6Adwk2Uj++P0G4e4ajxm8wgsAAAAASUVORK5CYII=',
market_url_template: market_url_template,
market_url_case: 'u',
get_data: function(settings, cb) {
var error = null;
get_chartdata(settings.coin.toUpperCase(), settings.exchange.toUpperCase(), function (err, chartdata) {
if (err) { chartdata = []; error = err; }
get_orders(settings.coin.toUpperCase(), settings.exchange.toUpperCase(), function(err, buys, sells) {
if (err) { error = err; }
get_trades(settings.coin.toUpperCase(), settings.exchange.toUpperCase(), function(err, trades) {
if (err) { error = err; }
get_summary(settings.coin.toUpperCase(), settings.exchange.toUpperCase(), function(err, stats) {
if (err) { error = err; }
return cb(error, {buys: buys, sells: sells, chartdata: chartdata, trades: trades, stats: stats});
});
});
});
});
}
};
+1 -46
View File
@@ -803,7 +803,7 @@ exports.markets_page = {
"show_market_select": true,
// exchanges: Enable/disable api integration with any of the available built-in exchanges
// Enabled exchanges display a number of exchange-related metrics including market summary, 24 hour chart, most recent buy/sell orders and latest trade history
// Supported exchanges: altmarkets, bittrex, bleutrade, crex, dex-trade, freiexchange/freixlite, poloniex, southxchange, txbit, unnamed, xeggex, yobit
// Supported exchanges: altmarkets, bittrex, dex-trade, freiexchange/freixlite, poloniex, southxchange, xeggex, yobit
"exchanges": {
// altmarkets: a collection of settings that pertain to the altmarkets exchange
"altmarkets": {
@@ -827,28 +827,6 @@ exports.markets_page = {
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": [ "LTC/BTC" ]
},
// bleutrade: a collection of settings that pertain to the bleutrade exchange
"bleutrade": {
// enabled: Enable/disable the bleutrade exchange (true/false)
// If set to false, the bleutrade page will be completely inaccessible and no market data will be downloaded for this exchange
"enabled": false,
// trading_pairs: An array of market trading pair symbols
// You can add as many trading pairs as necessary
// All entries must specify your coins symbol as it is displayed on the exchange, followed by a slash (/) and ending with the symbol of the market or asset that is being traded against
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": [ "LTC/BTC" ]
},
// crex: a collection of settings that pertain to the crex exchange
"crex": {
// enabled: Enable/disable the crex exchange (true/false)
// If set to false, the crex page will be completely inaccessible and no market data will be downloaded for this exchange
"enabled": false,
// trading_pairs: An array of market trading pair symbols
// You can add as many trading pairs as necessary
// All entries must specify your coins symbol as it is displayed on the exchange, followed by a slash (/) and ending with the symbol of the market or asset that is being traded against
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": [ "LTC/BTC" ]
},
// dextrade: a collection of settings that pertain to the dex-trade exchange
"dextrade": {
// enabled: Enable/disable the dex-trade exchange (true/false)
@@ -894,29 +872,6 @@ exports.markets_page = {
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": [ "LTC/BTC" ]
},
// txbit: a collection of settings that pertain to the txbit exchange
// NOTE: txbit does not display a 24-hour chart due to a lack of OHLCV api data
"txbit": {
// enabled: Enable/disable the txbit exchange (true/false)
// If set to false, the txbit page will be completely inaccessible and no market data will be downloaded for this exchange
"enabled": false,
// trading_pairs: An array of market trading pair symbols
// You can add as many trading pairs as necessary
// All entries must specify your coins symbol as it is displayed on the exchange, followed by a slash (/) and ending with the symbol of the market or asset that is being traded against
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": [ "LTC/ETH" ]
},
// unnamed: a collection of settings that pertain to the unnamed exchange
"unnamed": {
// enabled: Enable/disable the unnamed exchange (true/false)
// If set to false, the unnamed page will be completely inaccessible and no market data will be downloaded for this exchange
"enabled": false,
// trading_pairs: An array of market trading pair symbols
// You can add as many trading pairs as necessary
// All entries must specify your coins symbol as it is displayed on the exchange, followed by a slash (/) and ending with the symbol of the market or asset that is being traded against
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": [ "LTC/BTC" ]
},
// xeggex: a collection of settings that pertain to the xeggex exchange
// NOTE: xeggex does not display a 24-hour chart due to a lack of OHLCV api data
"xeggex": {
+1 -46
View File
@@ -887,7 +887,7 @@
"show_market_select": true,
// exchanges: Enable/disable api integration with any of the available built-in exchanges
// Enabled exchanges display a number of exchange-related metrics including market summary, 24 hour chart, most recent buy/sell orders and latest trade history
// Supported exchanges: altmarkets, bittrex, bleutrade, crex, dex-trade, freiexchange/freixlite, poloniex, southxchange, txbit, unnamed, xeggex, yobit
// Supported exchanges: altmarkets, bittrex, dex-trade, freiexchange/freixlite, poloniex, southxchange, xeggex, yobit
"exchanges": {
// altmarkets: a collection of settings that pertain to the altmarkets exchange
"altmarkets": {
@@ -911,28 +911,6 @@
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": [ "LTC/BTC" ]
},
// bleutrade: a collection of settings that pertain to the bleutrade exchange
"bleutrade": {
// enabled: Enable/disable the bleutrade exchange (true/false)
// If set to false, the bleutrade page will be completely inaccessible and no market data will be downloaded for this exchange
"enabled": false,
// trading_pairs: An array of market trading pair symbols
// You can add as many trading pairs as necessary
// All entries must specify your coins symbol as it is displayed on the exchange, followed by a slash (/) and ending with the symbol of the market or asset that is being traded against
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": [ "LTC/BTC" ]
},
// crex: a collection of settings that pertain to the crex exchange
"crex": {
// enabled: Enable/disable the crex exchange (true/false)
// If set to false, the crex page will be completely inaccessible and no market data will be downloaded for this exchange
"enabled": false,
// trading_pairs: An array of market trading pair symbols
// You can add as many trading pairs as necessary
// All entries must specify your coins symbol as it is displayed on the exchange, followed by a slash (/) and ending with the symbol of the market or asset that is being traded against
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": [ "LTC/BTC" ]
},
// dextrade: a collection of settings that pertain to the dex-trade exchange
"dextrade": {
// enabled: Enable/disable the dex-trade exchange (true/false)
@@ -978,29 +956,6 @@
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": [ "LTC/BTC" ]
},
// txbit: a collection of settings that pertain to the txbit exchange
// NOTE: txbit does not display a 24-hour chart due to a lack of OHLCV api data
"txbit": {
// enabled: Enable/disable the txbit exchange (true/false)
// If set to false, the txbit page will be completely inaccessible and no market data will be downloaded for this exchange
"enabled": false,
// trading_pairs: An array of market trading pair symbols
// You can add as many trading pairs as necessary
// All entries must specify your coins symbol as it is displayed on the exchange, followed by a slash (/) and ending with the symbol of the market or asset that is being traded against
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": [ "LTC/ETH" ]
},
// unnamed: a collection of settings that pertain to the unnamed exchange
"unnamed": {
// enabled: Enable/disable the unnamed exchange (true/false)
// If set to false, the unnamed page will be completely inaccessible and no market data will be downloaded for this exchange
"enabled": false,
// trading_pairs: An array of market trading pair symbols
// You can add as many trading pairs as necessary
// All entries must specify your coins symbol as it is displayed on the exchange, followed by a slash (/) and ending with the symbol of the market or asset that is being traded against
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": [ "LTC/BTC" ]
},
// xeggex: a collection of settings that pertain to the xeggex exchange
// NOTE: xeggex does not display a 24-hour chart due to a lack of OHLCV api data
"xeggex": {