Search in sources :

Example 96 with ExchangeSpecification

use of org.knowm.xchange.ExchangeSpecification in project XChange by knowm.

the class BaseServiceTest method setUpBaseClass.

@BeforeClass
public static void setUpBaseClass() {
    exchangeSpecification = new ExchangeSpecification(HitbtcExchange.class);
    exchange = ExchangeFactory.INSTANCE.createExchange(exchangeSpecification);
}
Also used : ExchangeSpecification(org.knowm.xchange.ExchangeSpecification) BeforeClass(org.junit.BeforeClass)

Example 97 with ExchangeSpecification

use of org.knowm.xchange.ExchangeSpecification in project XChange by knowm.

the class BaseAuthenticatedServiceTest method setUpBaseClass.

@BeforeClass
public static void setUpBaseClass() {
    exchangeSpecification = new ExchangeSpecification(HitbtcExchange.class);
    exchangeSpecification.setApiKey(getApiKey());
    exchangeSpecification.setSecretKey(getSecret());
    exchange = ExchangeFactory.INSTANCE.createExchange(exchangeSpecification);
}
Also used : ExchangeSpecification(org.knowm.xchange.ExchangeSpecification) BeforeClass(org.junit.BeforeClass)

Example 98 with ExchangeSpecification

use of org.knowm.xchange.ExchangeSpecification in project XChange by knowm.

the class GlobitexExchange method getDefaultExchangeSpecification.

@Override
public ExchangeSpecification getDefaultExchangeSpecification() {
    ExchangeSpecification exchangeSpecification = new ExchangeSpecification(this.getClass());
    exchangeSpecification.setSslUri("https://api.globitex.com");
    exchangeSpecification.setHost("api.globitex.com");
    exchangeSpecification.setPort(80);
    exchangeSpecification.setExchangeName("Globitex");
    exchangeSpecification.setExchangeDescription("Globitex is a Bitcoin exchange based in UK.");
    return exchangeSpecification;
}
Also used : ExchangeSpecification(org.knowm.xchange.ExchangeSpecification)

Example 99 with ExchangeSpecification

use of org.knowm.xchange.ExchangeSpecification in project XChange by knowm.

the class RippleServerTrustTest method localServerTest.

/**
 * The recommended method for sending private transactions with a secret key is to use a trusted
 * REST API server, e.g. one running locally.
 */
@Test
public void localServerTest() {
    final ExchangeSpecification specification = new ExchangeSpecification(RippleExchange.class);
    // remove the default api.ripple.com connection
    specification.setSslUri("");
    specification.setPlainTextUri(RippleExchange.REST_API_LOCALHOST_PLAIN_TEXT);
    specification.setSecretKey("s****************************");
    final Exchange exchange = ExchangeFactory.INSTANCE.createExchange(specification);
    assertThat(exchange).isInstanceOf(RippleExchange.class);
    assertThat(exchange.getExchangeSpecification().getSecretKey()).isEqualTo("s****************************");
    assertThat(exchange.getExchangeSpecification().getSslUri()).isEqualTo("");
    assertThat(exchange.getExchangeSpecification().getPlainTextUri()).isEqualTo(RippleExchange.REST_API_LOCALHOST_PLAIN_TEXT);
}
Also used : Exchange(org.knowm.xchange.Exchange) ExchangeSpecification(org.knowm.xchange.ExchangeSpecification) Test(org.junit.Test)

Example 100 with ExchangeSpecification

use of org.knowm.xchange.ExchangeSpecification in project XChange by knowm.

the class RippleServerTrustTest method safetyNetTest.

/**
 * It should not be possible to initialise a RippleExchange with URL https://api.ripple.com/ using
 * a secret key if trust has not been explicitly enabled - an IllegalStateException should be
 * thrown when attempting to create the exchange.
 */
@Test(expected = IllegalStateException.class)
public void safetyNetTest() {
    final ExchangeSpecification specification = new ExchangeSpecification(RippleExchange.class);
    specification.setSslUri(RippleExchange.REST_API_RIPPLE_LABS);
    specification.setSecretKey("s****************************");
    ExchangeFactory.INSTANCE.createExchange(specification);
}
Also used : ExchangeSpecification(org.knowm.xchange.ExchangeSpecification) Test(org.junit.Test)

Aggregations

ExchangeSpecification (org.knowm.xchange.ExchangeSpecification)327 Exchange (org.knowm.xchange.Exchange)93 Test (org.junit.Test)66 IOException (java.io.IOException)22 MarketDataService (org.knowm.xchange.service.marketdata.MarketDataService)20 StreamingExchange (info.bitrich.xchangestream.core.StreamingExchange)17 BigDecimal (java.math.BigDecimal)16 CurrencyPair (org.knowm.xchange.currency.CurrencyPair)16 Before (org.junit.Before)15 CoinsuperExchange (org.knowm.xchange.coinsuper.CoinsuperExchange)15 TradeService (org.knowm.xchange.service.trade.TradeService)14 Disposable (io.reactivex.disposables.Disposable)12 ProductSubscription (info.bitrich.xchangestream.core.ProductSubscription)11 OrderBook (org.knowm.xchange.dto.marketdata.OrderBook)9 LimitOrder (org.knowm.xchange.dto.trade.LimitOrder)9 Ticker (org.knowm.xchange.dto.marketdata.Ticker)8 OkCoinExchange (org.knowm.xchange.okcoin.OkCoinExchange)7 BitcoiniumExchange (org.knowm.xchange.bitcoinium.BitcoiniumExchange)6 CoinfloorExchange (org.knowm.xchange.coinfloor.CoinfloorExchange)6 DVChainExchange (org.knowm.xchange.dvchain.DVChainExchange)6