Search in sources :

Example 1 with PoloniexOpenOrder

use of org.knowm.xchange.poloniex.dto.trade.PoloniexOpenOrder in project XChange by knowm.

the class PoloniexTradeService method getOpenOrders.

@Override
public OpenOrders getOpenOrders(OpenOrdersParams params) throws ExchangeException, IOException {
    try {
        CurrencyPair currencyPair = null;
        if (params instanceof OpenOrdersParamCurrencyPair) {
            currencyPair = ((OpenOrdersParamCurrencyPair) params).getCurrencyPair();
        }
        final Map<String, PoloniexOpenOrder[]> poloniexOpenOrders;
        if (currencyPair == null) {
            poloniexOpenOrders = returnOpenOrders();
        } else {
            final PoloniexOpenOrder[] cpOpenOrders = returnOpenOrders(currencyPair);
            poloniexOpenOrders = new HashMap<>(1);
            poloniexOpenOrders.put(PoloniexUtils.toPairString(currencyPair), cpOpenOrders);
        }
        return PoloniexAdapters.adaptPoloniexOpenOrders(poloniexOpenOrders);
    } catch (PoloniexException e) {
        throw PoloniexErrorAdapter.adapt(e);
    }
}
Also used : PoloniexException(org.knowm.xchange.poloniex.dto.PoloniexException) OpenOrdersParamCurrencyPair(org.knowm.xchange.service.trade.params.orders.OpenOrdersParamCurrencyPair) DefaultOpenOrdersParamCurrencyPair(org.knowm.xchange.service.trade.params.orders.DefaultOpenOrdersParamCurrencyPair) CurrencyPair(org.knowm.xchange.currency.CurrencyPair) TradeHistoryParamCurrencyPair(org.knowm.xchange.service.trade.params.TradeHistoryParamCurrencyPair) OpenOrdersParamCurrencyPair(org.knowm.xchange.service.trade.params.orders.OpenOrdersParamCurrencyPair) DefaultOpenOrdersParamCurrencyPair(org.knowm.xchange.service.trade.params.orders.DefaultOpenOrdersParamCurrencyPair) PoloniexOpenOrder(org.knowm.xchange.poloniex.dto.trade.PoloniexOpenOrder)

Aggregations

CurrencyPair (org.knowm.xchange.currency.CurrencyPair)1 PoloniexException (org.knowm.xchange.poloniex.dto.PoloniexException)1 PoloniexOpenOrder (org.knowm.xchange.poloniex.dto.trade.PoloniexOpenOrder)1 TradeHistoryParamCurrencyPair (org.knowm.xchange.service.trade.params.TradeHistoryParamCurrencyPair)1 DefaultOpenOrdersParamCurrencyPair (org.knowm.xchange.service.trade.params.orders.DefaultOpenOrdersParamCurrencyPair)1 OpenOrdersParamCurrencyPair (org.knowm.xchange.service.trade.params.orders.OpenOrdersParamCurrencyPair)1