| | |
| | | |
| | | private static final String WS_URL_MONIPAN = "wss://wspap.okx.com:8443/ws/v5/public"; |
| | | private static final String WS_URL_SHIPAN = "wss://ws.okx.com:8443/ws/v5/public"; |
| | | private static final boolean isAccountType = true; |
| | | private static final boolean isAccountType = false; |
| | | |
| | | /** |
| | | * 建立与 OKX WebSocket 服务器的连接。 |
| | |
| | | for (OkxQuantWebSocketClient client : clientManager.getAllClients()) { |
| | | String accountName = client.getAccountName(); |
| | | if (accountName != null) { |
| | | /** |
| | | * 处理历史网格的订单 |
| | | * 根据历史网格的开单方向,是否需要止损处理 |
| | | * 如果方向一致就不需要处理 |
| | | * 如果不一致则需要处理 |
| | | */ |
| | | String fangXiang = gridByPriceNew.getFang_xiang(); |
| | | String fangXiangOld = CoinEnums.POSSIDE_LONG.getCode().equals(fangXiang) ? CoinEnums.POSSIDE_SHORT.getCode() : CoinEnums.POSSIDE_LONG.getCode(); |
| | | if (!fangXiang.equals(fangXiangOld)){ |
| | | log.info("历史网格方向为:{}", fangXiangOld); |
| | | TradeRequestParam tradeRequestParamOld = caoZuoService.caoZuoZhiSunEvent(accountName, markPx, fangXiangOld); |
| | | TradeOrderWs.orderEvent(client.getWebSocketClient(), tradeRequestParamOld); |
| | | } |
| | | |
| | | /** |
| | | * 处理当前网格的订单,触发量化操作 |
| | | */ |
| | | log.info("当前价格{}属于网格: {}-{}({}-{})", markPx, gridByPriceNew.getName(),gridByPriceNew.getFang_xiang(), gridByPriceNew.getJiage_xiaxian(), gridByPriceNew.getJiage_shangxian()); |
| | | wangGeListService.initWangGe(markPx); |
| | | TradeRequestParam tradeRequestParam = caoZuoService.caoZuoHandler(accountName, markPx, gridByPriceNew.getFang_xiang()); |