class Deserializer extends JsonDeserializer<CexIOArchivedOrder> {

    @Override
    public CexIOArchivedOrder deserialize(JsonParser jsonParser, DeserializationContext context)
        throws IOException {<FILL_FUNCTION_BODY>}
  }

      JsonNode jsonNode = jsonParser.getCodec().readTree(jsonParser);

      try {

        Map<String, String> map = new HashMap<>();

        Iterator<Map.Entry<String, JsonNode>> tradesResultIterator = jsonNode.fields();
        while (tradesResultIterator.hasNext()) {
          Map.Entry<String, JsonNode> entry = tradesResultIterator.next();
          map.put(entry.getKey(), entry.getValue().asText());
        }

        BigDecimal feeValue = null;
        String feeCcy = null;
        Pattern pattern = Pattern.compile("([af])\\:(.*?)\\:cds");

        Map<String, BigDecimal> filled = new HashMap<>();

        for (String key : map.keySet()) {
          Matcher matcher = pattern.matcher(key);
          if (matcher.matches()) {
            String feeOrAmount = matcher.group(1);

            String ccy = matcher.group(2);
            BigDecimal value = new BigDecimal(map.get(key));

            if (feeOrAmount.equals("a")) {
              filled.put(ccy, value);
            } else if (feeOrAmount.equals("f")) {
              feeValue = value;
              feeCcy = ccy;
            } else {
              throw new IllegalStateException("Cannot parse " + key);
            }
          }
        }

        String counter = map.get("symbol2");
        String base = map.get("symbol1");

        BigDecimal orderPrice = null;
        // market orders don't have a price
        if (map.containsKey("price")) orderPrice = new BigDecimal(map.get("price"));

        int priceScale = 8; // todo: check if this is correct for all
        BigDecimal counterAmount = filled.get(counter);
        BigDecimal baseAmount = filled.get(base);

        BigDecimal averageExecutionPrice = null;
        if (baseAmount != null && baseAmount.compareTo(BigDecimal.ZERO) > 0)
          averageExecutionPrice =
              counterAmount.divide(baseAmount, priceScale, RoundingMode.HALF_UP);

        BigDecimal amount = new BigDecimal(map.get("amount"));

        if (amount.compareTo(BigDecimal.ZERO) == 0 && map.containsKey("amount2")) {
          // the 'amount' field changes name for market orders
          // and represents the amount in the counter ccy instead
          // of the base ccy
          BigDecimal amount2 = new BigDecimal(map.get("amount2"));

          amount = amount2.divide(averageExecutionPrice, 8, RoundingMode.HALF_UP);
        }

        return new CexIOArchivedOrder(
            map.get("id"),
            map.get("type"),
            map.get("time"),
            map.get("lastTxTime"),
            map.get("lastTx"),
            map.get("pos"),
            map.get("status"),
            base,
            counter,
            amount,
            orderPrice,
            averageExecutionPrice,
            map.get("remains"),
            map.get("tradingFeeMaker"),
            map.get("tradingFeeTaker"),
            map.get("tradingFeeUserVolumeAmount"),
            map.get("orderId"),
            feeValue,
            feeCcy);
      } catch (Exception e) {
        throw new IllegalStateException("Failed to parse " + jsonNode, e);
      }
    
<no_super_class>