| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity; |
| | | import com.xcong.excoin.modules.coin.service.OrderCoinService; |
| | | import com.xcong.excoin.rabbit.producer.ExchangeProducer; |
| | |
| | | return; |
| | | } |
| | | // 如果 |
| | | if (exchangeOrder.getEntrustAmount().compareTo(BigDecimal.ZERO) <= 0 || exchangeOrder.getEntrustAmount().subtract(exchangeOrder.getDealAmount()).compareTo(BigDecimal.ZERO) <= 0) { |
| | | return; |
| | | if(OrderCoinsEntity.ORDERTYPE_BUY==exchangeOrder.getOrderType()){ |
| | | if (exchangeOrder.getEntrustAmount().compareTo(BigDecimal.ZERO) <= 0 || exchangeOrder.getEntrustAmount().subtract(exchangeOrder.getDealAmount()).compareTo(BigDecimal.ZERO) <= 0) { |
| | | return; |
| | | } |
| | | }else{ |
| | | if (exchangeOrder.getEntrustCnt().compareTo(BigDecimal.ZERO) <= 0 || exchangeOrder.getEntrustCnt().subtract(exchangeOrder.getDealCnt()).compareTo(BigDecimal.ZERO) <= 0) { |
| | | return; |
| | | } |
| | | } |
| | | |
| | | |
| | | TreeMap<BigDecimal, MergeOrder> limitPriceOrderList; |
| | | LinkedList<OrderCoinsEntity> marketPriceOrderList; |
| | |
| | | availAmount = calculateTradedAmount(matchOrder, dealPrice); |
| | | //计算成交量 取少的 |
| | | BigDecimal tradedAmount = (availAmount.compareTo(needAmount) >= 0 ? needAmount : availAmount); |
| | | System.out.println("成交量:"+tradedAmount); |
| | | //logger.info("dealPrice={},amount={}", dealPrice, tradedAmount); |
| | | //如果成交额为0说明剩余额度无法成交,退出 |
| | | if (tradedAmount.compareTo(BigDecimal.ZERO) == 0) { |