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);
}
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);
}
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);
}
}
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;
}
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;
}
Aggregations