use of org.knowm.xchange.ExchangeSpecification in project XChange by knowm.
the class CoinbaseProStreamingExchangeTest method testOverrideWebsocketApiUri.
@Test
public void testOverrideWebsocketApiUri() {
final String overrideWebsocketApiUri = "wss://demo.websocket.com";
final CoinbaseProStreamingExchange coinbaseProStreamingExchange = new CoinbaseProStreamingExchange();
final ExchangeSpecification sandboxExchangeSpecification = coinbaseProStreamingExchange.getDefaultExchangeSpecification();
sandboxExchangeSpecification.setExchangeSpecificParametersItem(Parameters.PARAM_USE_SANDBOX, false);
sandboxExchangeSpecification.setExchangeSpecificParametersItem(Parameters.PARAM_USE_PRIME, false);
sandboxExchangeSpecification.setOverrideWebsocketApiUri(overrideWebsocketApiUri);
sandboxExchangeSpecification.setShouldLoadRemoteMetaData(false);
final CoinbaseProStreamingExchange exchange = (CoinbaseProStreamingExchange) StreamingExchangeFactory.INSTANCE.createExchange(sandboxExchangeSpecification);
assertThat(exchange.getApiUri()).isEqualTo(overrideWebsocketApiUri);
assertThat(exchange.getExchangeSpecification().getOverrideWebsocketApiUri()).isEqualTo(overrideWebsocketApiUri);
}
use of org.knowm.xchange.ExchangeSpecification in project XChange by knowm.
the class CoinbaseProStreamingExchangeTest method testWhenUsingSandboxWithPrime.
@Test
public void testWhenUsingSandboxWithPrime() {
final String primeSandboxApiUri = "wss://ws-feed-public.sandbox.exchange.coinbase.com";
final CoinbaseProStreamingExchange coinbaseProStreamingExchange = new CoinbaseProStreamingExchange();
final ExchangeSpecification sandboxExchangeSpecification = coinbaseProStreamingExchange.getDefaultExchangeSpecification();
sandboxExchangeSpecification.setExchangeSpecificParametersItem(Parameters.PARAM_USE_SANDBOX, true);
sandboxExchangeSpecification.setExchangeSpecificParametersItem(Parameters.PARAM_USE_PRIME, true);
sandboxExchangeSpecification.setShouldLoadRemoteMetaData(false);
final CoinbaseProStreamingExchange exchange = (CoinbaseProStreamingExchange) StreamingExchangeFactory.INSTANCE.createExchange(sandboxExchangeSpecification);
assertThat(exchange.getApiUri()).isEqualTo(primeSandboxApiUri);
assertThat(exchange.getExchangeSpecification().getOverrideWebsocketApiUri()).isEqualTo(null);
}
use of org.knowm.xchange.ExchangeSpecification in project XChange by knowm.
the class BinanceUsExchangeIntegration method createExchange.
protected static void createExchange() throws Exception {
exchange = ExchangeFactory.INSTANCE.createExchangeWithoutSpecification(BinanceUsExchange.class);
ExchangeSpecification spec = exchange.getDefaultExchangeSpecification();
boolean useSandbox = Boolean.parseBoolean(System.getProperty(BinanceExchange.SPECIFIC_PARAM_USE_SANDBOX, Boolean.FALSE.toString()));
spec.setExchangeSpecificParametersItem(BinanceExchange.SPECIFIC_PARAM_USE_SANDBOX, useSandbox);
exchange.applySpecification(spec);
}
use of org.knowm.xchange.ExchangeSpecification in project XChange by knowm.
the class BinanceExchangeIntegration method createExchangeMocked.
protected BinanceExchange createExchangeMocked() {
BinanceExchange exchangeMocked = ExchangeFactory.INSTANCE.createExchangeWithoutSpecification(BinanceExchange.class);
ExchangeSpecification specification = exchangeMocked.getDefaultExchangeSpecification();
specification.setHost("localhost");
specification.setSslUri("http://localhost:" + wireMockRule.port() + "/");
specification.setPort(wireMockRule.port());
specification.setShouldLoadRemoteMetaData(false);
exchangeMocked.applySpecification(specification);
return exchangeMocked;
}
use of org.knowm.xchange.ExchangeSpecification in project XChange by knowm.
the class BinanceExchangeIntegration method createExchange.
protected static void createExchange() throws Exception {
exchange = ExchangeFactory.INSTANCE.createExchangeWithoutSpecification(BinanceExchange.class);
ExchangeSpecification spec = exchange.getDefaultExchangeSpecification();
boolean useSandbox = Boolean.parseBoolean(System.getProperty(BinanceExchange.SPECIFIC_PARAM_USE_SANDBOX, Boolean.FALSE.toString()));
spec.setExchangeSpecificParametersItem(BinanceExchange.SPECIFIC_PARAM_USE_SANDBOX, useSandbox);
exchange.applySpecification(spec);
}
Aggregations