Administrator
5 days ago 23ece6103fd890655f0eef79331d3d73921611a2
src/main/java/com/xcong/excoin/modules/okxNewPrice/celue/CaoZuoServiceImpl.java
@@ -81,6 +81,17 @@
            // 账户预期亏损金额比这个还小时,立即止损
            if (realKuiSunAmount.compareTo(zhiSunAmount) > 0){
                log.warn("账户冷静止损......");
                //目前止损掉损失较大的一个方向
                String positionAccountName = PositionsWs.initAccountName(accountName, posSide);
                BigDecimal upl = PositionsWs.getAccountMap(positionAccountName).get("upl");
                String posSideOther = CoinEnums.POSSIDE_LONG.getCode().equals(posSide) ? CoinEnums.POSSIDE_SHORT.getCode() : CoinEnums.POSSIDE_LONG.getCode();
                String positionAccountOther = PositionsWs.initAccountName(accountName, posSideOther);
                BigDecimal uplOther = PositionsWs.getAccountMap(positionAccountOther).get("upl");
                if (upl.compareTo(uplOther) > 0){
                    log.warn("{}的亏损{},{}的亏损{},止损{}......",posSide,upl,posSideOther,uplOther,uplOther);
                    posSide = posSideOther;
                }
                WsMapBuild.saveStringToMap(InstrumentsWs.getAccountMap(accountName), CoinEnums.OUT.name(),  OrderParamEnums.OUT_YES.getValue());
                tradeRequestParam.setTradeType(OrderParamEnums.TRADE_YES.getValue());
                return caoZuoZhiSunEvent(accountName, markPx, posSide);