zj
2025-04-04 8ceb6cd5ba9d7f347f2070a3967f31cc070ef4ef
src/main/java/project/contract/internal/ContractOrderServiceImpl.java
@@ -461,6 +461,7 @@
   public Map<String, Object> bulidOne(ContractOrder order) {
      SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd  hh:mm:ss  a", Locale.ENGLISH);
      simpleDateFormat.setTimeZone(TimeZone.getTimeZone("America/New_York"));
      DecimalFormat df = new DecimalFormat("#.##");
      Map<String, Object> map = new HashMap<String, Object>();
      map.put("order_no", order.getOrder_no());
@@ -500,7 +501,21 @@
      } else {
         map.put("profit", df.format(Arith.sub(Arith.add(order.getAmount_close(), order.getDeposit()), order.getDeposit_open())));
      }
      double currentPrice = Double.parseDouble(map.get("trade_avg_price").toString());
      double leve = Double.parseDouble(map.get("lever_rate").toString());
      //得到强平价格
      if(null != map.get("direction")){
         double liquidationPrice;
         if(map.get("direction").equals("sell")){
            liquidationPrice = currentPrice * (1 + (1 / leve));
         }else{
            liquidationPrice = currentPrice * (1 - 1 / leve);
         }
         DecimalFormat dfs = new DecimalFormat("#.#####");
         String formattedPrice = dfs.format(liquidationPrice);
         map.put("qiangPing",formattedPrice);
      }
      map.put("volume", order.getVolume());
      map.put("volume_open", order.getVolume_open());