| | |
| | | args.add(arg); |
| | | msg.put("args", args); |
| | | ws.send(msg.toJSONString()); |
| | | log.info("[{}] 订阅成功, 合约:{}", CHANNEL_NAME, instId); |
| | | } |
| | | |
| | | @Override |
| | |
| | | args.add(arg); |
| | | msg.put("args", args); |
| | | ws.send(msg.toJSONString()); |
| | | log.info("[{}] 取消订阅成功", CHANNEL_NAME); |
| | | } |
| | | |
| | | @Override |
| | |
| | | String pnl = detail.getString("pnl"); |
| | | String posSide = detail.getString("posSide"); |
| | | String avgPx = detail.getString("avgPx"); |
| | | String clOrdId = detail.getString("clOrdId"); |
| | | |
| | | log.info("[{}] 订单, 方向:{}, 状态:{}, 成交量:{}, 均价:{}, 盈亏:{}, 编号:{}", |
| | | CHANNEL_NAME, posSide, state, accFillSz, avgPx, pnl, clOrdId); |
| | | |
| | | if ("filled".equals(state) && accFillSz != null && new BigDecimal(accFillSz).compareTo(BigDecimal.ZERO) > 0) { |
| | | if (gridTradeService != null) { |
| | | BigDecimal avgPxVal = avgPx != null && !avgPx.isEmpty() ? new BigDecimal(avgPx) : BigDecimal.ZERO; |
| | | BigDecimal pnlVal = pnl != null ? new BigDecimal(pnl) : BigDecimal.ZERO; |
| | | gridTradeService.onOrderFilled(posSide, new BigDecimal(accFillSz), pnlVal); |
| | | gridTradeService.onOrderFilled(posSide, new BigDecimal(accFillSz), avgPxVal, pnlVal); |
| | | } |
| | | } |
| | | } |