use of org.knowm.xchange.service.trade.TradeService in project XChange by knowm.
the class TradeServiceIntegrationTransactionsCreateOrder method getTradeHistory.
private static void getTradeHistory() throws IOException {
String apiKey = "00af0b38-11fb-4aab-bf19-45edd44a4adc";
String secretKey = "fa3f0510-155f-4567-a3b3-3f386080efa3";
Exchange coinsuper = ExchangeFactory.INSTANCE.createExchange(CoinsuperExchange.class);
ExchangeSpecification exchangeSpecification = coinsuper.getExchangeSpecification();
exchangeSpecification.setApiKey(apiKey);
exchangeSpecification.setSecretKey(secretKey);
coinsuper.applySpecification(exchangeSpecification);
TradeService tradeService = coinsuper.getTradeService();
try {
String orderNoList = "1608755608149188609,1608755698308898817";
CoinsuperTradeHistoryParams params = (CoinsuperTradeHistoryParams) tradeService.createTradeHistoryParams();
params.setOrderNoList(orderNoList);
Trades trades = tradeService.getTradeHistory(params);
System.out.println(trades);
System.out.printf("Open Orders for %s: %s%n", orderNoList, trades);
} catch (IOException e) {
e.printStackTrace();
}
}
use of org.knowm.xchange.service.trade.TradeService in project XChange by knowm.
the class TradeServiceIntegrationTransactionsCreateOrder method createLimitOrder.
private static void createLimitOrder() throws IOException {
String apiKey = "00af0b38-11fb-4aab-bf19-45edd44a4adc";
String secretKey = "fa3f0510-155f-4567-a3b3-3f386080efa3";
Exchange coinsuper = ExchangeFactory.INSTANCE.createExchange(CoinsuperExchange.class);
ExchangeSpecification exchangeSpecification = coinsuper.getExchangeSpecification();
exchangeSpecification.setApiKey(apiKey);
exchangeSpecification.setSecretKey(secretKey);
coinsuper.applySpecification(exchangeSpecification);
TradeService tradeService = coinsuper.getTradeService();
try {
// place a limit buy order
LimitOrder limitOrder = new LimitOrder((OrderType.ASK), // qty
new BigDecimal("1.5"), CurrencyPair.ETH_BTC, null, null, new BigDecimal("0.08000000"));
String limitOrderReturnValue = tradeService.placeLimitOrder(limitOrder);
System.out.println("======createLimitOrder======");
System.out.println("Limit Order return order id: " + limitOrderReturnValue);
} catch (IOException e) {
e.printStackTrace();
}
}
use of org.knowm.xchange.service.trade.TradeService in project XChange by knowm.
the class DVChainExchangeIntegration method testMarketOrder.
@Test
public void testMarketOrder() {
final Exchange exchange = ExchangeFactory.INSTANCE.createExchange(DVChainExchange.class, secret, secret);
ExchangeSpecification exchangeSpecification = exchange.getExchangeSpecification();
exchangeSpecification.setSslUri("https://sandbox.trade.dvchain.co");
exchangeSpecification.setHost("sandbox.trade.dvchain.co");
exchange.applySpecification(exchangeSpecification);
TradeService tradeService = exchange.getTradeService();
try {
String order = tradeService.placeMarketOrder(new MarketOrder(Order.OrderType.BID, new BigDecimal(1), new CurrencyPair("BTC", "USD")));
assertNotNull(order);
} catch (Exception exception) {
System.out.println(exception.getMessage());
assert (false);
}
}
use of org.knowm.xchange.service.trade.TradeService in project XChange by knowm.
the class DVChainExchangeIntegration method testTrades.
@Test
public void testTrades() {
final Exchange exchange = ExchangeFactory.INSTANCE.createExchange(DVChainExchange.class, secret, secret);
ExchangeSpecification exchangeSpecification = exchange.getExchangeSpecification();
exchangeSpecification.setSslUri("https://sandbox.trade.dvchain.co");
exchangeSpecification.setHost("sandbox.trade.dvchain.co");
exchange.applySpecification(exchangeSpecification);
TradeService tradeService = exchange.getTradeService();
try {
UserTrades trades = tradeService.getTradeHistory(new TradeHistoryParamsZero());
assertNotNull(trades);
} catch (Exception exception) {
System.out.println(exception.getMessage());
assert (false);
}
}
use of org.knowm.xchange.service.trade.TradeService in project XChange by knowm.
the class HuobiPrivateApiIntegration method getOrderTest.
@Test
public void getOrderTest() throws IOException {
TradeService tradeService = exchange.getTradeService();
Collection<Order> orders = tradeService.getOrder("2132866355");
System.out.println(orders.toString());
assertThat(orders).isNotNull();
}
Aggregations