| | |
| | | .multiply(feeRatio.divide(new BigDecimal(100)))
|
| | | .setScale(8, BigDecimal.ROUND_DOWN);
|
| | | }
|
| | |
|
| | | public static BigDecimal calOrderProfitOrLess(int type, BigDecimal newPrice, BigDecimal openPrice, BigDecimal lotNumber, int symbolCnt, int isProfit) {
|
| | | CacheSettingUtils cacheSettingUtils = SpringContextHolder.getBean(CacheSettingUtils.class);
|
| | |
|
| | | PlatformTradeSettingEntity tradeSetting = cacheSettingUtils.getTradeSetting();
|
| | | // 单个订单盈利
|
| | | BigDecimal profitOrLess = BigDecimal.ZERO;
|
| | | // 开多
|
| | | if (ContractHoldOrderEntity.OPENING_TYPE_MORE == type) {
|
| | | profitOrLess = newPrice.subtract(openPrice).multiply(new BigDecimal(symbolCnt)).multiply(lotNumber);
|
| | | // 开空
|
| | | } else {
|
| | | profitOrLess = openPrice.subtract(newPrice).multiply(new BigDecimal(symbolCnt)).multiply(lotNumber);
|
| | | }
|
| | |
|
| | | if (MemberEntity.IS_PROFIT_Y == isProfit) {
|
| | | if (profitOrLess.compareTo(BigDecimal.ZERO) > 0) {
|
| | | profitOrLess = profitOrLess.multiply(BigDecimal.ONE.subtract(tradeSetting.getForceParam()));
|
| | | } else {
|
| | | profitOrLess = profitOrLess.multiply(BigDecimal.ONE.add(tradeSetting.getForceParam()));
|
| | | }
|
| | | }
|
| | |
|
| | | return profitOrLess;
|
| | | }
|
| | | }
|