| | |
| | | this.initialPrincipal = new BigDecimal(account.getTotal()); |
| | | log.info("[Gate] 初始本金: {} USDT", initialPrincipal); |
| | | |
| | | //设置持仓模式为双向持仓 |
| | | Boolean inDualMode = account.getInDualMode(); |
| | | if (!inDualMode) { |
| | | futuresApi.setDualModeCall(SETTLE,true,null); |
| | | } |
| | | |
| | | if (!config.getPositionMode().equals(account.getPositionMode())) { |
| | | futuresApi.setPositionMode(SETTLE, config.getPositionMode()); |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | longPriceQueue.add(max); |
| | | } |
| | | longPriceQueue.sort(BigDecimal::compareTo); |
| | | |
| | | log.info("[Gate] 多队列:{}", shortPriceQueue); |
| | | } |
| | | |
| | | synchronized (shortPriceQueue) { |
| | |
| | | while (shortPriceQueue.size() > config.getGridQueueSize()) { |
| | | shortPriceQueue.remove(shortPriceQueue.size() - 1); |
| | | } |
| | | |
| | | log.info("[Gate] 空队列:{}", shortPriceQueue); |
| | | } |
| | | } |
| | | |