package org.knowm.xchange.huobi.dto.marketdata;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.function.BiConsumer;

public final class HuobiDepth {

  private final long id;
  public final SortedMap<BigDecimal, BigDecimal> bids;
  public final SortedMap<BigDecimal, BigDecimal> asks;

  public HuobiDepth(
      @JsonProperty("id") long id,
      @JsonProperty("bids") List<BigDecimal[]> bidsJson,
      @JsonProperty("asks") List<BigDecimal[]> asksJson) {
    this.id = id;

    BiConsumer<Object[], Map<BigDecimal, BigDecimal>> entryProcessor =
        (obj, col) -> {
          BigDecimal price = new BigDecimal(obj[0].toString());
          BigDecimal qty = new BigDecimal(obj[1].toString());
          col.put(price, qty);
        };

    TreeMap<BigDecimal, BigDecimal> bids = new TreeMap<>((k1, k2) -> -k1.compareTo(k2));
    TreeMap<BigDecimal, BigDecimal> asks = new TreeMap<>();

    bidsJson.stream().forEach(e -> entryProcessor.accept(e, bids));
    asksJson.stream().forEach(e -> entryProcessor.accept(e, asks));

    this.bids = Collections.unmodifiableSortedMap(bids);
    this.asks = Collections.unmodifiableSortedMap(asks);
  }

  public long getId() {
    return id;
  }

  public SortedMap<BigDecimal, BigDecimal> getBids() {
    return bids;
  }

  public SortedMap<BigDecimal, BigDecimal> getAsks() {
    return asks;
  }

  @Override
  public String toString() {
    return "HuobiTicker [id="
        + getId()
        + ", bids="
        + getBids().toString()
        + ", asks="
        + getAsks().toString()
        + "]";
  }
}

@@ -672,14 +672,18 @@
 mer%3C
-Object
+BigDecimal
 %5B%5D, 
@@ -766,152 +766,30 @@
     
-BigDecimal price = new BigDecimal(obj%5B0%5D.toString());%0A          BigDecimal qty = new BigDecimal(obj%5B1%5D.toString());%0A          col.put(price, qty
+col.put(obj%5B0%5D, obj%5B1%5D
 );%0A 

Remove Huobi useless conversion