Merge pull request #34 from sudormdir/master

Add Xeggex exchange to markets
This commit is contained in:
Joe Uhren
2023-09-19 20:59:50 -06:00
committed by GitHub
4 changed files with 150 additions and 3 deletions
+2 -1
View File
@@ -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 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)
- [Bittrex](https://bittrex.com)
- [Bleutrade](https://bleutrade.com)
@@ -101,6 +101,7 @@ Table of Contents
- [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:
- **RPC API calls** (Return data from coind)
+122
View File
@@ -0,0 +1,122 @@
const request = require('postman-request');
const base_url = 'https://api.xeggex.com/api/v2';
const market_url_template = 'https://xeggex.com/market/{coin}_{base}';
function get_summary(coin, exchange, cb) {
const req_url = base_url + '/market/getbysymbol/' + 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.message, null);
else {
var retVal = {
'high': body.highPriceNumber,
'low': body.lowPriceNumber,
'volume': body.volumeNumber,
'volume_btc': body.volumeUsdNumber,
'bid': body.bestBidNumber,
'ask': body.bestAskNumber,
'last': body.lastPriceNumber,
'prev': body.yesterdayPriceNumber,
'change': body.changePercentNumber
};
return cb(null, retVal);
}
}).on('error', function(err) {
return cb(err, null);
});
}
function get_trades(coin, exchange, cb) {
const req_url = base_url + '/historical_trades?ticker_id=' + coin + '_' + exchange + '&limit=300' ;
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.message, null);
else {
var trades = [];
for (var i = 0; i < body.length; i++) {
var trade = {
ordertype: body[i]['type'],
price: parseFloat(body[i]['price']),
quantity: parseFloat(body[i]['base_volume']),
timestamp: parseInt(new Date(body[i]['trade_timestamp']).getTime()/1000)
};
trades.push(trade);
}
return cb(null, trades);
}
}).on('error', function(err) {
return cb(err, null);
});
}
function get_orders(coin, exchange, cb) {
const req_url = base_url + '/market/getorderbookbysymbol/' + 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.message, [], []);
else {
var orders = body;
var buys = [];
var sells = [];
if (orders['bids'].length > 0) {
for (var i = 0; i < orders['bids'].length; i++) {
var order = {
price: orders.bids[i].numberprice,
quantity: parseFloat(orders.bids[i].quantity)
};
buys.push(order);
}
}
if (orders['asks'].length > 0) {
for (var i = 0; i < orders['asks'].length; i++) {
var order = {
price: orders.asks[i].numberprice,
quantity: parseFloat(orders.asks[i].quantity)
};
sells.push(order);
}
}
return cb(null, buys, sells);
}
}).on('error', function(err) {
return cb(err, null, null);
});
}
module.exports = {
market_name: 'Xeggex',
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_case: 'u',
get_data: function(settings, cb) {
var error = null;
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, trades: trades, stats: stats});
});
});
});
}
};
+13 -1
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, yobit
// Supported exchanges: altmarkets, bittrex, bleutrade, crex, dex-trade, freiexchange/freixlite, poloniex, southxchange, txbit, unnamed, xeggex, yobit
"exchanges": {
// altmarkets: a collection of settings that pertain to the altmarkets exchange
"altmarkets": {
@@ -917,6 +917,18 @@ exports.markets_page = {
// 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": {
// 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
// NOTE: yobit does not display a 24-hour chart due to a lack of OHLCV api data
"yobit": {
+13 -1
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, yobit
// Supported exchanges: altmarkets, bittrex, bleutrade, crex, dex-trade, freiexchange/freixlite, poloniex, southxchange, txbit, unnamed, xeggex, yobit
"exchanges": {
// altmarkets: a collection of settings that pertain to the altmarkets exchange
"altmarkets": {
@@ -1001,6 +1001,18 @@
// 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": {
// 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
// NOTE: yobit does not display a 24-hour chart due to a lack of OHLCV api data
"yobit": {