org.knowm.xchange.ExchangeFactory Java Examples

The following examples show how to use org.knowm.xchange.ExchangeFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReactiveKnowmExchangeProvider.java    From consensusj with Apache License 2.0 6 votes vote down vote up
private synchronized void initialize()  {
    if (!initialized) {
        log.info("initializing, calling createExchange()");
        // createExchange w/o exchangeSpecification does a remote initialization that takes approximately 1.5 seconds
        if (exchangeSpecification != null) {
            exchange = ExchangeFactory.INSTANCE.createExchange(exchangeSpecification);
        } else {
            exchange = ExchangeFactory.INSTANCE.createExchange(exchangeClassName);
        }
        log.info("initializing, getting name");
        name = exchange.getExchangeSpecification().getExchangeName();
        providerContext = ProviderContext.of(name, RateType.DEFERRED);
        marketDataService = exchange.getMarketDataService();
        initialized = true;
        log.info("initialized");
    }
    log.info("exiting");
}
 
Example #2
Source File: ExchangeRateUpdater.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public ExchangeRateUpdater(Currency baseCurrency, ExchangeRateStorage priceStorage) {
    this.storage = priceStorage;
    this.baseCurrencyBtcPair = new CurrencyPair(baseCurrency, Currency.BTC);

    exchanges = new HashMap<>();
    exchanges.put(baseCurrencyBtcPair, ExchangeFactory.INSTANCE.createExchange(BitfinexExchange.class.getName()));
    exchanges.put(CurrencyPair.BTC_USD, ExchangeFactory.INSTANCE.createExchange(BitfinexExchange.class.getName()));
    exchanges.put(CurrencyPair.BTC_EUR, ExchangeFactory.INSTANCE.createExchange(BitstampExchange.class.getName()));
    exchanges.put(CurrencyPair.BTC_CNY, ExchangeFactory.INSTANCE.createExchange(OkCoinExchange.class.getName()));

    // add more currencies/exchange pairs (btc/fiat) here
}
 
Example #3
Source File: ExchangeRateUpdater.java    From android-wallet-app with GNU General Public License v3.0 5 votes vote down vote up
public ExchangeRateUpdater(Currency baseCurrency, ExchangeRateStorage priceStorage) {
    this.storage = priceStorage;
    this.baseCurrencyBtcPair = new CurrencyPair(baseCurrency, Currency.BTC);

    exchanges = new HashMap<>();
    exchanges.put(baseCurrencyBtcPair, ExchangeFactory.INSTANCE.createExchange(BitfinexExchange.class.getName()));
    exchanges.put(CurrencyPair.BTC_USD, ExchangeFactory.INSTANCE.createExchange(BitfinexExchange.class.getName()));
    exchanges.put(CurrencyPair.BTC_EUR, ExchangeFactory.INSTANCE.createExchange(BitstampExchange.class.getName()));
    exchanges.put(CurrencyPair.BTC_CNY, ExchangeFactory.INSTANCE.createExchange(OkCoinExchange.class.getName()));

    // add more currencies/exchange pairs (btc/fiat) here
}
 
Example #4
Source File: KnowmExchangeRateProvider.java    From consensusj with Apache License 2.0 5 votes vote down vote up
public synchronized void initialize()  {
    if (!initialized) {
        initialized = true;
        exchange = ExchangeFactory.INSTANCE.createExchange(exchangeClassName);
        name = exchange.getExchangeSpecification().getExchangeName();
        providerContext = ProviderContext.of(name, RateType.DEFERRED);
        marketDataService = exchange.getMarketDataService();
    }
}