Use always precision 8 for json dumped data

This commit is contained in:
Manfred Karrer 2016-08-26 12:02:41 +02:00
parent f1996c6e8a
commit 216b4f44e8
3 changed files with 10 additions and 10 deletions

View file

@ -99,8 +99,8 @@ public class OfferForJson {
primaryMarketVolumeDisplayString = coinFormat.noCode().format(getAmountAsCoin()).toString();
primaryMarketPrice = MathUtils.roundDoubleToLong(MathUtils.scaleUpByPowerOf10(value, 8));
primaryMarketMinAmount = getMinVolumeAsFiat().longValue();
primaryMarketAmount = getVolumeAsFiat().longValue();
primaryMarketMinAmount = (long) MathUtils.scaleUpByPowerOf10(getMinVolumeAsFiat().longValue(), 4);
primaryMarketAmount = (long) MathUtils.scaleUpByPowerOf10(getVolumeAsFiat().longValue(), 4);
primaryMarketMinVolume = getMinAmountAsCoin().longValue();
primaryMarketVolume = getAmountAsCoin().longValue();
@ -113,11 +113,11 @@ public class OfferForJson {
primaryMarketMinVolumeDisplayString = fiatFormat.noCode().format(getMinVolumeAsFiat()).toString();
primaryMarketVolumeDisplayString = fiatFormat.noCode().format(getVolumeAsFiat()).toString();
primaryMarketPrice = priceAsFiat.longValue();
primaryMarketPrice = (long) MathUtils.scaleUpByPowerOf10(priceAsFiat.longValue(), 4);
primaryMarketMinAmount = getMinAmountAsCoin().longValue();
primaryMarketAmount = getAmountAsCoin().longValue();
primaryMarketMinVolume = getMinVolumeAsFiat().longValue();
primaryMarketVolume = getVolumeAsFiat().longValue();
primaryMarketMinVolume = (long) MathUtils.scaleUpByPowerOf10(getMinVolumeAsFiat().longValue(), 4);
primaryMarketVolume = (long) MathUtils.scaleUpByPowerOf10(getVolumeAsFiat().longValue(), 4);
}
} catch (Throwable t) {

View file

@ -75,19 +75,19 @@ public final class TradeStatisticsForJson {
primaryMarketTradeVolumeDisplayString = coinFormat.noCode().format(getTradeAmount()).toString();
primaryMarketTradeAmountDisplayString = fiatFormat.noCode().format(getTradeVolume()).toString();
primaryMarketTradeAmount = getTradeVolume().longValue();
primaryMarketTradeAmount = (long) MathUtils.scaleUpByPowerOf10(getTradeVolume().longValue(), 4);
primaryMarketTradeVolume = getTradeAmount().longValue();
} else {
currencyPair = "BTC/" + currency;
tradePriceDisplayString = fiatFormat.noCode().format(tradePriceAsFiat).toString();
primaryMarketTradePrice = tradePriceAsFiat.longValue();
primaryMarketTradePrice = (long) MathUtils.scaleUpByPowerOf10(tradePriceAsFiat.longValue(), 4);
primaryMarketTradeAmountDisplayString = coinFormat.noCode().format(getTradeAmount()).toString();
primaryMarketTradeVolumeDisplayString = fiatFormat.noCode().format(getTradeVolume()).toString();
primaryMarketTradeAmount = getTradeAmount().longValue();
primaryMarketTradeVolume = getTradeVolume().longValue();
primaryMarketTradeVolume = (long) MathUtils.scaleUpByPowerOf10(getTradeVolume().longValue(), 4);
}
} catch (Throwable t) {
log.error("Error at setDisplayStrings: " + t.getMessage());

View file

@ -61,9 +61,9 @@ public class TradeStatisticsManager {
this.cryptoCurrencyListJsonStorage.initWithFileName("crypto_currency_list.json");
ArrayList<CurrencyTuple> cryptoCurrencyList = new ArrayList<>(CurrencyUtil.getAllSortedCryptoCurrencies().stream()
.map(e -> new CurrencyTuple(e.getCode(), e.getName()))
.map(e -> new CurrencyTuple(e.getCode(), e.getName(), 8))
.collect(Collectors.toList()));
cryptoCurrencyList.add(0, new CurrencyTuple("BTC", "Bitcoin"));
cryptoCurrencyList.add(0, new CurrencyTuple("BTC", "Bitcoin", 8));
cryptoCurrencyListJsonStorage.queueUpForSave(new PlainTextWrapper(Utilities.objectToJson(cryptoCurrencyList)), 2000);
}