| | |
| | | String reason = ""; |
| | | |
| | | if (hasLong && hasShort) { |
| | | // 多空双边持仓:多均价 − 空均价 > span × step |
| | | BigDecimal gap = longAvgPrice.subtract(shortAvgPrice); |
| | | // 多空双边持仓:|多均价 − 空均价| > span × step |
| | | BigDecimal gap = shortAvgPrice.subtract(longAvgPrice); |
| | | if (gap.compareTo(threshold) >= 0) { |
| | | shouldRestart = true; |
| | | reason = StrUtil.format("双边跨度 多均价:{} − 空均价:{} = {} > {} (span:{}×step:{})", |
| | | reason = StrUtil.format("双边跨度 |多均价:{} − 空均价:{}| = {} >= {} (span:{}×step:{})", |
| | | longAvgPrice, shortAvgPrice, gap, threshold, span, step); |
| | | } |
| | | } else if (hasLong) { |