|
@@ -203,7 +203,7 @@ public class CoinServiceImpl implements CoinService {
|
|
|
try {
|
|
try {
|
|
|
syncData4TraderListSub(dataList);
|
|
syncData4TraderListSub(dataList);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
- log.error("syncData4TraderListSub error,paramMap={}", paramMap, e);
|
|
|
|
|
|
|
+ log.error("syncData4TraderListSub error,paramMap={},response={}", paramMap, response, e);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
totalNum += dataList.size();
|
|
totalNum += dataList.size();
|
|
@@ -953,7 +953,7 @@ public class CoinServiceImpl implements CoinService {
|
|
|
result = JSONObject.parseObject(response.body()).getJSONArray("tickers");
|
|
result = JSONObject.parseObject(response.body()).getJSONArray("tickers");
|
|
|
|
|
|
|
|
if (result == null) {
|
|
if (result == null) {
|
|
|
- Thread.sleep(10000L);
|
|
|
|
|
|
|
+ Thread.sleep(60000L);
|
|
|
response = JsoupUtil.requestBody(String.format(coingeckoExchangeTickersUrl, coingeckoExchangeId), JsoupUtil.HTTP_GET, Proxy.NO_PROXY, headerMap, paramMap);
|
|
response = JsoupUtil.requestBody(String.format(coingeckoExchangeTickersUrl, coingeckoExchangeId), JsoupUtil.HTTP_GET, Proxy.NO_PROXY, headerMap, paramMap);
|
|
|
result = JSONObject.parseObject(response.body()).getJSONArray("tickers");
|
|
result = JSONObject.parseObject(response.body()).getJSONArray("tickers");
|
|
|
}
|
|
}
|
|
@@ -1053,7 +1053,10 @@ public class CoinServiceImpl implements CoinService {
|
|
|
initCexSpotFlag(coinWatchlistOtherMap4Symbol);
|
|
initCexSpotFlag(coinWatchlistOtherMap4Symbol);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- coinMapper.insertOrUpdateCoinWatchlistOtherList(watchlistOtherList);
|
|
|
|
|
|
|
+ boolean fail = watchlistOtherList.stream().anyMatch(e -> e.getCexSpot() == null || e.getCexSpot().length() < 6);
|
|
|
|
|
+ if (!fail) {
|
|
|
|
|
+ coinMapper.insertOrUpdateCoinWatchlistOtherList(watchlistOtherList);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void parseWatchlistMap4Coingecko(Map<String, CoinWatchlist> watchlistMap4Coingecko) {
|
|
public void parseWatchlistMap4Coingecko(Map<String, CoinWatchlist> watchlistMap4Coingecko) {
|
|
@@ -2143,12 +2146,13 @@ public class CoinServiceImpl implements CoinService {
|
|
|
|
|
|
|
|
StringBuffer sb = new StringBuffer();
|
|
StringBuffer sb = new StringBuffer();
|
|
|
sb.append("<table border=\"1\" cellspacing=\"0\">");
|
|
sb.append("<table border=\"1\" cellspacing=\"0\">");
|
|
|
- sb.append("<tr><td>").append("流通市值").append("</td>").append("<td>").append(coinWatchlistOther.getMarketCap()).append("</td></tr>");
|
|
|
|
|
- sb.append("<tr><td>").append("流通供应量").append("</td>").append("<td>").append(coinWatchlistOther.getCirculatingSupply()).append("</td></tr>");
|
|
|
|
|
- sb.append("<tr><td>").append("流通率").append("</td>").append("<td>").append(coinWatchlistOther.getCirculatingRate()).append("</td></tr>");
|
|
|
|
|
- sb.append("<tr><td>").append("总供应量").append("</td>").append("<td>").append(coinWatchlistOther.getTotalSupply()).append("</td></tr>");
|
|
|
|
|
- sb.append("<tr><td>").append("最大供应量").append("</td>").append("<td>").append(coinWatchlistOther.getMaxSupply()).append("</td></tr>");
|
|
|
|
|
- sb.append("<tr><td>").append("完全稀释的市值").append("</td>").append("<td>").append(coinWatchlistOther.getFullyDilutedMarketCap()).append("</td></tr>");
|
|
|
|
|
|
|
+
|
|
|
|
|
+ sb.append("<tr><td>").append("流通市值").append("</td>").append("<td>").append(convertHumanReadable(coinWatchlistOther.getMarketCap())).append("</td></tr>");
|
|
|
|
|
+ sb.append("<tr><td>").append("流通供应量").append("</td>").append("<td>").append(convertHumanReadable(coinWatchlistOther.getCirculatingSupply())).append("</td></tr>");
|
|
|
|
|
+ sb.append("<tr><td>").append("流通率").append("</td>").append("<td>").append(StringUtils.isNotEmpty(coinWatchlistOther.getCirculatingRate()) ? new BigDecimal(coinWatchlistOther.getCirculatingRate()).setScale(1, RoundingMode.HALF_UP) + "%" : "--").append("</td></tr>");
|
|
|
|
|
+ sb.append("<tr><td>").append("总供应量").append("</td>").append("<td>").append(convertHumanReadable(coinWatchlistOther.getTotalSupply())).append("</td></tr>");
|
|
|
|
|
+ sb.append("<tr><td>").append("最大供应量").append("</td>").append("<td>").append(convertHumanReadable(coinWatchlistOther.getMaxSupply())).append("</td></tr>");
|
|
|
|
|
+ sb.append("<tr><td>").append("完全稀释的市值").append("</td>").append("<td>").append(convertHumanReadable(coinWatchlistOther.getFullyDilutedMarketCap())).append("</td></tr>");
|
|
|
|
|
|
|
|
String[] coingeckoExchangeNameArr = InitRunner.dicCodeMap.get("coingecko_exchange_names").getCodeValue().split(",");
|
|
String[] coingeckoExchangeNameArr = InitRunner.dicCodeMap.get("coingecko_exchange_names").getCodeValue().split(",");
|
|
|
List<String> coingeckoExchangeNameList = new ArrayList<>();
|
|
List<String> coingeckoExchangeNameList = new ArrayList<>();
|
|
@@ -2222,4 +2226,18 @@ public class CoinServiceImpl implements CoinService {
|
|
|
Map<Long, CoinWatchlist> coinWatchlistMap4CmcId = watchlistListCMC.stream().collect(Collectors.toMap(CoinWatchlist::getCmcId, coinWatchlist -> coinWatchlist));
|
|
Map<Long, CoinWatchlist> coinWatchlistMap4CmcId = watchlistListCMC.stream().collect(Collectors.toMap(CoinWatchlist::getCmcId, coinWatchlist -> coinWatchlist));
|
|
|
parseWatchlistMap4CmC(coinWatchlistMap4CmcId);
|
|
parseWatchlistMap4CmC(coinWatchlistMap4CmcId);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public String convertHumanReadable(String number) {
|
|
|
|
|
+ if (StringUtils.isEmpty(number)) {
|
|
|
|
|
+ return "--";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ BigDecimal bigDecimal10000 = new BigDecimal("10000");
|
|
|
|
|
+ BigDecimal divide = new BigDecimal(number).divide(bigDecimal10000, 8, RoundingMode.HALF_UP);
|
|
|
|
|
+ if (divide.compareTo(bigDecimal10000) <= 0) {
|
|
|
|
|
+ return divide.setScale(2, RoundingMode.HALF_UP) + "万";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return divide.divide(bigDecimal10000, 2, RoundingMode.HALF_UP) + "亿";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|