Search in sources :

Example 1 with KrakenExchange

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);
}
Also used : KrakenExchange(org.knowm.xchange.kraken.KrakenExchange) Exchange(org.knowm.xchange.Exchange)

Example 2 with 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;
}
Also used : KrakenExchange(org.knowm.xchange.kraken.KrakenExchange) Exchange(org.knowm.xchange.Exchange)

Example 3 with 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"));
    });
}
Also used : BitstampExchange(org.knowm.xchange.bitstamp.BitstampExchange) KrakenExchange(org.knowm.xchange.kraken.KrakenExchange) Exchange(org.knowm.xchange.Exchange) KrakenExchange(org.knowm.xchange.kraken.KrakenExchange) Test(org.junit.jupiter.api.Test)

Example 4 with KrakenExchange

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"));
    });
}
Also used : BitstampExchange(org.knowm.xchange.bitstamp.BitstampExchange) KrakenExchange(org.knowm.xchange.kraken.KrakenExchange) Exchange(org.knowm.xchange.Exchange) KrakenExchange(org.knowm.xchange.kraken.KrakenExchange) ExchangeSpecification(org.knowm.xchange.ExchangeSpecification) BitstampExchange(org.knowm.xchange.bitstamp.BitstampExchange) Test(org.junit.jupiter.api.Test)

Example 5 with KrakenExchange

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);
}
Also used : KrakenExchange(org.knowm.xchange.kraken.KrakenExchange) Exchange(org.knowm.xchange.Exchange)

Aggregations

Exchange (org.knowm.xchange.Exchange)8 KrakenExchange (org.knowm.xchange.kraken.KrakenExchange)8 Test (org.junit.jupiter.api.Test)2 BitstampExchange (org.knowm.xchange.bitstamp.BitstampExchange)2 ExchangeSpecification (org.knowm.xchange.ExchangeSpecification)1 KrakenAssets (org.knowm.xchange.kraken.dto.marketdata.KrakenAssets)1 KrakenServerTime (org.knowm.xchange.kraken.dto.marketdata.KrakenServerTime)1 KrakenSpreads (org.knowm.xchange.kraken.dto.marketdata.KrakenSpreads)1 KrakenMarketDataServiceRaw (org.knowm.xchange.kraken.service.KrakenMarketDataServiceRaw)1