Xeggex market improvements

This commit is contained in:
Joe Uhren
2023-09-19 20:53:30 -06:00
parent 46e590d845
commit 69046e4261
4 changed files with 71 additions and 76 deletions
+2 -2
View File
@@ -90,7 +90,7 @@ Table of Contents
- **Movement:** Displays latest blockchain transactions that are greater than a certain configurable amount - **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 - **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 - **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 11 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 12 cryptocurrency exchanges are supported:
- [AltMarkets](https://altmarkets.io) - [AltMarkets](https://altmarkets.io)
- [Bittrex](https://bittrex.com) - [Bittrex](https://bittrex.com)
- [Bleutrade](https://bleutrade.com) - [Bleutrade](https://bleutrade.com)
@@ -986,4 +986,4 @@ Redistribution and use in source and binary forms, with or without modification,
* Neither the name of Iquidus Technology nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. * Neither the name of Iquidus Technology nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+53 -56
View File
@@ -1,77 +1,73 @@
var request = require('postman-request'); const request = require('postman-request');
var base_url = 'https://api.xeggex.com/api/v2'; const base_url = 'https://api.xeggex.com/api/v2';
const market_url_template = 'https://xeggex.com/market/{coin}_{base}'; const market_url_template = 'https://xeggex.com/market/{coin}_{base}';
function get_summary(coin, exchange, cb) { function get_summary(coin, exchange, cb) {
var req_url = base_url + '/market/getbysymbol/' + coin + '_' + exchange; const req_url = base_url + '/market/getbysymbol/' + coin + '_' + exchange;
request({uri: req_url, json: true}, function (error, response, body) { request({uri: req_url, json: true}, function (error, response, body) {
if (error) if (error)
return cb(error, null); return cb(error, null);
else if (body.error != null)
return cb(body.error.message, null);
else { else {
if (body.message) var retVal = {
return cb(body.message, null); 'high': body.highPriceNumber,
else { 'low': body.lowPriceNumber,
var retVal = { 'volume': body.volumeNumber,
'high': body.highPriceNumber, 'volume_btc': body.volumeUsdNumber,
'low': body.lowPriceNumber, 'bid': body.bestBidNumber,
'volume': body.volumeUsdNumber, 'ask': body.bestAskNumber,
'bid': body.bestBidNumber, 'last': body.lastPriceNumber,
'ask': body.bestAskNumber, 'prev': body.yesterdayPriceNumber,
'last': body.lastPriceNumber, 'change': body.changePercentNumber
'prev': body.yesterdayPriceNumber };
};
return cb (null, retVal); return cb(null, retVal);
}
} }
}).on('error', function(err) {
return cb(err, null);
}); });
} }
function formatTimestamp(unixTimestamp) {
const date = new Date(unixTimestamp * 1000); // Convert to milliseconds
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
const day = date.getUTCDate();
const month = months[date.getUTCMonth()];
const year = date.getUTCFullYear();
const hours = String(date.getUTCHours()).padStart(2, '0');
const minutes = String(date.getUTCMinutes()).padStart(2, '0');
const seconds = String(date.getUTCSeconds()).padStart(2, '0');
return `${month} ${day}, ${year} ${hours}:${minutes}:${seconds} UTC`;
}
function get_trades(coin, exchange, cb) { function get_trades(coin, exchange, cb) {
const req_url = base_url + '/historical_trades?ticker_id=' + coin + '_' + exchange + '&limit=300' ;
// Now proceed to the second API request request({uri: req_url, json: true}, function (error, response, body) {
var req_url = base_url + '/historical_trades?ticker_id=' + coin + '_' + exchange + '&limit=300' ; if (error)
return cb(error, null);
request({uri: req_url, json: true}, function (error, response, body) { else if (body.error != null)
if (error) return cb(error, null); return cb(body.error.message, null);
else {
var trades = []; var trades = [];
if (body.length > 0) { for (var i = 0; i < body.length; i++) {
for (var i = 0; i < body.length; i++) { var trade = {
var trade = { ordertype: body[i]['type'],
ordertype: body[i]['type'], price: parseFloat(body[i]['price']),
price: body[i]['price'], quantity: parseFloat(body[i]['base_volume']),
quantity: body[i]['base_volume'], timestamp: parseInt(new Date(body[i]['trade_timestamp']).getTime()/1000)
timestamp: formatTimestamp(parseInt(new Date(body[i]['trade_timestamp']).getTime()/1000)) };
};
trades.push(trade); trades.push(trade);
}
} }
return cb(null, trades); return cb(null, trades);
}); }
}).on('error', function(err) {
return cb(err, null);
});
} }
function get_orders(coin, exchange, cb) { function get_orders(coin, exchange, cb) {
var req_url = base_url + '/market/getorderbookbysymbol/' + coin + '_' + exchange const req_url = base_url + '/market/getorderbookbysymbol/' + coin + '_' + exchange
request({uri: req_url, json: true}, function (error, response, body) { request({uri: req_url, json: true}, function (error, response, body) {
if (body) { if (error)
return cb(error, [], []);
else if (body.error != null)
return cb(body.error.message, [], []);
else {
var orders = body; var orders = body;
var buys = []; var buys = [];
var sells = []; var sells = [];
@@ -80,7 +76,7 @@ function get_orders(coin, exchange, cb) {
for (var i = 0; i < orders['bids'].length; i++) { for (var i = 0; i < orders['bids'].length; i++) {
var order = { var order = {
price: orders.bids[i].numberprice, price: orders.bids[i].numberprice,
quantity: orders.bids[i].quantity quantity: parseFloat(orders.bids[i].quantity)
}; };
buys.push(order); buys.push(order);
@@ -91,7 +87,7 @@ function get_orders(coin, exchange, cb) {
for (var i = 0; i < orders['asks'].length; i++) { for (var i = 0; i < orders['asks'].length; i++) {
var order = { var order = {
price: orders.asks[i].numberprice, price: orders.asks[i].numberprice,
quantity: orders.asks[i].quantity quantity: parseFloat(orders.asks[i].quantity)
}; };
sells.push(order); sells.push(order);
@@ -99,14 +95,15 @@ function get_orders(coin, exchange, cb) {
} }
return cb(null, buys, sells); return cb(null, buys, sells);
} else }
return cb(body, [], []); }).on('error', function(err) {
return cb(err, null, null);
}); });
} }
module.exports = { module.exports = {
market_name: 'Xeggex', market_name: 'Xeggex',
market_logo: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF8WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDIgNzkuMTY0NDYwLCAyMDIwLzA1LzEyLTE2OjA0OjE3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3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j3/0OJ8l5US+DxQlYmtlpqxp2XjoEZBosSjkNVYA4I85BCxAcplk6jaYHlBxkyoI3iM54hWZWN+DBA40zK0cPghMAR4Iq9il4Ckj1b5LFyUdipf8Cba+9zaJkr9qMf7GT9HC1HxwVxuD2+DbwIHqX4uxBqpcug/SzEOxpFAbcDz9k1id/At3gdXn7zpxjdKXaHcDNC4hCR4aL83HZAbSeLSzL7R2aQLxrGFR1A9Hx35frm18y69NFYCuBc62z09Zmthwmw1aU9Aslzxspbqq0QFKydttR+qoYxI21J/at+dOPXpA31pZFEONfwAie3PFmXOIAAAAASUVORK5CYII=', market_logo: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAsVBMVEUAAABvY0FMTUHMoUJZV0FDSkFJTUG7l0KNd0GGcUF3akF8bEH4xEL4x0PzuUPzuUPgskPhukPetEPVs0LLpUK8n0KpjUGli0G4lkKagEJSU0H+zkPzv0PktUPWq0PeuELTqEPHnULYtEPSqkLar0LRqUPIokPKokO3lEK2k0K+m0K0kkKniEFmYEFlX0H/0kT/00P/6UT/1UP/40P/4EP/2UP/60T/5UP/xUP+xEP9xEOWOrtXAAAAL3RSTlMAKwjKGQ0Fk2BQRDz89/Hw69POxbWso52OaBX69+7kysjIw7+8u66soJ6Ig3kjHAzaxeEAAACkSURBVBjThc03gsIwFADRkRyxyRl2yTl+SbZJ9z8YhQsKCl431fBlaBoPMTHEIs+GiQiahdevOh3m1b7nJgH4poPvWrp3YSlXgIrtou4ebG0FAA4Wle8Y3SJKYaLyNiprf1Y1E/Inn17ZlHWWpiGl0+1MlCfc92Un2QbmVtEtL2OZ4feClozpGB/0tPAG/5nWrjZYFM2Ao6u/xIwgNvKouyE/vQGJsQ9k11uR2AAAAABJRU5ErkJggg==',
market_url_template: market_url_template, market_url_template: market_url_template,
market_url_case: 'u', market_url_case: 'u',
get_data: function(settings, cb) { get_data: function(settings, cb) {
@@ -122,4 +119,4 @@ module.exports = {
}); });
}); });
} }
}; };
+13 -14
View File
@@ -917,6 +917,18 @@ exports.markets_page = {
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH" // Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": [ "LTC/BTC" ] "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": {
// enabled: Enable/disable the xeggex exchange (true/false)
// If set to false, the xeggex 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/USDT" ]
},
// yobit: a collection of settings that pertain to the yobit exchange // yobit: a collection of settings that pertain to the yobit exchange
// NOTE: yobit does not display a 24-hour chart due to a lack of OHLCV api data // NOTE: yobit does not display a 24-hour chart due to a lack of OHLCV api data
"yobit": { "yobit": {
@@ -929,19 +941,6 @@ exports.markets_page = {
// Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH" // Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": [ "LTC/BTC" ] "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": {
// enabled: Enable/disable the xeggex exchange (true/false)
// If set to false, the xeggex 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/USDT"
}
}, },
// default_exchange: a collection of settings that pertain to the default exchange // default_exchange: a collection of settings that pertain to the default exchange
// When the "show_market_dropdown_menu" setting is disabled, the market header menu will navigate directly to the default exchange page // When the "show_market_dropdown_menu" setting is disabled, the market header menu will navigate directly to the default exchange page
@@ -2062,4 +2061,4 @@ Object.byString = function(o, s) {
} }
// populate settings // populate settings
exports.loadSettings(); exports.loadSettings();
+3 -4
View File
@@ -1011,9 +1011,8 @@
// You can add as many trading pairs as necessary // 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 // 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" // Ex: "LTC/BTC", "LTC/USDT", "LTC/ETH"
"trading_pairs": "LTC/USDT" "trading_pairs": [ "LTC/USDT" ]
} },
},
// yobit: a collection of settings that pertain to the yobit exchange // yobit: a collection of settings that pertain to the yobit exchange
// NOTE: yobit does not display a 24-hour chart due to a lack of OHLCV api data // NOTE: yobit does not display a 24-hour chart due to a lack of OHLCV api data
"yobit": { "yobit": {
@@ -1599,4 +1598,4 @@
"enabled": false "enabled": false
} }
} }
} }