| | |
| | | /** |
| | | * 分仓交易-入仓 |
| | | */ |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ServerResponse buyFunds(Integer stockId, Integer buyNum, Integer buyType, Integer lever, Integer subaccountNumber, HttpServletRequest request) throws Exception { |
| | | return ServerResponse.createBySuccess("Order successful"); |
| | | } |
| | |
| | | /* |
| | | * 分仓交易-用户平仓操作 |
| | | * */ |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ServerResponse sellFunds(String positionSn, int doType) throws Exception { |
| | | log.info("【用户交易平仓】 positionSn = {} , dotype = {}", positionSn, Integer.valueOf(doType)); |
| | | |
| | |
| | | return ServerResponse.createByErrorMsg("报价0,平仓失败,请稍后再试"); |
| | | } |
| | | |
| | | double stock_crease = stockListVO.getHcrate().doubleValue(); |
| | | |
| | | BigDecimal zsPrice = new BigDecimal(stockListVO.getPreclose_px()); |
| | | |
| | |
| | | |
| | | BigDecimal ztRate = chaPrice.multiply(new BigDecimal("100")).divide(zsPrice, 2, 4); |
| | | |
| | | ztRate = ztRate.negate(); |
| | | log.info("股票当前涨跌幅 = {} 跌停幅度 = {}", Double.valueOf(stock_crease), ztRate); |
| | | if ((new BigDecimal(String.valueOf(stock_crease))).compareTo(ztRate) == 0 && "买涨" |
| | | .equals(userPosition.getOrderDirection())) { |
| | | return ServerResponse.createByErrorMsg("当前股票已跌停不能卖出"); |
| | | } |
| | | |
| | | Integer buy_num = userPosition.getOrderNum(); |
| | | |