From 182ad875e97b6d3a875a08bae49f5f21908bb7f3 Mon Sep 17 00:00:00 2001 From: joeuhren <46763106+joeuhren@users.noreply.github.com> Date: Sun, 24 Jan 2021 15:56:45 -0700 Subject: [PATCH] Fix last market price -The last market price was not properly checking against trading pairs and was updating based on all pairs for the default exchange which could potentially cause non-BTC markets to show a much higher last price value than normal --- lib/database.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/database.js b/lib/database.js index 43a88f8..33372d7 100644 --- a/lib/database.js +++ b/lib/database.js @@ -779,8 +779,8 @@ module.exports = { history: obj.trades, summary: obj.stats }, function() { - // check if this is the default market - if (market == settings.markets_page.default_exchange.exchange_name) { + // check if this is the default market and trading pair and that the price is recorded in BTC + if (market == settings.markets_page.default_exchange.exchange_name && settings.markets_page.default_exchange.trading_pair.toUpperCase() == coin_symbol.toUpperCase() + '/' + pair_symbol.toUpperCase() && pair_symbol.toUpperCase() == 'BTC') { // this is the default market so update the last price stats Stats.updateOne({coin: settings.coin.name}, { last_price: obj.stats.last,