package org.knowm.xchange.okex.v5.service;

import java.io.IOException;

import org.knowm.xchange.client.ResilienceRegistries;
import org.knowm.xchange.dto.marketdata.OrderBook;
import org.knowm.xchange.dto.marketdata.Trades;
import org.knowm.xchange.instrument.Instrument;
import org.knowm.xchange.okex.v5.OkexAdapters;
import org.knowm.xchange.okex.v5.OkexExchange;
import org.knowm.xchange.service.marketdata.MarketDataService;

/** Author: Max Gao (gaamox@tutanota.com) Created: 08-06-2021 */
public class OkexMarketDataService extends OkexMarketDataServiceRaw implements MarketDataService {
  public static final String SPOT = "SPOT";
  public static final String SWAP = "SWAP";
  public static final String FUTURES = "FUTURES";
  public static final String OPTION = "OPTION";

  public OkexMarketDataService(OkexExchange exchange, ResilienceRegistries resilienceRegistries) {
    super(exchange, resilienceRegistries);
  }

  @Override
  public OrderBook getOrderBook(Instrument instrument, Object... args) throws IOException {
    return OkexAdapters.adaptOrderBook(
        getOkexOrderbook(OkexAdapters.adaptCurrencyPairId(instrument)), instrument);
  }

  @Override
  public Trades getTrades(Instrument instrument, Object... args) throws IOException {
    return OkexAdapters.adaptTrades(
        getOkexTrades(OkexAdapters.adaptCurrencyPairId(instrument), 100).getData(), instrument);
  }
}

@@ -116,24 +116,72 @@
 Registries;%0A
+import org.knowm.xchange.currency.CurrencyPair;%0A
 import org.k
@@ -1197,32 +1197,208 @@
 strument);%0A  %7D%0A%0A
+  @Override%0A  public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException %7B%0A    return this.getOrderBook((Instrument) currencyPair, args);%0A  %7D%0A%0A
   @Override%0A  pu

Add implementation for legacy getOrderBook method( unfortunately most of the exchange implementations support legacy one)