| 1358 | } |
| 1359 | |
| 1360 | public static String getBsqInUsd(Price bsqPrice, |
| 1361 | Coin bsqAmount, |
| 1362 | PriceFeedService priceFeedService, |
| 1363 | BsqFormatter bsqFormatter) { |
| 1364 | MarketPrice usdMarketPrice = priceFeedService.getMarketPrice("USD"); |
| 1365 | if (usdMarketPrice == null) { |
| 1366 | return Res.get("shared.na"); |
| 1367 | } |
| 1368 | long usdMarketPriceAsLong = MathUtils.roundDoubleToLong(MathUtils.scaleUpByPowerOf10(usdMarketPrice.getPrice(), |
| 1369 | Fiat.SMALLEST_UNIT_EXPONENT)); |
| 1370 | Price usdPrice = Price.valueOf("USD", usdMarketPriceAsLong); |
| 1371 | String bsqAmountAsString = bsqFormatter.formatCoin(bsqAmount); |
| 1372 | Volume bsqAmountAsVolume = Volume.parse(bsqAmountAsString, "BSQ"); |
| 1373 | Coin requiredBtc = bsqPrice.getAmountByVolume(bsqAmountAsVolume); |
| 1374 | Volume volumeByAmount = usdPrice.getVolumeByAmount(requiredBtc); |
| 1375 | return VolumeUtil.formatAverageVolumeWithCode(volumeByAmount); |
| 1376 | } |
| 1377 | |
| 1378 | public static MaterialDesignIcon getIconForSignState(AccountAgeWitnessService.SignState state) { |
| 1379 | if (state.equals(AccountAgeWitnessService.SignState.PEER_INITIAL)) { |