Removing Current

This commit is contained in:
Luis Fernando Molina committed 2020-11-20 14:17:04 +01:00
1 parent d6c5e91290
commit a4ed878fcd
4379 files changed

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
'use strict'
// ----------------------------------------------------------------------------
const log = require ('ololog')
, ansi = require ('ansicolor').nice
, chai = require ('chai')
, expect = chai.expect
, assert = chai.assert
, testOrderBook = require ('./test.orderbook.js')
/* ------------------------------------------------------------------------ */
module.exports = async (exchange) => {
const randomSymbols = exchange.symbols.slice ().sort (() => 0.5 - Math.random ()).slice (0, 2)
const customExchangeParams = ([
'yobit',
'tidex',
'ccex',
'liqui',
]).reduce ((params, id) => ({ ...params, [id]: [randomSymbols], }), {})
const args = (exchange.id in customExchangeParams) ? customExchangeParams[exchange.id] : []
const method = 'fetchOrderBooks'
if (exchange.has[method]) {
// log ('fetching order books...')
let orderbooks = await exchange[method] (...args)
// log.green (orderbooks)
Object.entries (orderbooks).forEach (([symbol, orderbook]) => {
testOrderBook (exchange, orderbook, method, symbol)
})
// return orderbooks
} else {
log (method + '() not supported')
}
}