diff --git a/lib/plugins/ticker/ccxt.js b/lib/plugins/ticker/ccxt.js index 6c495a1c..09d8dbd7 100644 --- a/lib/plugins/ticker/ccxt.js +++ b/lib/plugins/ticker/ccxt.js @@ -6,8 +6,13 @@ const { getRate } = require('../../../lib/forex') const RETRIES = 2 +const tickerObjects = {} + function ticker (fiatCode, cryptoCode, tickerName) { - const ticker = new ccxt[tickerName]({ timeout: 3000 }) + const ticker = tickerObjects[tickerName] ? + tickerObjects[tickerName] : + tickerObjects[tickerName] = new ccxt[tickerName]({ timeout: 3000 }) + if (verifyFiatSupport(fiatCode, tickerName)) { return getCurrencyRates(ticker, fiatCode, cryptoCode) }