Skip to content

Commit

Permalink
Fix last market price
Browse files Browse the repository at this point in the history
-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
  • Loading branch information
joeuhren committed Jan 24, 2021
1 parent d35b0ec commit 182ad87
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 182ad87

Please sign in to comment.