use of org.knowm.xchange.Exchange 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);
}
use of org.knowm.xchange.Exchange 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);
}
}
use of org.knowm.xchange.Exchange in project XChange by knowm.
the class CoinfloorOrderBookIntegration method fetchOrderBookTest.
@Test
public void fetchOrderBookTest() throws IOException {
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(CoinfloorExchange.class);
MarketDataService service = exchange.getMarketDataService();
OrderBook orderBook = service.getOrderBook(CurrencyPair.BTC_GBP);
assertThat(orderBook.getBids()).isNotEmpty();
assertThat(orderBook.getAsks()).isNotEmpty();
LimitOrder order = orderBook.getBids().get(0);
assertThat(order.getCurrencyPair()).isEqualTo(CurrencyPair.BTC_GBP);
assertThat(order.getOriginalAmount()).isGreaterThan(BigDecimal.ZERO);
assertThat(order.getLimitPrice()).isGreaterThan(BigDecimal.ZERO);
}
use of org.knowm.xchange.Exchange in project XChange by knowm.
the class KucoinAccountDemo method main.
public static void main(String[] args) throws IOException {
Exchange exchange = KucoinExamplesUtils.getExchange();
AccountService accountService = exchange.getAccountService();
generic(accountService);
raw((KucoinAccountServiceRaw) accountService);
}
use of org.knowm.xchange.Exchange in project XChange by knowm.
the class KucoinTradeHistoryDemo method main.
public static void main(String[] args) throws Exception {
Exchange exchange = KucoinExamplesUtils.getExchange();
TradeService tradeService = exchange.getTradeService();
getRecentTrades(tradeService);
// getHistoricalTrades(tradeService); // historical trades API endpoint not supported on
// Sandbox
getPagedTrades(tradeService);
}
Aggregations