| | |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.xcong.excoin.modules.okxApi.IOkxStrategy; |
| | | import com.xcong.excoin.modules.okxApi.OkxConfig; |
| | | import com.xcong.excoin.modules.okxApi.OkxGridTradeService; |
| | | import com.xcong.excoin.modules.okxApi.wsHandler.AbstractOkxPrivateChannelHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.java_websocket.client.WebSocketClient; |
| | |
| | | /** |
| | | * 构造订单频道处理器。 |
| | | * |
| | | * @param config OKX 配置实例 |
| | | * @param gridTradeService OKX 网格交易策略服务实例 |
| | | * @param config OKX 配置实例 |
| | | * @param strategy OKX 交易策略服务实例 |
| | | */ |
| | | public OrdersOkxChannelHandler(OkxConfig config, OkxGridTradeService gridTradeService) { |
| | | public OrdersOkxChannelHandler(OkxConfig config, IOkxStrategy strategy) { |
| | | super(CHANNEL_NAME, |
| | | config.getApiKey(), config.getApiSecret(), config.getPassphrase(), |
| | | config.getContract(), |
| | | gridTradeService); |
| | | strategy); |
| | | this.config = config; |
| | | } |
| | | |
| | |
| | | log.info("[OKX-WS] orders fill, algoId:{}, state:filled, orderType:{}, side:{}, posSide:{}, fillSz:{}, tradeId:{}", |
| | | algoId, orderType, side, posSide, fillSz, tradeId); |
| | | |
| | | if (getGridTradeService() != null) { |
| | | getGridTradeService().onAutoOrder(algoId, "finished", state, orderType, tradeId); |
| | | if (getStrategy() != null) { |
| | | getStrategy().onAutoOrder(algoId, "finished", state, orderType, tradeId); |
| | | } |
| | | } |
| | | } catch (Exception e) { |