All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.knowm.xchange.bitflyer.BitflyerExchange Maven / Gradle / Ivy

There is a newer version: 5.2.0
Show newest version
package org.knowm.xchange.bitflyer;

import java.io.IOException;
import java.util.List;
import org.knowm.xchange.BaseExchange;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.ExchangeSpecification;
import org.knowm.xchange.bitflyer.dto.account.BitflyerMarket;
import org.knowm.xchange.bitflyer.service.BitflyerAccountService;
import org.knowm.xchange.bitflyer.service.BitflyerMarketDataService;
import org.knowm.xchange.bitflyer.service.BitflyerMarketDataServiceRaw;
import org.knowm.xchange.bitflyer.service.BitflyerTradeService;
import org.knowm.xchange.exceptions.ExchangeException;
import org.knowm.xchange.utils.nonce.AtomicLongIncrementalTime2014NonceFactory;
import si.mazi.rescu.SynchronizedValueFactory;

public class BitflyerExchange extends BaseExchange implements Exchange {

  private SynchronizedValueFactory nonceFactory =
      new AtomicLongIncrementalTime2014NonceFactory();

  @Override
  protected void initServices() {
    this.marketDataService = new BitflyerMarketDataService(this);
    this.accountService = new BitflyerAccountService(this);
    this.tradeService = new BitflyerTradeService(this);
  }

  @Override
  public ExchangeSpecification getDefaultExchangeSpecification() {

    ExchangeSpecification exchangeSpecification =
        new ExchangeSpecification(this.getClass().getCanonicalName());
    exchangeSpecification.setSslUri("https://api.bitflyer.jp/");
    exchangeSpecification.setHost("api.bitflyer.jp");
    exchangeSpecification.setPort(80);
    exchangeSpecification.setExchangeName("BitFlyer");

    return exchangeSpecification;
  }

  @Override
  public SynchronizedValueFactory getNonceFactory() {

    return nonceFactory;
  }

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

    BitflyerMarketDataServiceRaw dataService =
        (BitflyerMarketDataServiceRaw) this.marketDataService;
    List markets = dataService.getMarkets();
    exchangeMetaData = BitflyerAdapters.adaptMetaData(markets);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy