Refactored some exchange code
This commit is contained in:
parent
54a231ab60
commit
134eaaa518
20 changed files with 141 additions and 643 deletions
|
|
@ -1,8 +1,7 @@
|
|||
const mem = require('mem')
|
||||
const configManager = require('./new-config-manager')
|
||||
const ph = require('./plugin-helper')
|
||||
const logger = require('./logger')
|
||||
|
||||
const ccxt = require('./plugins/ticker/ccxt')
|
||||
const lastRate = {}
|
||||
|
||||
const FETCH_INTERVAL = 60000
|
||||
|
|
@ -11,14 +10,10 @@ function _getRates (settings, fiatCode, cryptoCode) {
|
|||
return Promise.resolve()
|
||||
.then(() => {
|
||||
const config = settings.config
|
||||
const plugin = configManager.getWalletSettings(cryptoCode, config).ticker
|
||||
|
||||
const account = settings.accounts[plugin]
|
||||
const ticker = ph.load(ph.TICKER, plugin)
|
||||
|
||||
const exchangeName = configManager.getWalletSettings(cryptoCode, config).ticker
|
||||
const market = [cryptoCode, fiatCode].join('-')
|
||||
|
||||
return ticker.ticker(account, fiatCode, cryptoCode)
|
||||
return ccxt.ticker(exchangeName, fiatCode, cryptoCode)
|
||||
.then(r => ({
|
||||
rates: r.rates,
|
||||
timestamp: Date.now()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue