From aadd82388acb41990cb7a217a305848499ddb9e5 Mon Sep 17 00:00:00 2001 From: luzhaofeng <574317128@qq.com> Date: Fri, 22 Nov 2019 14:09:52 +0800 Subject: [PATCH] =?UTF-8?q?K=E7=BA=BF=E6=9C=BA=E5=99=A8=E4=BA=BA-=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=9B=98=E5=8F=A3=E6=95=B0=E9=87=8F=E5=87=BA=E7=8E=B0?= =?UTF-8?q?0=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../databot/schedule/KMarketScheduling.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) 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(); } /***