Search in sources :

Example 6 with ExchangeSpecification

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

the class CoinfloorUserTradesIntegration method fetchUserTradesTest.

@Test
public void fetchUserTradesTest() throws IOException {
    final ExchangeSpecification specification = new ExchangeSpecification(CoinfloorExchange.class);
    String username = System.getProperty("xchange.coinfloor.username");
    String password = System.getProperty("xchange.coinfloor.password");
    if (username == null || password == null) {
        return;
    }
    specification.setUserName(username);
    specification.setPassword(password);
    Exchange exchange = ExchangeFactory.INSTANCE.createExchange(specification);
    TradeService service = exchange.getTradeService();
    CoinfloorTradeHistoryParams params = (CoinfloorTradeHistoryParams) service.createTradeHistoryParams();
    UserTrades trades = service.getTradeHistory(params);
    logger.info("{}", trades);
}
Also used : CoinfloorExchange(org.knowm.xchange.coinfloor.CoinfloorExchange) Exchange(org.knowm.xchange.Exchange) UserTrades(org.knowm.xchange.dto.trade.UserTrades) TradeService(org.knowm.xchange.service.trade.TradeService) ExchangeSpecification(org.knowm.xchange.ExchangeSpecification) Test(org.junit.Test)

Example 7 with ExchangeSpecification

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

the class CoinfloorBalanceIntegration method fetchBalanceTest.

@Test
public void fetchBalanceTest() throws IOException {
    final ExchangeSpecification specification = new ExchangeSpecification(CoinfloorExchange.class);
    String username = System.getProperty("xchange.coinfloor.username");
    String password = System.getProperty("xchange.coinfloor.password");
    if (username == null || password == null) {
        return;
    }
    specification.setUserName(username);
    specification.setPassword(password);
    Exchange exchange = ExchangeFactory.INSTANCE.createExchange(specification);
    AccountService service = exchange.getAccountService();
    AccountInfo info = service.getAccountInfo();
    logger.info("{}", info);
}
Also used : CoinfloorExchange(org.knowm.xchange.coinfloor.CoinfloorExchange) Exchange(org.knowm.xchange.Exchange) ExchangeSpecification(org.knowm.xchange.ExchangeSpecification) AccountService(org.knowm.xchange.service.account.AccountService) AccountInfo(org.knowm.xchange.dto.account.AccountInfo) Test(org.junit.Test)

Example 8 with ExchangeSpecification

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

the class CoinfloorCancelOrderIntegration method cancelOpenOrdersTest.

@Test
public void cancelOpenOrdersTest() throws IOException {
    final ExchangeSpecification specification = new ExchangeSpecification(CoinfloorExchange.class);
    String username = System.getProperty("xchange.coinfloor.username");
    String password = System.getProperty("xchange.coinfloor.password");
    if (username == null || password == null) {
        return;
    }
    specification.setUserName(username);
    specification.setPassword(password);
    Exchange exchange = ExchangeFactory.INSTANCE.createExchange(specification);
    TradeService service = exchange.getTradeService();
    // fetch open orders
    CoinfloorOpenOrdersParams params = (CoinfloorOpenOrdersParams) service.createOpenOrdersParams();
    OpenOrders openOrders = service.getOpenOrders(params);
    // cancel one order
    if (openOrders.getOpenOrders().size() > 0) {
        LimitOrder order = openOrders.getOpenOrders().iterator().next();
        boolean success = service.cancelOrder(order.getId());
        logger.info("cancel of order={} success={}", order, success);
    }
}
Also used : CoinfloorExchange(org.knowm.xchange.coinfloor.CoinfloorExchange) Exchange(org.knowm.xchange.Exchange) TradeService(org.knowm.xchange.service.trade.TradeService) ExchangeSpecification(org.knowm.xchange.ExchangeSpecification) OpenOrders(org.knowm.xchange.dto.trade.OpenOrders) LimitOrder(org.knowm.xchange.dto.trade.LimitOrder) Test(org.junit.Test)

Example 9 with ExchangeSpecification

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

the class CmcExchange method getDefaultExchangeSpecification.

@Override
public ExchangeSpecification getDefaultExchangeSpecification() {
    final ExchangeSpecification defaultSpec = new ExchangeSpecification(getClass());
    defaultSpec.setSslUri("https://pro-api.coinmarketcap.com");
    defaultSpec.setHost("coinmarketcap.com");
    defaultSpec.setExchangeName("CoinMarketCap");
    defaultSpec.setExchangeDescription("Cryptocurrency market cap rankings, charts, and more.");
    AuthUtils.setApiAndSecretKey(defaultSpec, "coinmarketcap");
    return defaultSpec;
}
Also used : ExchangeSpecification(org.knowm.xchange.ExchangeSpecification)

Example 10 with ExchangeSpecification

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

the class CmcExchange method getSandboxExchangeSpecification.

public ExchangeSpecification getSandboxExchangeSpecification() {
    final ExchangeSpecification sandboxSpec = new ExchangeSpecification(getClass());
    sandboxSpec.setSslUri("https://sandbox-api.coinmarketcap.com");
    sandboxSpec.setHost("coinmarketcap.com");
    sandboxSpec.setExchangeName("CoinMarketCap Sandbox");
    sandboxSpec.setExchangeDescription("Cryptocurrency market cap rankings, charts, and more.");
    AuthUtils.setApiAndSecretKey(sandboxSpec, "coinmarketcap-sandbox");
    return sandboxSpec;
}
Also used : ExchangeSpecification(org.knowm.xchange.ExchangeSpecification)

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