Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
round the wallet balance
Browse files Browse the repository at this point in the history
To avoid currency exchange “jitter”.

Partially address #6707
  • Loading branch information
mrose17 authored and bsclifton committed Jan 20, 2017
1 parent 51f8d0f commit 187fa9a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/about/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,14 @@ class PaymentsTab extends ImmutableComponent {
}
if (this.props.ledgerData.get('btc') && typeof this.props.ledgerData.get('amount') === 'number') {
const btcValue = this.props.ledgerData.get('btc') / this.props.ledgerData.get('amount')
return `${(balance / btcValue).toFixed(2)} ${currency}`
const fiatValue = (balance / btcValue).toFixed(2)
let roundedValue = Math.floor(fiatValue)
const diff = fiatValue - roundedValue

if (diff > 0.74) roundedValue += 0.75
else if (diff > 0.49) roundedValue += 0.50
else if (diff > 0.24) roundedValue += 0.25
return `${roundedValue.toFixed(2)} ${currency}`
}
return `${balance} BTC`
}
Expand Down

0 comments on commit 187fa9a

Please sign in to comment.