Remove defunct exchange stex
-The default exchange was also updated to freiexchange
This commit is contained in:
@@ -90,7 +90,7 @@ 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 11 cryptocurrency exchanges are supported:
|
||||
- [AltMarkets](https://altmarkets.io)
|
||||
- [Bittrex](https://bittrex.com)
|
||||
- [Bleutrade](https://bleutrade.com)
|
||||
@@ -99,7 +99,6 @@ Table of Contents
|
||||
- [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)
|
||||
- [Stex](https://stex.com)
|
||||
- [Txbit](https://txbit.io) *\*no chart support due to a lack of OHLCV api data*
|
||||
- [Unnamed](https://unnamed.exchange)
|
||||
- [Yobit](https://yobit.io) *\*no chart support due to a lack of OHLCV api data*
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
var request = require('postman-request');
|
||||
var base_url = 'https://api3.stex.com/public';
|
||||
const market_url_template = 'https://app.stex.com/en/trading/pair/{base}/{coin}/1D';
|
||||
|
||||
function get_summary(coin, exchange, stex_id, cb) {
|
||||
var summary = {};
|
||||
|
||||
request({ uri: base_url + '/ticker/' + stex_id, json: true}, function (error, response, body) {
|
||||
if (error)
|
||||
return cb(error, null);
|
||||
else if (body.success === true) {
|
||||
summary['bid'] = body.data['bid'];
|
||||
summary['ask'] = body.data['ask'];
|
||||
summary['volume'] = body.data['volumeQuote'];
|
||||
summary['volume_btc'] = body.data['volume'];
|
||||
summary['high'] = body.data['high'];
|
||||
summary['low'] = body.data['low'];
|
||||
summary['last'] = body.data['last'];
|
||||
summary['change'] = body.data['change'];
|
||||
|
||||
return cb(null, summary);
|
||||
} else
|
||||
return cb(error, null);
|
||||
}).on('error', function(err) {
|
||||
return cb(error, null);
|
||||
});
|
||||
}
|
||||
|
||||
function get_trades(coin, exchange, stex_id, cb) {
|
||||
var req_url = base_url + '/trades/' + stex_id + '?sort=DESC&limit=100';
|
||||
|
||||
request({ uri: req_url, json: true}, function (error, response, body) {
|
||||
if (body.success == true) {
|
||||
var trades = [];
|
||||
|
||||
for (var i = 0; i < body.data.length; i++) {
|
||||
var trade = {
|
||||
ordertype: body.data[i].type,
|
||||
price: body.data[i].price,
|
||||
quantity: body.data[i].amount,
|
||||
timestamp: body.data[i].timestamp
|
||||
};
|
||||
|
||||
trades.push(trade);
|
||||
}
|
||||
|
||||
return cb(null, trades);
|
||||
} else
|
||||
return cb(body.message, null);
|
||||
}).on('error', function(err) {
|
||||
return cb(error, null);
|
||||
});
|
||||
}
|
||||
|
||||
function get_orders(coin, exchange, stex_id, cb) {
|
||||
var req_url = base_url + '/orderbook/' + stex_id + '?limit_bids=100&limit_asks=100';
|
||||
|
||||
request({ uri: req_url, json: true}, function (error, response, body) {
|
||||
if (body.success == true) {
|
||||
var orders = body.data;
|
||||
var buys = [];
|
||||
var sells = [];
|
||||
|
||||
if (orders['bid'].length > 0) {
|
||||
for (var i = 0; i < orders['bid'].length; i++) {
|
||||
var order = {
|
||||
price: orders.bid[i].price,
|
||||
quantity: orders.bid[i].amount
|
||||
};
|
||||
|
||||
buys.push(order);
|
||||
}
|
||||
}
|
||||
|
||||
if (orders['ask'].length > 0) {
|
||||
for (var i = 0; i < orders['ask'].length; i++) {
|
||||
var order = {
|
||||
price: orders.ask[i].price,
|
||||
quantity: orders.ask[i].amount
|
||||
};
|
||||
|
||||
sells.push(order);
|
||||
}
|
||||
}
|
||||
|
||||
return cb(null, buys, sells);
|
||||
} else
|
||||
return cb(body.message, [], []);
|
||||
}).on('error', function(err) {
|
||||
return cb(error, null, null);
|
||||
});
|
||||
}
|
||||
|
||||
function get_chartdata(coin, exchange, stex_id, cb) {
|
||||
var end = Date.now();
|
||||
|
||||
end = end / 1000;
|
||||
start = end - 86400;
|
||||
|
||||
var req_url = base_url + '/chart/' + stex_id + '/30?timeStart=' + start + '&timeEnd=' + end + '&limit=1800&candlesType=1D';
|
||||
|
||||
request({ uri: req_url, json: true}, function (error, response, chartdata) {
|
||||
if (error)
|
||||
return cb(error, []);
|
||||
else {
|
||||
if (chartdata.success == true) {
|
||||
var processed = [];
|
||||
|
||||
for (var i = 0; i < chartdata.data.length; i++)
|
||||
processed.push([chartdata.data[i].time, parseFloat(chartdata.data[i].open), parseFloat(chartdata.data[i].high), parseFloat(chartdata.data[i].low), parseFloat(chartdata.data[i].close)]);
|
||||
|
||||
return cb(null, processed);
|
||||
} else
|
||||
return cb(chartdata.message, []);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function get_pair_id(coin, exchange, cb) {
|
||||
// Lookup the currency pair id needed to use the stex api
|
||||
request({ uri: base_url + '/currency_pairs/list/' + exchange, json: true}, function (error, response, body) {
|
||||
if (error)
|
||||
return cb(error, null);
|
||||
else if (body.success === true) {
|
||||
var stex_id = 0;
|
||||
// Find the currency pair
|
||||
for (i = 0; i < body.data.length; i++) {
|
||||
if (body.data[i].currency_code.toUpperCase() == coin.toUpperCase()) {
|
||||
stex_id = body.data[i].id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return cb(null, stex_id);
|
||||
} else
|
||||
return cb(error, null);
|
||||
}).on('error', function(err) {
|
||||
return cb(error, null);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
market_name: 'Stex',
|
||||
market_logo: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAAsTAAALEwEAmpwYAAAFyGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDIgNzkuMTY0NDYwLCAyMDIwLzA1LzEyLTE2OjA0OjE3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjEuMiAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDIwLTEyLTI1VDE5OjQwOjAyLTA3OjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDIwLTEyLTI1VDE5OjQwOjAyLTA3OjAwIiB4bXA6TW9k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A8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+1hd2ZgAAAIlJREFUKBVjYBgFRIBv377tAANpaekVK1Z8+PDhxIkTBgYGGzZsOHPmzIEDB4BsPz+/S5cuzZ49e8aMGQzPnz8Hyn38+JGPjw+oH6hCQUEByAAKbtq0acGCBSIiIkDu+vXr3717x83NzbALDH79+iUgIICmAW5DSEjIlStXZs2aNW/evNE4oQkAAC8ZS4smAdEcAAAAAElFTkSuQmCC',
|
||||
market_url_template: market_url_template,
|
||||
market_url_case: 'u',
|
||||
get_data: function(settings, cb) {
|
||||
var error = null;
|
||||
get_pair_id(settings.coin.toUpperCase(), settings.exchange.toUpperCase(), function (err, stex_id) {
|
||||
get_chartdata(settings.coin.toUpperCase(), settings.exchange.toUpperCase(), stex_id, function (err, chartdata) {
|
||||
if (err) { chartdata = []; error = err; }
|
||||
get_orders(settings.coin.toUpperCase(), settings.exchange.toUpperCase(), stex_id, function (err, buys, sells) {
|
||||
if (err) { error = err; }
|
||||
get_trades(settings.coin.toUpperCase(), settings.exchange.toUpperCase(), stex_id, function (err, trades) {
|
||||
if (err) { error = err; }
|
||||
get_summary(settings.coin.toUpperCase(), settings.exchange.toUpperCase(), stex_id, function (err, stats) {
|
||||
if (err) { error = err; }
|
||||
return cb(error, { buys: buys, sells: sells, chartdata: chartdata, trades: trades, stats: stats });
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
+2
-13
@@ -770,7 +770,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, stex, txbit, unnamed, yobit
|
||||
// Supported exchanges: altmarkets, bittrex, bleutrade, crex, dex-trade, freiexchange/freixlite, poloniex, southxchange, txbit, unnamed, yobit
|
||||
"exchanges": {
|
||||
// altmarkets: a collection of settings that pertain to the altmarkets exchange
|
||||
"altmarkets": {
|
||||
@@ -861,17 +861,6 @@ exports.markets_page = {
|
||||
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
|
||||
"trading_pairs": [ "LTC/BTC" ]
|
||||
},
|
||||
// stex: a collection of settings that pertain to the stex exchange
|
||||
"stex": {
|
||||
// enabled: Enable/disable the stex exchange (true/false)
|
||||
// If set to false, the stex 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", "LTC/USDT" ]
|
||||
},
|
||||
// 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": {
|
||||
@@ -915,7 +904,7 @@ exports.markets_page = {
|
||||
"default_exchange": {
|
||||
// exchange_name: The name of the default exchange must exactly match the name of an exchange in the "exchanges" setting above
|
||||
// See the list of supported exchanges above for the list of supported exchange names
|
||||
"exchange_name": "stex",
|
||||
"exchange_name": "freiexchange",
|
||||
// trading_pair: The name of the trading pair for the default exchange must exactly match the name of a trading pair from the "exchanges" setting above
|
||||
"trading_pair": "LTC/BTC"
|
||||
}
|
||||
|
||||
+2
-13
@@ -854,7 +854,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, stex, txbit, unnamed, yobit
|
||||
// Supported exchanges: altmarkets, bittrex, bleutrade, crex, dex-trade, freiexchange/freixlite, poloniex, southxchange, txbit, unnamed, yobit
|
||||
"exchanges": {
|
||||
// altmarkets: a collection of settings that pertain to the altmarkets exchange
|
||||
"altmarkets": {
|
||||
@@ -945,17 +945,6 @@
|
||||
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
|
||||
"trading_pairs": [ "LTC/BTC" ]
|
||||
},
|
||||
// stex: a collection of settings that pertain to the stex exchange
|
||||
"stex": {
|
||||
// enabled: Enable/disable the stex exchange (true/false)
|
||||
// If set to false, the stex 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", "LTC/USDT" ]
|
||||
},
|
||||
// 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": {
|
||||
@@ -999,7 +988,7 @@
|
||||
"default_exchange": {
|
||||
// exchange_name: The name of the default exchange must exactly match the name of an exchange in the "exchanges" setting above
|
||||
// See the list of supported exchanges above for the list of supported exchange names
|
||||
"exchange_name": "stex",
|
||||
"exchange_name": "freiexchange",
|
||||
// trading_pair: The name of the trading pair for the default exchange must exactly match the name of a trading pair from the "exchanges" setting above
|
||||
"trading_pair": "LTC/BTC"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user