CoinbaseProExchange extends BaseExchange { @Override public ExchangeSpecification getDefaultExchangeSpecification() { ExchangeSpecification exchangeSpecification = new ExchangeSpecification(this.getClass()); exchangeSpecification.setSslUri("https: exchangeSpecification.setHost("api.pro.coinbase.com"); exchangeSpecification.setPort(80); exchangeSpecification.setExchangeName("CoinbasePro"); exchangeSpecification.setExchangeDescription( "CoinbasePro Exchange is a Bitcoin exchange, re-branded from GDAX in 2018"); exchangeSpecification.setExchangeSpecificParametersItem(PARAM_USE_SANDBOX, false); exchangeSpecification.setExchangeSpecificParametersItem( PARAM_SANDBOX_SSL_URI, "https: exchangeSpecification.setExchangeSpecificParametersItem( PARAM_SANDBOX_HOST, "api-public.sandbox.pro.coinbase.com"); exchangeSpecification.setExchangeSpecificParametersItem( PARAM_PRIME_SSL_URI, "https: exchangeSpecification.setExchangeSpecificParametersItem( PARAM_PRIME_HOST, "api.prime.coinbase.com"); exchangeSpecification.setExchangeSpecificParametersItem( PARAM_SANDBOX_PRIME_SSL_URI, "https: exchangeSpecification.setExchangeSpecificParametersItem( PARAM_SANDBOX_PRIME_HOST, "api-public.sandbox.prime.coinbase.com"); return exchangeSpecification; }  @Override void applySpecification(ExchangeSpecification exchangeSpecification); @Override ExchangeSpecification getDefaultExchangeSpecification(); @Override SynchronizedValueFactory<Long> getNonceFactory(); @Override void remoteInit();  }
@Test public void testCreateExchangeSandboxShouldApplyDefaultSandboxParams() { final CoinbaseProExchange coinbaseProExchange = new CoinbaseProExchange(); final ExchangeSpecification sandboxExchangeSpecification = coinbaseProExchange.getDefaultExchangeSpecification(); sandboxExchangeSpecification.setExchangeSpecificParametersItem(PARAM_USE_SANDBOX, true); sandboxExchangeSpecification.setShouldLoadRemoteMetaData(false); final Exchange exchange = ExchangeFactory.INSTANCE.createExchange(sandboxExchangeSpecification); assertThat(exchange.getExchangeSpecification().getSslUri()) .isEqualTo("https: assertThat(exchange.getExchangeSpecification().getHost()) .isEqualTo("api-public.sandbox.pro.coinbase.com"); }
@Test public void testCreateExchangePrimeShouldApplyDefaultPrimeParams() { final CoinbaseProExchange coinbaseProExchange = new CoinbaseProExchange(); final ExchangeSpecification primeExchangeSpecification = coinbaseProExchange.getDefaultExchangeSpecification(); primeExchangeSpecification.setExchangeSpecificParametersItem(PARAM_USE_PRIME, true); primeExchangeSpecification.setShouldLoadRemoteMetaData(false); final Exchange exchange = ExchangeFactory.INSTANCE.createExchange(primeExchangeSpecification); assertThat(exchange.getExchangeSpecification().getSslUri()) .isEqualTo("https: assertThat(exchange.getExchangeSpecification().getHost()).isEqualTo("api.prime.coinbase.com"); }
@Test public void testCreateExchangeSandboxPrimeShouldApplyDefaultSandboxPrimeParams() { final CoinbaseProExchange coinbaseProExchange = new CoinbaseProExchange(); final ExchangeSpecification sandboxPrimeExchangeSpecification = coinbaseProExchange.getDefaultExchangeSpecification(); sandboxPrimeExchangeSpecification.setExchangeSpecificParametersItem(PARAM_USE_PRIME, true); sandboxPrimeExchangeSpecification.setExchangeSpecificParametersItem(PARAM_USE_SANDBOX, true); sandboxPrimeExchangeSpecification.setShouldLoadRemoteMetaData(false); final Exchange exchange = ExchangeFactory.INSTANCE.createExchange(sandboxPrimeExchangeSpecification); assertThat(exchange.getExchangeSpecification().getSslUri()) .isEqualTo("https: assertThat(exchange.getExchangeSpecification().getHost()) .isEqualTo("api-public.sandbox.prime.coinbase.com"); }
@Test public void testCreateExchangeShouldApplyGivenSpecification() { final CoinbaseProExchange coinbaseProExchange = new CoinbaseProExchange(); final ExchangeSpecification customExchangeSpecification = coinbaseProExchange.getDefaultExchangeSpecification(); customExchangeSpecification.setSslUri("https: customExchangeSpecification.setHost("custom-server.pro.coinbase.com"); customExchangeSpecification.setShouldLoadRemoteMetaData(false); final Exchange exchange = ExchangeFactory.INSTANCE.createExchange(customExchangeSpecification); assertThat(exchange.getExchangeSpecification().getSslUri()) .isEqualTo("https: assertThat(exchange.getExchangeSpecification().getHost()) .isEqualTo("custom-server.pro.coinbase.com"); }
@Test public void testCreateExchangeSandboxShouldApplySandboxParams() { final CoinbaseProExchange coinbaseProExchange = new CoinbaseProExchange(); final ExchangeSpecification customExchangeSpecification = coinbaseProExchange.getDefaultExchangeSpecification(); customExchangeSpecification.setShouldLoadRemoteMetaData(false); customExchangeSpecification.setExchangeSpecificParametersItem(PARAM_USE_SANDBOX, true); customExchangeSpecification.setExchangeSpecificParametersItem( PARAM_SANDBOX_SSL_URI, "https: customExchangeSpecification.setExchangeSpecificParametersItem( PARAM_SANDBOX_HOST, "custom-server.sandbox.pro.coinbase.com"); final Exchange exchange = ExchangeFactory.INSTANCE.createExchange(customExchangeSpecification); assertThat(exchange.getExchangeSpecification().getSslUri()) .isEqualTo("https: assertThat(exchange.getExchangeSpecification().getHost()) .isEqualTo("custom-server.sandbox.pro.coinbase.com"); }
@Test public void testCreateExchangePrimeShouldApplyPrimeParams() { final CoinbaseProExchange coinbaseProExchange = new CoinbaseProExchange(); final ExchangeSpecification customExchangeSpecification = coinbaseProExchange.getDefaultExchangeSpecification(); customExchangeSpecification.setShouldLoadRemoteMetaData(false); customExchangeSpecification.setExchangeSpecificParametersItem(PARAM_USE_PRIME, true); customExchangeSpecification.setExchangeSpecificParametersItem( PARAM_PRIME_SSL_URI, "https: customExchangeSpecification.setExchangeSpecificParametersItem( PARAM_PRIME_HOST, "custom-server.prime.pro.coinbase.com"); final Exchange exchange = ExchangeFactory.INSTANCE.createExchange(customExchangeSpecification); assertThat(exchange.getExchangeSpecification().getSslUri()) .isEqualTo("https: assertThat(exchange.getExchangeSpecification().getHost()) .isEqualTo("custom-server.prime.pro.coinbase.com"); }
@Test public void testCreateExchangeSandboxPrimeShouldApplySandboxPrimeParams() { final CoinbaseProExchange coinbaseProExchange = new CoinbaseProExchange(); final ExchangeSpecification customExchangeSpecification = coinbaseProExchange.getDefaultExchangeSpecification(); customExchangeSpecification.setShouldLoadRemoteMetaData(false); customExchangeSpecification.setExchangeSpecificParametersItem(PARAM_USE_PRIME, true); customExchangeSpecification.setExchangeSpecificParametersItem(PARAM_USE_SANDBOX, true); customExchangeSpecification.setExchangeSpecificParametersItem( PARAM_SANDBOX_PRIME_SSL_URI, "https: customExchangeSpecification.setExchangeSpecificParametersItem( PARAM_SANDBOX_PRIME_HOST, "custom-server.sandbox.prime.pro.coinbase.com"); final Exchange exchange = ExchangeFactory.INSTANCE.createExchange(customExchangeSpecification); assertThat(exchange.getExchangeSpecification().getSslUri()) .isEqualTo("https: assertThat(exchange.getExchangeSpecification().getHost()) .isEqualTo("custom-server.sandbox.prime.pro.coinbase.com"); }