tujidelv 1 年間 前
コミット
ccae98b380
1 ファイル変更30 行追加21 行削除
  1. 30 21
      src/main/java/top/lvzhiqiang/service/impl/CoinServiceImpl.java

+ 30 - 21
src/main/java/top/lvzhiqiang/service/impl/CoinServiceImpl.java

@@ -342,6 +342,8 @@ public class CoinServiceImpl implements CoinService {
             e.setMaxCallbackRate(columnMap.get("Max drawdown"));
             e.setLast3wWinRate(columnMap.get("Last 3W win rate"));
             e.setAverageWinRate(StringUtils.isNotEmpty(e.getAverageWinRate()) ? new BigDecimal(e.getAverageWinRate()).setScale(2, RoundingMode.HALF_UP).toPlainString() : "0.00");
+
+            e.setTraderNickName(StringUtils.isNotEmpty(e.getTraderNickName()) ? e.getTraderNickName() : "--");
         });
 
         return mixTraderList;
@@ -476,6 +478,9 @@ public class CoinServiceImpl implements CoinService {
             try {
                 JSONObject response = requestApi4Common("/api/mix/v1/order/historyProductType", signQueryString, null, JsoupUtil.HTTP_GET, paramMap);
                 JSONArray orderList = response.getJSONObject("data").getJSONArray("orderList");
+                if (null == orderList) {
+                    return;
+                }
 
                 for (int i = 0; i < orderList.size(); i++) {
                     JSONObject order = orderList.getJSONObject(i);
@@ -501,6 +506,7 @@ public class CoinServiceImpl implements CoinService {
                     }
                 }
             } catch (Exception e) {
+                log.error("bitget-mix-order error", e);
             }
         }, 0, 2, TimeUnit.SECONDS);
 
@@ -631,7 +637,7 @@ public class CoinServiceImpl implements CoinService {
                     }
                 }
             } catch (Exception e) {
-                e.printStackTrace();
+                log.error("bitget-mix-returnrate error", e);
             }
         }, 0, 5, TimeUnit.SECONDS);
 
@@ -657,29 +663,32 @@ public class CoinServiceImpl implements CoinService {
                     JSONObject response = requestApi4Common("/api/mix/v1/trace/report/order/currentList", null, JSONObject.toJSONString(paramMap), JsoupUtil.HTTP_POST, paramMap);
                     JSONArray orderList = response.getJSONArray("data");
 
-                    for (int i = 0; i < orderList.size(); i++) {
-                        JSONObject order = orderList.getJSONObject(i);
-                        LocalDateTime openTime = DateUtils.longToLocalDateTime(order.getLong("openTime"));
-                        String trackingNo = order.getString("trackingNo");
-                        if (Duration.between(openTime, endTime).getSeconds() < 50 && !orderMap.containsKey(trackingNo)) {
-                            orderMap.put(trackingNo, "1");
-
-                            String content = "<div class=\"highlight\">交易对:" + order.getString("symbol") + "</div>" +
-                                    "<div>持仓方向:" + InitRunner.publicParamsMap.get("holdSide").getString(order.getString("holdSide")) + "</div>" +
-                                    "<div>杠杆倍数:" + order.getString("leverage") + "</div>" +
-                                    "<div>开仓均价:" + order.getString("openPrice") + "</div>" +
-                                    "<div>止盈价:" + order.getString("takeProfitPrice") + "</div>" +
-                                    "<div>止损价:" + order.getString("stopLossPrice") + "</div>" +
-                                    "<div >交易员:" + split[1] + "</div>" +
-                                    "<div class=\"gray\">开仓时间:" + DateUtils.longToString(order.getLong("openTime")) + "</div>";
-                            JSONObject params = new JSONObject();
-                            params.put("title", "BITGET交易员开单报警");
-                            params.put("logUrl", "https://jav.lvzhiqiang.top/coin/orderDetail/" + order.getString("trackingNo"));
-                            params.put("btnTxt", "跟单详情");
-                            SpringUtils.getBean(CoinServiceImpl.class).monitorAlarm4APP_TEXT_CARD(content, params, null);
+                    if (null != orderList) {
+                        for (int i = 0; i < orderList.size(); i++) {
+                            JSONObject order = orderList.getJSONObject(i);
+                            LocalDateTime openTime = DateUtils.longToLocalDateTime(order.getLong("openTime"));
+                            String trackingNo = order.getString("trackingNo");
+                            if (Duration.between(openTime, endTime).getSeconds() < 50 && !orderMap.containsKey(trackingNo)) {
+                                orderMap.put(trackingNo, "1");
+
+                                String content = "<div class=\"highlight\">交易对:" + order.getString("symbol") + "</div>" +
+                                        "<div>持仓方向:" + InitRunner.publicParamsMap.get("holdSide").getString(order.getString("holdSide")) + "</div>" +
+                                        "<div>杠杆倍数:" + order.getString("leverage") + "</div>" +
+                                        "<div>开仓均价:" + order.getString("openPrice") + "</div>" +
+                                        "<div>止盈价:" + order.getString("takeProfitPrice") + "</div>" +
+                                        "<div>止损价:" + order.getString("stopLossPrice") + "</div>" +
+                                        "<div >交易员:" + split[1] + "</div>" +
+                                        "<div class=\"gray\">开仓时间:" + DateUtils.longToString(order.getLong("openTime")) + "</div>";
+                                JSONObject params = new JSONObject();
+                                params.put("title", "BITGET交易员开单报警");
+                                params.put("logUrl", "https://jav.lvzhiqiang.top/coin/orderDetail/" + order.getString("trackingNo"));
+                                params.put("btnTxt", "跟单详情");
+                                SpringUtils.getBean(CoinServiceImpl.class).monitorAlarm4APP_TEXT_CARD(content, params, null);
+                            }
                         }
                     }
                 } catch (Exception ex) {
+                    log.error("bitget-mix-trader error", ex);
                 }
             })).join();
         }, 0, 3, TimeUnit.SECONDS);