新版仿ok交易所-后端
1
zj
2025-10-30 14c1946eae86a86f8d1edee6cf3bdaf7572fc966
trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiContractApplyOrderController.java
@@ -422,14 +422,14 @@
        map.put("price", order.getPrice());
        map.put("stop_price_profit", order.getStopPriceProfit());
        if( order.getStopPriceLoss() !=null) {
            map.put("stop_price_loss", order.getStopPriceLoss().setScale(4, RoundingMode.HALF_UP));
            map.put("stop_price_loss", order.getStopPriceLoss().setScale(4, RoundingMode.DOWN));
        }else{
            map.put("stop_price_loss", null);
        }
        map.put("price_type", order.getOrderPriceType());
        map.put("state", order.getState());
        map.put("amount", order.getVolume().multiply(order.getUnitAmount()).setScale(4, RoundingMode.HALF_UP));
        map.put("amount", order.getVolume().multiply(order.getUnitAmount()).setScale(4, RoundingMode.DOWN));
        map.put("amount_open", order.getVolumeOpen().multiply(order.getUnitAmount()));
        map.put("fee", order.getFee());
        map.put("deposit", order.getDeposit());
@@ -606,9 +606,9 @@
            Realtime realtime = realtimeMap.get(data.getSymbol());
            BigDecimal mark_price = realtime.getClose();
            if(data.getDirection().equalsIgnoreCase("buy")){
                expectedProfitAndLoss += data.getVolume().multiply(data.getLeverRate()).multiply(data.getUnitAmount()).multiply(mark_price.subtract(data.getPrice()).divide(data.getPrice(), 4, RoundingMode.HALF_UP)).doubleValue();
                expectedProfitAndLoss += data.getVolume().multiply(data.getLeverRate()).multiply(data.getUnitAmount()).multiply(mark_price.subtract(data.getPrice()).divide(data.getPrice(), 4, RoundingMode.DOWN)).doubleValue();
            }else{
                expectedProfitAndLoss -= data.getVolume().multiply(data.getLeverRate()).multiply(data.getUnitAmount()).multiply(mark_price.subtract(data.getPrice()).divide(data.getPrice(), 4, RoundingMode.HALF_UP)).doubleValue();
                expectedProfitAndLoss -= data.getVolume().multiply(data.getLeverRate()).multiply(data.getUnitAmount()).multiply(mark_price.subtract(data.getPrice()).divide(data.getPrice(), 4, RoundingMode.DOWN)).doubleValue();
            }
            //手续费
            double fee = Double.parseDouble(data.getFee().toString());