diff --git a/blockchain-server/blockchain-server-databot/src/main/java/com/blockchain/server/databot/schedule/KMarketScheduling.java b/blockchain-server/blockchain-server-databot/src/main/java/com/blockchain/server/databot/schedule/KMarketScheduling.java index 5415067..09ff3a1 100644 --- a/blockchain-server/blockchain-server-databot/src/main/java/com/blockchain/server/databot/schedule/KMarketScheduling.java +++ b/blockchain-server/blockchain-server-databot/src/main/java/com/blockchain/server/databot/schedule/KMarketScheduling.java @@ -270,7 +270,7 @@ public class KMarketScheduling { continue; } else { //新创盘口数量 - float newAmount = avgAmount * random.nextInt(100) / 50; + float newAmount = avgAmount * (random.nextInt(100) + 1) / 50; //减去发行总数量 totalAmount -= newAmount; @@ -333,7 +333,7 @@ public class KMarketScheduling { //格式化数据 float unitPrice = formatValue(depthPrice); //新创盘口数量 - float newAmount = avgAmount * random.nextInt(100) / 50; + float newAmount = avgAmount * (random.nextInt(100) + 1) / 50; //减去发行总数量 totalAmount -= newAmount; //判断是否存在相同单价 @@ -558,15 +558,16 @@ public class KMarketScheduling { * @return */ private static float formatValue(float value) { - if (value < 0.001) { - return BigDecimal.valueOf(value).setScale(8, BigDecimal.ROUND_HALF_DOWN).floatValue(); - } else if (value < 0.1) { - return BigDecimal.valueOf(value).setScale(6, BigDecimal.ROUND_HALF_DOWN).floatValue(); - } else if (value < 10) { - return BigDecimal.valueOf(value).setScale(4, BigDecimal.ROUND_HALF_DOWN).floatValue(); - } else { - return BigDecimal.valueOf(value).setScale(2, BigDecimal.ROUND_HALF_DOWN).floatValue(); - } +// if (value < 0.001) { +// return BigDecimal.valueOf(value).setScale(8, BigDecimal.ROUND_HALF_DOWN).floatValue(); +// } else if (value < 0.1) { +// return BigDecimal.valueOf(value).setScale(6, BigDecimal.ROUND_HALF_DOWN).floatValue(); +// } else if (value < 10) { +// return BigDecimal.valueOf(value).setScale(4, BigDecimal.ROUND_HALF_DOWN).floatValue(); +// } else { +// return BigDecimal.valueOf(value).setScale(2, BigDecimal.ROUND_HALF_DOWN).floatValue(); +// } + return BigDecimal.valueOf(value).setScale(8, BigDecimal.ROUND_HALF_DOWN).floatValue(); } /***