org.knowm.xchange.cobinhood.service.CobinhoodTradeService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xchange-cobinhood Show documentation
Show all versions of xchange-cobinhood Show documentation
Development fork. Not for general use.
package org.knowm.xchange.cobinhood.service;
import java.io.IOException;
import java.util.Collection;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.cobinhood.dto.CobinhoodAdapters;
import org.knowm.xchange.cobinhood.dto.trading.CobinhoodOpenOrdersParams;
import org.knowm.xchange.currency.CurrencyPair;
import org.knowm.xchange.dto.Order;
import org.knowm.xchange.dto.trade.LimitOrder;
import org.knowm.xchange.dto.trade.OpenOrders;
import org.knowm.xchange.service.trade.TradeService;
import org.knowm.xchange.service.trade.params.orders.OpenOrdersParams;
public class CobinhoodTradeService extends CobinhoodTradeServiceRaw implements TradeService {
public CobinhoodTradeService(Exchange exchange) {
super(exchange);
}
@Override
public String placeLimitOrder(LimitOrder limitOrder) throws IOException {
return placeCobinhoodLimitOrder(limitOrder).getResult().getOrder().getId();
}
@Override
public boolean cancelOrder(String orderId) throws IOException {
return cancelCobinhoodOrder(orderId).isSuccess();
}
@Override
public Collection getOrder(String... orderIds) throws IOException {
return getCobinhoodOrder(orderIds);
}
@Override
public OpenOrders getOpenOrders() throws IOException {
return getOpenOrders(new CobinhoodOpenOrdersParams(null));
}
@Override
public OpenOrders getOpenOrders(OpenOrdersParams params) throws IOException {
return CobinhoodAdapters.adaptOpenOrders(
getCobinhoodOpenOrders((CobinhoodOpenOrdersParams) params).getResult());
}
public OpenOrders getOpenOrders(CurrencyPair pair) throws IOException {
return CobinhoodAdapters.adaptOpenOrders(
getCobinhoodOpenOrders(new CobinhoodOpenOrdersParams(pair)).getResult());
}
}