use of org.knowm.xchange.Exchange in project XChange by knowm.
the class TickerFetchIntegration method tickerFetchTest.
@Test
public void tickerFetchTest() throws Exception {
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(BitsoExchange.class);
exchange.remoteInit();
MarketDataService marketDataService = exchange.getMarketDataService();
Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_MXN);
System.out.println(ticker.toString());
assertThat(ticker).isNotNull();
}
use of org.knowm.xchange.Exchange in project XChange by knowm.
the class CoinfloorPlaceMarketOrderIntegration method placeMarketOrderTest.
@Test
public void placeMarketOrderTest() 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);
CoinfloorTradeServiceRaw rawService = (CoinfloorTradeServiceRaw) exchange.getTradeService();
CoinfloorMarketOrderResponse order = rawService.placeMarketOrder(CurrencyPair.BTC_EUR, OrderType.ASK, new BigDecimal("0.0001"));
logger.info("placed market order with remainingQty={}", order.getRemaining());
}
use of org.knowm.xchange.Exchange in project XChange by knowm.
the class CoinfloorPublicTradesIntegration method fetchTransactionTest.
@Test
public void fetchTransactionTest() throws IOException {
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(CoinfloorExchange.class);
MarketDataService service = exchange.getMarketDataService();
Trades trades = service.getTrades(CurrencyPair.BTC_GBP, CoinfloorInterval.HOUR);
assertThat(trades.getTrades()).isNotEmpty();
int tradeCount = trades.getTrades().size();
Trade mostRecentTrade = trades.getTrades().get(tradeCount - 1);
assertThat(mostRecentTrade.getPrice()).isGreaterThan(BigDecimal.ZERO);
assertThat(mostRecentTrade.getOriginalAmount()).isGreaterThan(BigDecimal.ZERO);
assertThat(trades.getlastID()).isEqualTo(Long.parseLong(mostRecentTrade.getId()));
}
use of org.knowm.xchange.Exchange in project XChange by knowm.
the class CoinfloorTickerIntegration method fetchTickerTest.
@Test
public void fetchTickerTest() throws IOException {
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(CoinfloorExchange.class);
MarketDataService service = exchange.getMarketDataService();
Ticker ticker = service.getTicker(CurrencyPair.BTC_GBP);
assertThat(ticker.getCurrencyPair()).isEqualTo(CurrencyPair.BTC_GBP);
assertThat(ticker.getLast()).isGreaterThan(BigDecimal.ZERO);
assertThat(ticker.getHigh()).isGreaterThan(BigDecimal.ZERO);
assertThat(ticker.getLow()).isGreaterThan(BigDecimal.ZERO);
assertThat(ticker.getVwap()).isGreaterThan(BigDecimal.ZERO);
assertThat(ticker.getVolume()).isGreaterThan(BigDecimal.ZERO);
assertThat(ticker.getBid()).isGreaterThan(BigDecimal.ZERO);
assertThat(ticker.getAsk()).isGreaterThan(BigDecimal.ZERO);
}
use of org.knowm.xchange.Exchange 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);
}
Aggregations