use of org.knowm.xchange.kraken.KrakenExchange in project XChange by knowm.
the class KrakenTradesDemo method main.
public static void main(String[] args) throws IOException {
// Use the factory to get Kraken exchange API using default settings
Exchange krakenExchange = ExchangeFactory.INSTANCE.createExchange(KrakenExchange.class);
generic(krakenExchange);
// raw(krakenExchange);
}
use of org.knowm.xchange.kraken.KrakenExchange in project XChange by knowm.
the class KrakenExampleUtils method createTestExchange.
public static Exchange createTestExchange() {
Exchange krakenExchange = ExchangeFactory.INSTANCE.createExchange(KrakenExchange.class);
krakenExchange.getExchangeSpecification().setApiKey("API Key");
krakenExchange.getExchangeSpecification().setSecretKey("Secret==");
krakenExchange.getExchangeSpecification().setUserName("user");
krakenExchange.applySpecification(krakenExchange.getExchangeSpecification());
return krakenExchange;
}
use of org.knowm.xchange.kraken.KrakenExchange in project bitcoin-spring-boot-starter by theborakompanioni.
the class XChangeAutoConfigurationTest method beansAreAutoCreatedMinimalProperties.
@Test
public void beansAreAutoCreatedMinimalProperties() {
this.contextRunner.withUserConfiguration(XChangeAutoConfiguration.class).withPropertyValues("org.tbk.xchange.enabled=true", "org.tbk.xchange.specifications.exampleExchange.exchangeClass=org.knowm.xchange.kraken.KrakenExchange").run(context -> {
Map<String, Exchange> beans = context.getBeansOfType(Exchange.class);
assertThat(beans.values(), hasSize(1));
assertThat(context.containsBean("exampleExchange"), is(true));
KrakenExchange exampleExchange = context.getBean("exampleExchange", KrakenExchange.class);
assertThat(exampleExchange, is(beans.get("exampleExchange")));
assertThat(exampleExchange.getExchangeSpecification().getSslUri(), is("https://api.kraken.com"));
});
}
use of org.knowm.xchange.kraken.KrakenExchange in project bitcoin-spring-boot-starter by theborakompanioni.
the class XChangeAutoConfigurationTest method propertiesAreParsedSuccessfully.
@Test
public void propertiesAreParsedSuccessfully() {
this.contextRunner.withUserConfiguration(XChangeAutoConfiguration.class).withPropertyValues("org.tbk.xchange.enabled=true", // first exchange
"org.tbk.xchange.specifications.firstTestExchange.exchangeClass=org.knowm.xchange.kraken.KrakenExchange", "org.tbk.xchange.specifications.firstTestExchange.exchangeName=Kraken", "org.tbk.xchange.specifications.firstTestExchange.exchangeDescription=Custom Kraken Exchange", "org.tbk.xchange.specifications.firstTestExchange.userName=any", "org.tbk.xchange.specifications.firstTestExchange.password=any", "org.tbk.xchange.specifications.firstTestExchange.secretKey=any", "org.tbk.xchange.specifications.firstTestExchange.apiKey=any", "org.tbk.xchange.specifications.firstTestExchange.shouldLoadRemoteMetaData=false", "org.tbk.xchange.specifications.firstTestExchange.resilience.retryEnabled=true", "org.tbk.xchange.specifications.firstTestExchange.resilience.rateLimiterEnabled=false", // second exchange
"org.tbk.xchange.specifications.secondTestExchange.exchangeClass=org.knowm.xchange.bitstamp.BitstampExchange", "org.tbk.xchange.specifications.secondTestExchange.exchangeName=Bitstamp", "org.tbk.xchange.specifications.secondTestExchange.exchangeDescription=Custom Bitstamp Exchange", "org.tbk.xchange.specifications.secondTestExchange.httpConnTimeout=30000", "org.tbk.xchange.specifications.secondTestExchange.httpReadTimeout=100000", "org.tbk.xchange.specifications.secondTestExchange.shouldLoadRemoteMetaData=false", "org.tbk.xchange.specifications.secondTestExchange.resilience.retryEnabled=true", "org.tbk.xchange.specifications.secondTestExchange.resilience.rateLimiterEnabled=true").run(context -> {
XChangeAutoConfigProperties bean = context.getBean(XChangeAutoConfigProperties.class);
assertThat(bean, is(notNullValue()));
assertThat(bean.isEnabled(), is(true));
assertThat(bean.getSpecifications().values(), hasSize(2));
bean.getSpecifications().forEach((beanName, spec) -> {
assertThat("bean with specified name has been created", context.containsBean(beanName), is(true));
});
Map<String, Exchange> beans = context.getBeansOfType(Exchange.class);
assertThat(beans.values(), hasSize(2));
KrakenExchange firstTestExchange = context.getBean("firstTestExchange", KrakenExchange.class);
assertThat(firstTestExchange, is(beans.get("firstTestExchange")));
ExchangeSpecification firstTestExchangeSpec = firstTestExchange.getExchangeSpecification();
assertThat(firstTestExchangeSpec.getSslUri(), is("https://api.kraken.com"));
assertThat(firstTestExchangeSpec.getExchangeDescription(), is("Custom Kraken Exchange"));
BitstampExchange secondTestExchange = context.getBean("secondTestExchange", BitstampExchange.class);
assertThat(secondTestExchange, is(beans.get("secondTestExchange")));
ExchangeSpecification secondTestExchangeSpec = secondTestExchange.getExchangeSpecification();
assertThat(secondTestExchangeSpec.getSslUri(), is("https://www.bitstamp.net"));
assertThat(secondTestExchangeSpec.getExchangeDescription(), is("Custom Bitstamp Exchange"));
});
}
use of org.knowm.xchange.kraken.KrakenExchange in project XChange by knowm.
the class KrakenDepthDemo method main.
public static void main(String[] args) throws IOException {
// Use the factory to get Kraken exchange API using default settings
Exchange krakenExchange = ExchangeFactory.INSTANCE.createExchange(KrakenExchange.class);
generic(krakenExchange);
raw(krakenExchange);
}
Aggregations