| | |
| | | WAITING_KLINE, OPENING, ACTIVE, STOPPED |
| | | } |
| | | |
| | | private static final String AUTO_SIZE_LONG = "close_long"; |
| | | private static final String AUTO_SIZE_SHORT = "close_short"; |
| | | private static final String ORDER_TYPE_CLOSE_LONG = "close-long-position"; |
| | | private static final String ORDER_TYPE_CLOSE_SHORT = "close-short-position"; |
| | | |
| | |
| | | } else { |
| | | BigDecimal tpPrice = entryPrice.multiply(BigDecimal.ONE.add(config.getGridRate())).setScale(1, RoundingMode.HALF_UP); |
| | | executor.placeTakeProfit(tpPrice, |
| | | FuturesPriceTrigger.RuleEnum.NUMBER_1, ORDER_TYPE_CLOSE_LONG, AUTO_SIZE_LONG); |
| | | log.info("[Gate] 多单止盈已设, entry:{}, tp:{}", entryPrice, tpPrice); |
| | | FuturesPriceTrigger.RuleEnum.NUMBER_1, ORDER_TYPE_CLOSE_LONG, negate(config.getQuantity())); |
| | | log.info("[Gate] 多单止盈已设, entry:{}, tp:{}, size:{}", entryPrice, tpPrice, negate(config.getQuantity())); |
| | | } |
| | | } else { |
| | | longActive = false; |
| | |
| | | } else { |
| | | BigDecimal tpPrice = entryPrice.multiply(BigDecimal.ONE.subtract(config.getGridRate())).setScale(1, RoundingMode.HALF_UP); |
| | | executor.placeTakeProfit(tpPrice, |
| | | FuturesPriceTrigger.RuleEnum.NUMBER_2, ORDER_TYPE_CLOSE_SHORT, AUTO_SIZE_SHORT); |
| | | log.info("[Gate] 空单止盈已设, entry:{}, tp:{}", entryPrice, tpPrice); |
| | | FuturesPriceTrigger.RuleEnum.NUMBER_2, ORDER_TYPE_CLOSE_SHORT, config.getQuantity()); |
| | | log.info("[Gate] 空单止盈已设, entry:{}, tp:{}, size:{}", entryPrice, tpPrice, config.getQuantity()); |
| | | } |
| | | } else { |
| | | shortActive = false; |