mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-24 14:50:28 -04:00
show total volume when prices are available
This commit is contained in:
parent
6151e9309a
commit
4e89a2f283
3 changed files with 13 additions and 4 deletions
|
@ -407,7 +407,7 @@ shared.notSigned.noNeedAlts=Cryptocurrency accounts do not feature signing or ag
|
|||
|
||||
offerbook.nrOffers=No. of offers: {0}
|
||||
offerbook.volume={0} (min - max)
|
||||
offerbook.volumeTotal={0} ({1})
|
||||
offerbook.volumeTotal={0} {1}
|
||||
offerbook.deposit=Deposit XMR (%)
|
||||
offerbook.deposit.help=Deposit paid by each trader to guarantee the trade. Will be returned when the trade is completed.
|
||||
offerbook.XMRTotal=XMR ({0})
|
||||
|
|
|
@ -26,6 +26,7 @@ import haveno.common.util.Tuple3;
|
|||
import haveno.common.util.Tuple4;
|
||||
import haveno.core.locale.CurrencyUtil;
|
||||
import haveno.core.locale.Res;
|
||||
import haveno.core.monetary.Volume;
|
||||
import haveno.core.offer.Offer;
|
||||
import haveno.core.offer.OfferDirection;
|
||||
import haveno.core.util.FormattingUtils;
|
||||
|
@ -354,9 +355,11 @@ public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookC
|
|||
}
|
||||
|
||||
private synchronized void updateChartData() {
|
||||
volumeSellColumnLabel.set(Res.get("offerbook.volumeTotal", model.getCurrencyCode(), VolumeUtil.formatVolume(model.getTotalVolume(model.isCrypto() ? OfferDirection.BUY : OfferDirection.SELL))));
|
||||
Volume volumeSell = model.getTotalVolume(model.isCrypto() ? OfferDirection.BUY : OfferDirection.SELL);
|
||||
Volume volumeBuy = model.getTotalVolume(model.isCrypto() ? OfferDirection.SELL : OfferDirection.BUY);;
|
||||
volumeSellColumnLabel.set(Res.get("offerbook.volumeTotal", model.getCurrencyCode(), volumeSell == null ? "" : "(" + VolumeUtil.formatVolume(volumeSell) + ")"));
|
||||
amountSellColumnLabel.set(Res.get("offerbook.XMRTotal", "" + model.getTotalAmount(model.isCrypto() ? OfferDirection.BUY : OfferDirection.SELL)));
|
||||
volumeBuyColumnLabel.set(Res.get("offerbook.volumeTotal", model.getCurrencyCode(), VolumeUtil.formatVolume(model.getTotalVolume(model.isCrypto() ? OfferDirection.SELL : OfferDirection.BUY))));
|
||||
volumeBuyColumnLabel.set(Res.get("offerbook.volumeTotal", model.getCurrencyCode(), volumeBuy == null ? "" : "(" + VolumeUtil.formatVolume(volumeBuy) + ")"));
|
||||
amountBuyColumnLabel.set(Res.get("offerbook.XMRTotal", "" + model.getTotalAmount(model.isCrypto() ? OfferDirection.SELL : OfferDirection.BUY)));
|
||||
|
||||
seriesSell.getData().clear();
|
||||
|
|
|
@ -238,7 +238,13 @@ class OfferBookChartViewModel extends ActivatableViewModel {
|
|||
&& e.getDirection().equals(direction))
|
||||
.map(Offer::getVolume)
|
||||
.collect(Collectors.toList());
|
||||
return VolumeUtil.sum(volumes);
|
||||
try {
|
||||
return VolumeUtil.sum(volumes);
|
||||
} catch (Exception e) {
|
||||
// log.error("Cannot compute total volume because prices are unavailable, currency={}, direction={}",
|
||||
// selectedTradeCurrencyProperty.get().getCode(), direction);
|
||||
return null; // expected before prices are available
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue