| | |
| | | private static final String STATE_KEY = "state"; |
| | | public static void handleEvent(JSONObject response, RedisUtils redisUtils, String accountName) { |
| | | |
| | | // log.info("开始执行OrderInfoWs......"); |
| | | log.info("开始执行OrderInfoWs......"); |
| | | try { |
| | | JSONArray dataArray = response.getJSONArray(DATA_KEY); |
| | | if (dataArray == null || dataArray.isEmpty()) { |
| | |
| | | Map<String, String> accountMap = getAccountMap(accountName); |
| | | //记录成交均价 |
| | | if (accountMap.get("orderPrice") == null){ |
| | | log.info("成交均价: {}", avgPx); |
| | | WsMapBuild.saveStringToMap(accountMap, "orderPrice",avgPx); |
| | | } |
| | | WsMapBuild.saveStringToMap(TradeOrderWs.getAccountMap(accountName), "state", CoinEnums.ORDER_LIVE.getCode()); |
| | | |
| | | //保存上一个网格信息 |
| | | WangGeListEnum gridByPrice = WangGeListEnum.getGridByPrice(new BigDecimal(avgPx)); |
| | | if (gridByPrice != null){ |
| | | Map<String, String> instrumentsMap = InstrumentsWs.getAccountMap(accountName); |
| | | WsMapBuild.saveStringToMap(instrumentsMap, CoinEnums.WANG_GE_OLD.name(), gridByPrice.name()); |
| | | } |
| | | |
| | | // 使用账号特定的Map |
| | | String positionAccountName = PositionsWs.initAccountName(accountName, side); |