From cbb9155f3fb592c163c327b3a515a46567b3b425 Mon Sep 17 00:00:00 2001 From: Joe Uhren Date: Mon, 26 Feb 2024 19:44:32 -0700 Subject: [PATCH] Remove defunct exchange SouthXchange --- README.md | 3 +- lib/markets/southxchange.js | 183 ------------------------------------ lib/settings.js | 13 +-- settings.json.template | 13 +-- 4 files changed, 3 insertions(+), 209 deletions(-) delete mode 100644 lib/markets/southxchange.js diff --git a/README.md b/README.md index 0ec9c9b..6828fb9 100644 --- a/README.md +++ b/README.md @@ -100,13 +100,12 @@ 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. Has the ability to integrate directly with exchange apis and/or the coingecko api from [https://www.coingecko.com/en/api](https://www.coingecko.com/en/api) to retrieve current market prices and convert to USD. The following 8 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. Has the ability to integrate directly with exchange apis and/or the coingecko api from [https://www.coingecko.com/en/api](https://www.coingecko.com/en/api) to retrieve current market prices and convert to USD. The following 7 cryptocurrency exchanges are supported: - [AltMarkets](https://altmarkets.io) - [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* - [NonKyc](https://nonkyc.io) - [Poloniex](https://poloniex.com) - - [SouthXchange](https://southxchange.com) - [Xeggex](https://xeggex.com) - [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: diff --git a/lib/markets/southxchange.js b/lib/markets/southxchange.js deleted file mode 100644 index 794832b..0000000 --- a/lib/markets/southxchange.js +++ /dev/null @@ -1,183 +0,0 @@ -const request = require('postman-request'); -const base_url = 'https://www.southxchange.com/api/v3/'; -const market_url_template = 'https://market.southxchange.com/Market/Book/{coin}/{base}'; - -// initialize the rate limiter to wait 2 seconds between requests to prevent abusing external apis -const rateLimitLib = require('../ratelimit'); -const rateLimit = new rateLimitLib.RateLimit(1, 2000, false); - -function get_summary(coin, exchange, api_error_msg, cb) { - const req_url = base_url + 'price/' + coin + '/' + exchange; - - // pause for 2 seconds before continuing - rateLimit.schedule(function() { - request({uri: req_url, json: true}, function (error, response, body) { - if (error) - return cb(error, null); - else if (body == null || body == '' || typeof body !== 'object') - return cb(api_error_msg, null); - else if (body.Message != null) - return cb(body.Message, null); - else { - try { - const summary = { - 'volume': parseFloat(body.Volume24Hr) || 0, - 'bid': parseFloat(body.Bid) || 0, - 'ask': parseFloat(body.Ask) || 0, - 'last': parseFloat(body.Last) || 0, - 'change': parseFloat(body.Variation24Hr) || 0 - }; - - return cb(null, summary); - } catch(err) { - return cb(api_error_msg, null); - } - } - }); - }); -} - -function get_trades(coin, exchange, api_error_msg, cb) { - const req_url = base_url + 'trades/' + coin + '/' + exchange; - - // pause for 2 seconds before continuing - rateLimit.schedule(function() { - request({uri: req_url, json: true}, function (error, response, body) { - if (error) - return cb(error, null); - else if (body == null || body == '' || typeof body !== 'object') - return cb(api_error_msg, null); - else if (body.Message != null) - return cb(body.Message, null); - else { - try { - let trades = []; - - for (let t = 0; t < body.length; t++) { - trades.push({ - ordertype: body[t].Type, - price: parseFloat(body[t].Price) || 0, - quantity: parseFloat(body[t].Amount) || 0, - timestamp: parseInt(body[t].At) - }); - } - - return cb(null, trades); - } catch(err) { - return cb(api_error_msg, null); - } - } - }); - }); -} - -function get_orders(coin, exchange, api_error_msg, cb) { - const req_url = base_url + 'book/' + coin + '/' + exchange; - - // NOTE: no need to pause here because this is the first api call - request({uri: req_url, json: true}, function (error, response, body) { - if (error) - return cb(error, null, null); - else if (body == null || body == '' || typeof body !== 'object') - return cb(api_error_msg, null, null); - else if (body.Message != null) - return cb(body.Message, null, null); - else { - try { - let buys = []; - let sells = []; - - for (let b = 0; b < body.BuyOrders.length; b++) { - buys.push({ - price: parseFloat(body.BuyOrders[b].Price) || 0, - quantity: parseFloat(body.BuyOrders[b].Amount) || 0 - }); - } - - for (let s = 0; s < body.SellOrders.length; s++) { - sells.push({ - price: parseFloat(body.SellOrders[s].Price) || 0, - quantity: parseFloat(body.SellOrders[s].Amount) || 0 - }); - } - - return cb(null, buys, sells); - } catch(err) { - return cb(api_error_msg, null, null); - } - } - }); -} - -function get_chartdata(coin, exchange, api_error_msg, cb) { - const end = Date.now(); - const start = end - 86400000; - const req_url = base_url + 'history/' + coin + '/' + exchange + '/' + start.toString() + '/' + end.toString() + '/96'; - - // pause for 2 seconds before continuing - rateLimit.schedule(function() { - request({uri: req_url, json: true}, function (error, response, body) { - if (error) - return cb(error, null); - else if (body == null || body == '' || typeof body !== 'object' || typeof body == 'string' || body instanceof String) - return cb(api_error_msg, null); - else if (body.Message != null) - return cb(body.Message, null); - else { - try { - let chartdata = []; - - for (let c = 0; c < body.length; c++) { - // only display every 3rd data point (every 15 mins) - if ((c % 3) == 0) - chartdata.push([ - parseInt(new Date(body[c].Date.toString() + 'Z').getTime()), - parseFloat(body[c].PriceOpen) || 0, - parseFloat(body[c].PriceHigh) || 0, - parseFloat(body[c].PriceLow) || 0, - parseFloat(body[c].PriceClose) || 0 - ]); - } - - return cb(null, chartdata); - } catch(err) { - return cb(api_error_msg, null); - } - } - }); - }); -} - -module.exports = { - market_name: 'SouthXchange', - market_logo: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF8WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBD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cWQyyQpycQAN2o2kGYWkgZoAZAMLbkA1wmXjlv1PvWQ4VDW0xOWHO/0oqqsiaU0Ca0Q3gBOKvcEO6Tvz3mP/ymEX2NAZpXsYORXk5mOYdMM3oBoCwJ4pXes/+91z4PlvHJZJBipPhm7KqGsgAbnwGgPB8ZFe4Trvz32XydUkVDS0jSTaGRDlhLgZZJIzNABA+DTPEsePof/e5zz87tB1i0HGJYNDzTGTQ906BY8IGdB7/7z7r8Wf7hh0Muq5RRBkwH0Xz7CcgWlJBWtwIGA4EvYAIxK6TwKi8/N9j7vNsTSt3BmkeYCBCohJnIKJGY/dpoN+fHTMKK2GQ5mLoQEoDOKMRNSFNvv7foe0wh5Kigpi8uMB/JWVlvAkJS1J+kmyZPxeYmfg4gZkJb1KmODNRlJ0BM1qMnKOfxJsAAAAASUVORK5CYII=', - market_url_template: market_url_template, - market_url_case: 'u', - get_data: function(settings, cb) { - // ensure coin info is lowercase - settings.coin = settings.coin.toLowerCase(); - settings.exchange = settings.exchange.toLowerCase(); - - get_orders(settings.coin, settings.exchange, settings.api_error_msg, function(order_error, buys, sells) { - if (order_error == null) { - get_trades(settings.coin, settings.exchange, settings.api_error_msg, function(trade_error, trades) { - if (trade_error == null) { - get_summary(settings.coin, settings.exchange, settings.api_error_msg, function(summary_error, stats) { - if (summary_error == null) { - get_chartdata(settings.coin, settings.exchange, settings.api_error_msg, function (chart_error, chartdata) { - if (chart_error == null) - return cb(null, {buys: buys, sells: sells, trades: trades, stats: stats, chartdata: chartdata}); - else - return cb(chart_error, null); - }); - } else - return cb(summary_error, null); - }); - } else - return cb(trade_error, null); - }); - } else - return cb(order_error, null); - }); - } -}; \ No newline at end of file diff --git a/lib/settings.js b/lib/settings.js index cbee3d1..f79dde3 100644 --- a/lib/settings.js +++ b/lib/settings.js @@ -834,7 +834,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, dex-trade, freiexchange/freixlite, nonkyc, poloniex, southxchange, xeggex, yobit + // Supported exchanges: altmarkets, dex-trade, freiexchange/freixlite, nonkyc, poloniex, xeggex, yobit "exchanges": { // altmarkets: a collection of settings that pertain to the altmarkets exchange "altmarkets": { @@ -892,17 +892,6 @@ exports.markets_page = { // Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH" "trading_pairs": [ "LTC/BTC" ] }, - // southxchange: a collection of settings that pertain to the southxchange exchange - "southxchange": { - // enabled: Enable/disable the southxchange exchange (true/false) - // If set to false, the southxchange 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 "xeggex": { // enabled: Enable/disable the xeggex exchange (true/false) diff --git a/settings.json.template b/settings.json.template index f6b332e..b0b5ee4 100644 --- a/settings.json.template +++ b/settings.json.template @@ -918,7 +918,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, dex-trade, freiexchange/freixlite, nonkyc, poloniex, southxchange, xeggex, yobit + // Supported exchanges: altmarkets, dex-trade, freiexchange/freixlite, nonkyc, poloniex, xeggex, yobit "exchanges": { // altmarkets: a collection of settings that pertain to the altmarkets exchange "altmarkets": { @@ -976,17 +976,6 @@ // Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH" "trading_pairs": [ "LTC/BTC" ] }, - // southxchange: a collection of settings that pertain to the southxchange exchange - "southxchange": { - // enabled: Enable/disable the southxchange exchange (true/false) - // If set to false, the southxchange 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 "xeggex": { // enabled: Enable/disable the xeggex exchange (true/false)