|
@@ -886,12 +886,22 @@ public class CoinServiceImpl implements CoinService {
|
|
|
String markPrice = marketData.getBigDecimal("current_price").toPlainString();
|
|
String markPrice = marketData.getBigDecimal("current_price").toPlainString();
|
|
|
coinWatchlist.setMarkPrice(markPrice);
|
|
coinWatchlist.setMarkPrice(markPrice);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 24小时价格变化
|
|
|
|
|
+ if (marketData.containsKey("price_change_percentage_24h") && null != marketData.get("price_change_percentage_24h")) {
|
|
|
|
|
+ BigDecimal priceChangePercentage24h = marketData.getBigDecimal("price_change_percentage_24h").setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
+ coinWatchlist.setPriceChangePercentage24h(priceChangePercentage24h);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 历史最高价格
|
|
// 历史最高价格
|
|
|
if (marketData.containsKey("ath") && null != marketData.get("ath")) {
|
|
if (marketData.containsKey("ath") && null != marketData.get("ath")) {
|
|
|
String highestHistoricalPrice = marketData.getBigDecimal("ath").toPlainString();
|
|
String highestHistoricalPrice = marketData.getBigDecimal("ath").toPlainString();
|
|
|
coinWatchlist.setHighestHistoricalPrice(highestHistoricalPrice);
|
|
coinWatchlist.setHighestHistoricalPrice(highestHistoricalPrice);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 历史最高点涨幅比例
|
|
|
|
|
+ if (marketData.containsKey("ath_change_percentage") && null != marketData.get("ath_change_percentage")) {
|
|
|
|
|
+ BigDecimal athChangePercentage = marketData.getBigDecimal("ath_change_percentage").setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
+ coinWatchlist.setAthChangePercentage(athChangePercentage);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 历史最高日期
|
|
// 历史最高日期
|
|
|
if (marketData.containsKey("ath_date") && null != marketData.get("ath_date")) {
|
|
if (marketData.containsKey("ath_date") && null != marketData.get("ath_date")) {
|
|
@@ -901,9 +911,14 @@ public class CoinServiceImpl implements CoinService {
|
|
|
|
|
|
|
|
// 历史最低价格
|
|
// 历史最低价格
|
|
|
if (marketData.containsKey("atl") && null != marketData.get("atl")) {
|
|
if (marketData.containsKey("atl") && null != marketData.get("atl")) {
|
|
|
- String lowestHistoricalPrice = marketData.getBigDecimal("atl").toPlainString();
|
|
|
|
|
|
|
+ String lowestHistoricalPrice = marketData.getString("atl");
|
|
|
coinWatchlist.setLowestHistoricalPrice(lowestHistoricalPrice);
|
|
coinWatchlist.setLowestHistoricalPrice(lowestHistoricalPrice);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 历史最低点涨幅比例
|
|
|
|
|
+ if (marketData.containsKey("atl_change_percentage") && null != marketData.get("atl_change_percentage")) {
|
|
|
|
|
+ BigDecimal atlChangePercentage = marketData.getBigDecimal("atl_change_percentage").setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
+ coinWatchlist.setAtlChangePercentage(atlChangePercentage);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 历史最低日期
|
|
// 历史最低日期
|
|
|
if (marketData.containsKey("atl_date") && null != marketData.get("atl_date")) {
|
|
if (marketData.containsKey("atl_date") && null != marketData.get("atl_date")) {
|
|
@@ -1327,6 +1342,7 @@ public class CoinServiceImpl implements CoinService {
|
|
|
private void renderMainSearch4Watchlist(List<CoinWatchlist> watchlistList) {
|
|
private void renderMainSearch4Watchlist(List<CoinWatchlist> watchlistList) {
|
|
|
BigDecimal bigDecimal10000 = new BigDecimal("10000");
|
|
BigDecimal bigDecimal10000 = new BigDecimal("10000");
|
|
|
|
|
|
|
|
|
|
+ // 赛道分类预处理
|
|
|
List<String> trackCategoryList = coinApiConfigMapper.findTrackCategoryList();
|
|
List<String> trackCategoryList = coinApiConfigMapper.findTrackCategoryList();
|
|
|
Map<String, String> trackCategoryMap = new HashMap<>();
|
|
Map<String, String> trackCategoryMap = new HashMap<>();
|
|
|
List<String> colorList = coinApiConfigMapper.findColorStyleList();
|
|
List<String> colorList = coinApiConfigMapper.findColorStyleList();
|
|
@@ -1338,6 +1354,8 @@ public class CoinServiceImpl implements CoinService {
|
|
|
trackCategoryMap.put(trackCategoryList.get(i), colorList.get(j));
|
|
trackCategoryMap.put(trackCategoryList.get(i), colorList.get(j));
|
|
|
j++;
|
|
j++;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 流通市值
|
|
|
for (CoinWatchlist coinWatchlist : watchlistList) {
|
|
for (CoinWatchlist coinWatchlist : watchlistList) {
|
|
|
if (null != coinWatchlist.getTotalMarketValue()) {
|
|
if (null != coinWatchlist.getTotalMarketValue()) {
|
|
|
BigDecimal divide = coinWatchlist.getTotalMarketValue().divide(bigDecimal10000, 8, RoundingMode.HALF_UP);
|
|
BigDecimal divide = coinWatchlist.getTotalMarketValue().divide(bigDecimal10000, 8, RoundingMode.HALF_UP);
|
|
@@ -1364,6 +1382,42 @@ public class CoinServiceImpl implements CoinService {
|
|
|
|
|
|
|
|
// 名称
|
|
// 名称
|
|
|
coinWatchlist.setSymbolStyle(" style=\"background-color:rgba(70,169,244,.72);font-weight: bold;\"");
|
|
coinWatchlist.setSymbolStyle(" style=\"background-color:rgba(70,169,244,.72);font-weight: bold;\"");
|
|
|
|
|
+ // 市场价格
|
|
|
|
|
+ coinWatchlist.setMarkPriceStyle(" style=\"color:#252B31;background-color:#C4ADE9;\"");
|
|
|
|
|
+ // 24小时价格变化
|
|
|
|
|
+ if (coinWatchlist.getPriceChangePercentage24h() == null) {
|
|
|
|
|
+ } else if (coinWatchlist.getPriceChangePercentage24h().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
|
|
+ coinWatchlist.setPriceChangePercentage24hStyle(" style=\"color:#000000;background-color:#f1a8a4;\"");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ coinWatchlist.setPriceChangePercentage24hStyle(" style=\"color:#000000;background-color:#aad6f5;\"");
|
|
|
|
|
+ }
|
|
|
|
|
+ /*// 历史最高点涨幅比例
|
|
|
|
|
+ if (coinWatchlist.getAthChangePercentage() == null) {
|
|
|
|
|
+ } else if (coinWatchlist.getAthChangePercentage().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
|
|
+ coinWatchlist.setAthChangePercentageStyle(" style=\"color:#FFFFFF;background-color:#F1493F;\"");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ coinWatchlist.setAthChangePercentageStyle(" style=\"color:#FFFFFF;background-color:#1DA2B4;\"");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 历史最低点涨幅比例
|
|
|
|
|
+ if (coinWatchlist.getAtlChangePercentage() == null) {
|
|
|
|
|
+ } else if (coinWatchlist.getAtlChangePercentage().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
|
|
+ coinWatchlist.setAtlChangePercentageStyle(" style=\"color:#FFFFFF;background-color:#F1493F;\"");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ coinWatchlist.setAtlChangePercentageStyle(" style=\"color:#FFFFFF;background-color:#1DA2B4;\"");
|
|
|
|
|
+ }*/
|
|
|
|
|
+
|
|
|
|
|
+ // 涨幅倍数2
|
|
|
|
|
+ if (StringUtils.isNotEmpty(coinWatchlist.getHighestHistoricalPrice()) && StringUtils.isNotEmpty(coinWatchlist.getMarkPrice())) {
|
|
|
|
|
+ BigDecimal increaseMultiple = new BigDecimal(coinWatchlist.getHighestHistoricalPrice()).divide(new BigDecimal(coinWatchlist.getMarkPrice()), 1, RoundingMode.HALF_UP);
|
|
|
|
|
+ coinWatchlist.setIncreaseMultiple2(increaseMultiple.toPlainString());
|
|
|
|
|
+ if (increaseMultiple.compareTo(new BigDecimal("50")) >= 0) {
|
|
|
|
|
+ coinWatchlist.setIncreaseMultiple2Style(" style=\"color:#000000;background-color:#5a964e;\"");
|
|
|
|
|
+ } else if (increaseMultiple.compareTo(new BigDecimal("10")) >= 0) {
|
|
|
|
|
+ coinWatchlist.setIncreaseMultiple2Style(" style=\"color:#000000;background-color:#9cc494;\"");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ coinWatchlist.setIncreaseMultiple2Style(" style=\"color:#000000;background-color:#dae8d7;\"");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1437,7 +1491,7 @@ public class CoinServiceImpl implements CoinService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 渲染获取监控币种列表
|
|
|
|
|
|
|
+ * 渲染监控币种列表
|
|
|
*
|
|
*
|
|
|
* @param monitorCurrencyList
|
|
* @param monitorCurrencyList
|
|
|
*/
|
|
*/
|