Skip to content

Commit

Permalink
feat: add Exolo exchange driver
Browse files Browse the repository at this point in the history
  • Loading branch information
wouthoekstra committed Mar 22, 2024
1 parent 87ad1e4 commit f6a4d13
Show file tree
Hide file tree
Showing 3 changed files with 424 additions and 0 deletions.
33 changes: 33 additions & 0 deletions drivers/exolo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const Driver = require('../models/driver');
const request = require('../lib/request');
const Ticker = require('../models/ticker');
const { parseToFloat } = require('../lib/utils');

/**
* @memberof Driver
* @augments Driver
*/
class Exolo extends Driver {
/**
* @augments Driver.fetchTickers
* @returns {Promise.Array<Ticker>} Returns a promise of an array with tickers.
*/
async fetchTickers() {
const markets = await request('https://openapi.exolo.org/open/v2/pub/ticker');

return Object.keys(markets).map((market) => {
const ticker = markets[market];
const [base, quote] = market.split('_');

return new Ticker({
base,
quote,
close: parseToFloat(ticker.last_price),
baseVolume: parseToFloat(ticker['24_base_volume']),
quoteVolume: parseToFloat(ticker['24_quote_volume']),
});
});
}
}

module.exports = Exolo;
1 change: 1 addition & 0 deletions drivers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ exports.Exenium = require('./exenium');
exports.Exmarkets = require('./exmarkets');
exports.Exmo = require('./exmo');
exports.Exnce = require('./exnce');
exports.Exolo = require('./exolo');
exports.Extstock = require('./extstock');
exports.Exx = require('./exx');
exports.Fameex = require('./fameex');
Expand Down
Loading

0 comments on commit f6a4d13

Please sign in to comment.