1
zj
2024-08-08 a9e9e1207ce417388b1d8f03df5833cea24939b7
websocketSerivce/src/main/java/org/example/server/impl/CurrencySerivceImpl.java
@@ -237,8 +237,8 @@
    private static void assembleMarketDataOut(String coinName, MarketBo markets1, MarketBo markets2, BigDecimal profitPercentage, BigDecimal buyPrice, BigDecimal sellPrice, List<MarketDataOut> marketDataOuts, String formattedDateTime) {
        MarketDataOut marketDataOut = new MarketDataOut();
        marketDataOut.setBaseAsset(coinName.replaceAll("USDT","").toLowerCase().toUpperCase()); // 设置基础资产
        marketDataOut.setBuyingPlatform(markets1.getExchange().toUpperCase()); // 设置买入平台
        marketDataOut.setSellPlatform(markets2.getExchange().toUpperCase()); // 设置卖出平台
        marketDataOut.setBuyingPlatform(capitalizeFirstLetter(markets1.getExchange())); // 设置买入平台,首字母大写
        marketDataOut.setSellPlatform(capitalizeFirstLetter(markets2.getExchange())); // 设置卖出平台,首字母大写
        marketDataOut.setSpread(profitPercentage.setScale(4, RoundingMode.DOWN).toPlainString()); // 设置利润百分比
        marketDataOut.setBuyPrice(buyPrice.toPlainString()); // 设置买入价格
        marketDataOut.setSellPrice(sellPrice.toPlainString()); // 设置卖出价格
@@ -251,6 +251,14 @@
        marketDataOuts.add(marketDataOut); // 添加到输出列表
    }
    public static String capitalizeFirstLetter(String word) {
        if (word == null || word.isEmpty()) {
            return word;
        }
        return Character.toUpperCase(word.charAt(0)) + word.substring(1);
    }
    private void pushWs(List<MarketDataOut> marketDataOuts) {
//        String key = "MARKET_Date";
//        // 创建 Gson 对象