zj
2025-10-17 bbc4713b23778aebc1eb3d46cb04d539179d883d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.yami.trading.huobi.websocket.service.huobi.parser.market;
 
import java.util.List;
 
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
 
import com.yami.trading.huobi.websocket.model.market.MbpRefreshUpdateEvent;
import com.yami.trading.huobi.websocket.service.huobi.parser.HuobiModelParser;
import com.yami.trading.huobi.websocket.service.huobi.utils.DataUtils;
 
public class MbpRefreshUpdateEventParser implements HuobiModelParser<MbpRefreshUpdateEvent> {
 
  @Override
  public MbpRefreshUpdateEvent parse(JSONObject json) {
    String dataKey = DataUtils.getDataKey(json);
 
    JSONObject data = json.getJSONObject(dataKey);
 
    return MbpRefreshUpdateEvent.builder()
        .topic(json.getString("ch"))
        .ts(json.getLong("ts"))
        .seqNum(data.getLong("seqNum"))
        .bids(new PriceLevelParser().parseArray(data.getJSONArray("bids")))
        .asks(new PriceLevelParser().parseArray(data.getJSONArray("asks")))
        .build();
  }
 
  @Override
  public MbpRefreshUpdateEvent parse(JSONArray json) {
    return null;
  }
 
  @Override
  public List<MbpRefreshUpdateEvent> parseArray(JSONArray jsonArray) {
    return null;
  }
}