package org.knowm.xchange.coinbene;

import java.io.IOException;
import org.knowm.xchange.BaseExchange;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.ExchangeSpecification;
import org.knowm.xchange.coinbene.service.CoinbeneAccountService;
import org.knowm.xchange.coinbene.service.CoinbeneMarketDataService;
import org.knowm.xchange.coinbene.service.CoinbeneTradeService;
import org.knowm.xchange.exceptions.ExchangeException;
import org.knowm.xchange.utils.nonce.CurrentTimeNonceFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import si.mazi.rescu.SynchronizedValueFactory;

public class CoinbeneExchange extends BaseExchange implements Exchange {

  private static final Logger LOG = LoggerFactory.getLogger(CoinbeneExchange.class);

  private SynchronizedValueFactory<Long> nonceFactory = new CurrentTimeNonceFactory();

  @Override
  protected void initServices() {

    this.marketDataService = new CoinbeneMarketDataService(this);
    this.accountService = new CoinbeneAccountService(this);
    this.tradeService = new CoinbeneTradeService(this);
  }

  @Override
  public ExchangeSpecification getDefaultExchangeSpecification() {

    ExchangeSpecification exchangeSpecification = new ExchangeSpecification(this.getClass().getCanonicalName());
    exchangeSpecification.setSslUri("https://api.coinbene.com/");
    exchangeSpecification.setHost("coinbene.com");
    exchangeSpecification.setPort(80);
    exchangeSpecification.setExchangeName("Coinbene");
    exchangeSpecification.setExchangeDescription("Coinbene is a bitcoin and altcoin exchange.");

    return exchangeSpecification;
  }

  @Override
  public SynchronizedValueFactory<Long> getNonceFactory() {
    return nonceFactory;
  }

  @Override
  public void remoteInit() throws IOException, ExchangeException {

    try {
      exchangeMetaData = ((CoinbeneMarketDataService) marketDataService).getMetadata();
    } catch (IOException e) {
      throw new IOException("Retrieving MetaData for Coinbene failed", e);
    }
  }
}

@@ -1810,18 +1810,8 @@
  %7B%0A%0A
-    try %7B%0A
     
@@ -1898,119 +1898,8 @@
 ();%0A
-    %7D catch (IOException e) %7B%0A      throw new IOException(%22Retrieving MetaData for Coinbene failed%22, e);%0A    %7D%0A
   %7D%0A

add symbols to market data throw new IOException in remoteInit