Skip to content

Commit

Permalink
feat: add deepcoin exchange driver
Browse files Browse the repository at this point in the history
  • Loading branch information
wouthoekstra committed Oct 31, 2023
1 parent c3ca1c8 commit 4a88945
Show file tree
Hide file tree
Showing 3 changed files with 3,101 additions and 0 deletions.
37 changes: 37 additions & 0 deletions drivers/deepcoin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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 Deepcoin extends Driver {
/**
* @augments Driver.fetchTickers
* @returns {Promise.Array<Ticker>} Returns a promise of an array with tickers.
*/
async fetchTickers() {
const { data: tickers } = await request('https://api.deepcoin.com/deepcoin/cmc/spotquery');

return tickers
.map((ticker) => {
const [base, quote] = ticker.InstrumentID.split('/');

return new Ticker({
base,
quote,
baseVolume: parseToFloat(ticker.Volume),
open: parseToFloat(ticker.OpenPrice),
high: parseToFloat(ticker.HighestPrice),
low: parseToFloat(ticker.LowestPrice),
close: parseToFloat(ticker.LastPrice),
ask: parseToFloat(ticker.AskPrice1),
bid: parseToFloat(ticker.BidPrice1),
});
});
}
}

module.exports = Deepcoin;
1 change: 1 addition & 0 deletions drivers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ exports.Cryptonex = require('./cryptonex');
exports.Currency = require('./currency');
exports.Curve = require('./curve');
exports.Dcoin = require('./dcoin');
exports.Deepcoin = require('./deepcoin');
exports.Dextrade = require('./dextrade');
exports.Dexzbitz = require('./dexzbitz');
exports.Difx = require('./difx');
Expand Down
Loading

0 comments on commit 4a88945

Please sign in to comment.