| | |
| | | } |
| | | } |
| | | } |
| | | log.info("[Gate] 空队列:{}", shortPriceQueue); |
| | | if (matched.isEmpty()) { |
| | | log.info("[Gate] 空仓队列未触发, 当前价:{}", currentPrice); |
| | | return; |
| | | } |
| | | |
| | | log.info("[Gate] 空仓队列触发, 匹配{}个元素, 当前价:{}", matched.size(), currentPrice); |
| | | if (!isMarginSafe()) { |
| | | log.warn("[Gate] 保证金超限,跳过空单开仓"); |
| | |
| | | min = min.multiply(BigDecimal.ONE.subtract(step)).setScale(1, RoundingMode.HALF_UP); |
| | | shortPriceQueue.add(min); |
| | | } |
| | | shortPriceQueue.sort((a, b) -> b.compareTo(a)); |
| | | shortPriceQueue.sort(BigDecimal::compareTo); |
| | | |
| | | log.info("[Gate] 空队列:{}", shortPriceQueue); |
| | | } |
| | | |
| | | synchronized (longPriceQueue) { |
| | |
| | | while (longPriceQueue.size() > config.getGridQueueSize()) { |
| | | longPriceQueue.remove(longPriceQueue.size() - 1); |
| | | } |
| | | |
| | | log.info("[Gate] 多队列:{}", shortPriceQueue); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | log.info("[Gate] 多队列:{}", longPriceQueue); |
| | | if (matched.isEmpty()) { |
| | | log.info("[Gate] 多仓队列未触发, 当前价:{}", currentPrice); |
| | | return; |
| | | } |
| | | |
| | |
| | | longPriceQueue.add(max); |
| | | } |
| | | longPriceQueue.sort(BigDecimal::compareTo); |
| | | |
| | | log.info("[Gate] 多队列:{}", longPriceQueue); |
| | | } |
| | | |
| | | synchronized (shortPriceQueue) { |
| | |
| | | while (shortPriceQueue.size() > config.getGridQueueSize()) { |
| | | shortPriceQueue.remove(shortPriceQueue.size() - 1); |
| | | } |
| | | |
| | | log.info("[Gate] 空队列:{}", shortPriceQueue); |
| | | } |
| | | } |
| | | |