package org.knowm.xchange.gdax.service; import java.io.IOException; import java.util.Collection; import org.knowm.xchange.Exchange; import org.knowm.xchange.dto.Order; import org.knowm.xchange.dto.trade.LimitOrder; import org.knowm.xchange.dto.trade.MarketOrder; import org.knowm.xchange.dto.trade.OpenOrders; import org.knowm.xchange.dto.trade.UserTrades; import org.knowm.xchange.exceptions.ExchangeException; import org.knowm.xchange.exceptions.NotAvailableFromExchangeException; import org.knowm.xchange.exceptions.NotYetImplementedForExchangeException; import org.knowm.xchange.gdax.GDAXAdapters; import org.knowm.xchange.gdax.dto.trade.GDAXFill; import org.knowm.xchange.gdax.dto.trade.GDAXIdResponse; import org.knowm.xchange.gdax.dto.trade.GDAXOrder; import org.knowm.xchange.gdax.dto.trade.GDAXTradeHistoryParams; import org.knowm.xchange.service.trade.TradeService; import org.knowm.xchange.service.trade.params.TradeHistoryParams; import org.knowm.xchange.service.trade.params.orders.OpenOrdersParams; public class GDAXTradeService extends GDAXTradeServiceRaw implements TradeService { public GDAXTradeService(Exchange exchange) { super(exchange); } @Override public OpenOrders getOpenOrders() throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException { return getOpenOrders(createOpenOrdersParams()); } @Override public OpenOrders getOpenOrders(OpenOrdersParams params) throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException { GDAXOrder[] coinbaseExOpenOrders = getCoinbaseExOpenOrders(); return GDAXAdapters.adaptOpenOrders(coinbaseExOpenOrders); } @Override public String placeMarketOrder(MarketOrder marketOrder) throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException { GDAXIdResponse response = placeCoinbaseExMarketOrder(marketOrder); return response.getId(); } @Override public String placeLimitOrder(LimitOrder limitOrder) throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException { GDAXIdResponse response = placeCoinbaseExLimitOrder(limitOrder); return response.getId(); } @Override public boolean cancelOrder(String orderId) throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException { return cancelCoinbaseExOrder(orderId); } @Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { GDAXFill[] coinbaseExFills = getCoinbaseExFills((GDAXTradeHistoryParams) params); return GDAXAdapters.adaptTradeHistory(coinbaseExFills); } @Override public TradeHistoryParams createTradeHistoryParams() { return null; } @Override public OpenOrdersParams createOpenOrdersParams() { return null; } @Override public Collection<Order> getOrder(String... orderIds) throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException { throw new NotYetImplementedForExchangeException(); } }