| | |
| | | package com.xcong.excoin.modules.gateApi; |
| | | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.DeserializationFeature; |
| | | import com.fasterxml.jackson.databind.SerializationFeature; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private static final String CONFIG_PREFIX = "gate-config-"; |
| | | private static final String JSON_SUFFIX = ".json"; |
| | | |
| | | private final ObjectMapper mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); |
| | | private final ObjectMapper mapper = new ObjectMapper() |
| | | .enable(SerializationFeature.INDENT_OUTPUT) |
| | | .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); |
| | | |
| | | @PostConstruct |
| | | public void ensureConfigDir() { |
| | |
| | | .addPositionQuantity(dto.getAddPositionQuantity() > 0 ? dto.getAddPositionQuantity() : 1) |
| | | .maxPositionPerSide(dto.getMaxPositionPerSide()) |
| | | .addPositionStartThreshold(dto.getAddPositionStartThreshold() >= 0 ? dto.getAddPositionStartThreshold() : 1) |
| | | .addPositionStopThreshold(dto.getAddPositionStopThreshold() >= 0 ? dto.getAddPositionStopThreshold() : 0) |
| | | .placeExcessTakeProfit(normalizeTakeProfitMode(dto.getPlaceExcessTakeProfit())) |
| | | .dualStopLossEnabled(nvl(dto.getDualStopLossEnabled(), false)) |
| | | .longStopLossPrice(dto.getLongStopLossPrice()) |
| | | .shortStopLossPrice(dto.getShortStopLossPrice()) |
| | | .tpTriggerOppositeAddEnabled(nvl(dto.getTpTriggerOppositeAddEnabled(), false)) |
| | | .tpTriggerOppositeAddQuantity(dto.getTpTriggerOppositeAddQuantity() != null && dto.getTpTriggerOppositeAddQuantity() > 0 ? dto.getTpTriggerOppositeAddQuantity() : 0) |
| | | .baseTakeProfitPerGrid(dto.getBaseTakeProfitPerGrid() != null && dto.getBaseTakeProfitPerGrid() > 0 ? dto.getBaseTakeProfitPerGrid() : 0) |
| | | .baseTakeProfitGridCount(dto.getBaseTakeProfitGridCount() != null && dto.getBaseTakeProfitGridCount() > 0 ? dto.getBaseTakeProfitGridCount() : 0) |
| | | .tpPositionReplenishEnabled(nvl(dto.getTpPositionReplenishEnabled(), false)) |
| | | .baseTakeProfitTotalQty(dto.getBaseTakeProfitTotalQty() != null && dto.getBaseTakeProfitTotalQty() > 0 ? dto.getBaseTakeProfitTotalQty() : 0) |
| | | .originalPositionReduce(dto.getOriginalPositionReduce() != null && dto.getOriginalPositionReduce() > 0 ? dto.getOriginalPositionReduce() : 0) |
| | | .build(); |
| | | } |
| | | |