WIP -- running with BTC only
This commit is contained in:
parent
f03151d670
commit
d6ec60db55
3 changed files with 20 additions and 9 deletions
|
|
@ -119,6 +119,8 @@ function loadOrConfigPlugin (pluginHandle, pluginType, cryptoCode, currency,
|
|||
? cachedConfig.exchanges.plugins.current[pluginType]
|
||||
: cachedConfig.exchanges.plugins.current[cryptoCode][pluginType]
|
||||
|
||||
currentlyUsedPlugins[cryptoCode] = currentlyUsedPlugins[cryptoCode] || {}
|
||||
|
||||
var pluginChanged = currentlyUsedPlugins[cryptoCode][pluginType] !== currentName
|
||||
|
||||
if (!currentName) pluginHandle = null
|
||||
|
|
@ -149,7 +151,7 @@ exports.configure = function configure (config) {
|
|||
|
||||
cachedConfig = config
|
||||
deviceCurrency = config.exchanges.settings.currency
|
||||
cryptoCodes = config.exchanges.settings.coins || 'BTC'
|
||||
cryptoCodes = config.exchanges.settings.coins || ['BTC']
|
||||
|
||||
cryptoCodes.forEach(function (cryptoCode) {
|
||||
// TICKER [required] configure (or load)
|
||||
|
|
@ -448,8 +450,8 @@ function pollBalance (cryptoCode, cb) {
|
|||
}
|
||||
|
||||
function pollRate (cryptoCode, cb) {
|
||||
logger.debug('[%s] polling for rates (%s)', cryptoCode, tickerPlugin.NAME)
|
||||
var tickerPlugin = tickerPlugins[cryptoCode]
|
||||
logger.debug('[%s] polling for rates (%s)', cryptoCode, tickerPlugin.NAME)
|
||||
|
||||
var currencies = deviceCurrency
|
||||
if (typeof currencies === 'string') currencies = [currencies]
|
||||
|
|
@ -464,8 +466,14 @@ function pollRate (cryptoCode, cb) {
|
|||
return cb && cb(err)
|
||||
}
|
||||
|
||||
logger.debug('got rates: %j', resRates)
|
||||
resRates.timestamp = new Date()
|
||||
var rates = resRates[deviceCurrency].rates
|
||||
if (rates) {
|
||||
rates.ask = rates.ask && new BigNumber(rates.ask)
|
||||
rates.bid = rates.bid && new BigNumber(rates.bid)
|
||||
}
|
||||
logger.debug('got rates: %j', resRates)
|
||||
|
||||
lastRates[cryptoCode] = resRates
|
||||
|
||||
return cb && cb(null, lastRates)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue