| | |
| | | |
| | | @Bean |
| | | public void bitgetWebsocketRunClientMap() throws JSONException, JsonProcessingException { |
| | | List<Currency> mexc = currencyService.list(new LambdaQueryWrapper<Currency>().eq(Currency::getSource, "bitget")); |
| | | List<Currency> mexc = currencyService.list(new LambdaQueryWrapper<Currency>().eq(Currency::getSource, "bitget").eq(Currency::getQuoteAsset,"USDT")); |
| | | if (!CollectionUtils.isEmpty(mexc)) { |
| | | int batchSize = 100; // 每个线程处理的数据量 |
| | | int totalSize = mexc.size(); |
| | |
| | | |
| | | @Bean |
| | | public void gateWebsocketRunClientMap() { |
| | | List<Currency> mexc = currencyService.list(new LambdaQueryWrapper<Currency>().eq(Currency::getSource, "gate")); |
| | | List<Currency> mexc = currencyService.list(new LambdaQueryWrapper<Currency>().eq(Currency::getSource, "gate").eq(Currency::getQuoteAsset,"USDT")); |
| | | if (!CollectionUtils.isEmpty(mexc)) { |
| | | int batchSize = 100; // 每个线程处理的数据量 |
| | | int totalSize = mexc.size(); |
| | |
| | | |
| | | @Bean |
| | | public void kucoinWebsocketRunClientMap() throws Exception { |
| | | List<Currency> mexc = currencyService.list(new LambdaQueryWrapper<Currency>().eq(Currency::getSource, "kucoin")); |
| | | List<Currency> mexc = currencyService.list(new LambdaQueryWrapper<Currency>().eq(Currency::getSource, "kucoin").eq(Currency::getQuoteAsset,"USDT")); |
| | | if (!CollectionUtils.isEmpty(mexc)) { |
| | | String result = doPost(); |
| | | JSONObject jsonObject = new JSONObject(result); |
| | |
| | | |
| | | @Bean |
| | | public void mexcWebsocketRunClientMap() throws InterruptedException { |
| | | List<Currency> mexc = currencyService.list(new LambdaQueryWrapper<Currency>().eq(Currency::getSource, "mexc")); |
| | | List<Currency> mexc = currencyService.list(new LambdaQueryWrapper<Currency>().eq(Currency::getSource, "mexc").eq(Currency::getQuoteAsset,"USDT")); |
| | | if (!CollectionUtils.isEmpty(mexc)) { |
| | | int batchSize = 30; // 每个线程处理的数据量 |
| | | int totalSize = mexc.size(); |
| | |
| | | } |
| | | |
| | | private static void assembleMarketDataOut(String coinName, MarketBo markets1, MarketBo markets2, BigDecimal profitPercentage, BigDecimal buyPrice, BigDecimal sellPrice, List<MarketDataOut> marketDataOuts, String formattedDateTime) { |
| | | if(coinName.contains(String.valueOf("USDT"))){ |
| | | MarketDataOut marketDataOut = new MarketDataOut(); |
| | | marketDataOut.setBaseAsset(coinName.replaceAll("USDT","").toLowerCase().toUpperCase()); // 设置基础资产 |
| | | marketDataOut.setBuyingPlatform(capitalizeFirstLetter(markets1.getExchange())); // 设置买入平台,首字母大写 |
| | |
| | | marketDataOut.setServceTime(formattedDateTime); // 设置服务时间 |
| | | marketDataOut.setBuyAndSell(marketDataOut.getBaseAsset()+marketDataOut.getBuyingPlatform()+marketDataOut.getSellPlatform()); |
| | | marketDataOuts.add(marketDataOut); // 添加到输出列表 |
| | | }else{ |
| | | System.out.println(coinName); |
| | | } |
| | | } |
| | | |
| | | public static String capitalizeFirstLetter(String word) { |