Search in sources :

Example 1 with OpenOrdersParamInstrument

use of org.knowm.xchange.service.trade.params.orders.OpenOrdersParamInstrument in project XChange by knowm.

the class DeribitTradeService method getOpenOrders.

@Override
public OpenOrders getOpenOrders(OpenOrdersParams params) throws IOException {
    List<org.knowm.xchange.deribit.v2.dto.trade.Order> openOrders;
    if (params instanceof OpenOrdersParamCurrencyPair) {
        OpenOrdersParamCurrencyPair pairParams = (OpenOrdersParamCurrencyPair) params;
        CurrencyPair pair = pairParams.getCurrencyPair();
        openOrders = super.getOpenOrdersByCurrency(pair.base.getCurrencyCode(), null, null);
    } else if (params instanceof OpenOrdersParamInstrument) {
        OpenOrdersParamInstrument instrumentParams = (OpenOrdersParamInstrument) params;
        Instrument instrument = instrumentParams.getInstrument();
        openOrders = super.getOpenOrdersByInstrument(DeribitAdapters.adaptInstrumentName(instrument), null);
    } else {
        openOrders = openOrders();
    }
    return DeribitAdapters.adaptOpenOrders(openOrders);
}
Also used : StopOrder(org.knowm.xchange.dto.trade.StopOrder) Order(org.knowm.xchange.dto.Order) LimitOrder(org.knowm.xchange.dto.trade.LimitOrder) MarketOrder(org.knowm.xchange.dto.trade.MarketOrder) OpenOrdersParamInstrument(org.knowm.xchange.service.trade.params.orders.OpenOrdersParamInstrument) DefaultOpenOrdersParamInstrument(org.knowm.xchange.service.trade.params.orders.DefaultOpenOrdersParamInstrument) OpenOrdersParamInstrument(org.knowm.xchange.service.trade.params.orders.OpenOrdersParamInstrument) DefaultOpenOrdersParamInstrument(org.knowm.xchange.service.trade.params.orders.DefaultOpenOrdersParamInstrument) TradeHistoryParamInstrument(org.knowm.xchange.service.trade.params.TradeHistoryParamInstrument) Instrument(org.knowm.xchange.instrument.Instrument) OpenOrdersParamCurrencyPair(org.knowm.xchange.service.trade.params.orders.OpenOrdersParamCurrencyPair) OpenOrdersParamCurrencyPair(org.knowm.xchange.service.trade.params.orders.OpenOrdersParamCurrencyPair) CurrencyPair(org.knowm.xchange.currency.CurrencyPair) TradeHistoryParamCurrencyPair(org.knowm.xchange.service.trade.params.TradeHistoryParamCurrencyPair)

Aggregations

CurrencyPair (org.knowm.xchange.currency.CurrencyPair)1 Order (org.knowm.xchange.dto.Order)1 LimitOrder (org.knowm.xchange.dto.trade.LimitOrder)1 MarketOrder (org.knowm.xchange.dto.trade.MarketOrder)1 StopOrder (org.knowm.xchange.dto.trade.StopOrder)1 Instrument (org.knowm.xchange.instrument.Instrument)1 TradeHistoryParamCurrencyPair (org.knowm.xchange.service.trade.params.TradeHistoryParamCurrencyPair)1 TradeHistoryParamInstrument (org.knowm.xchange.service.trade.params.TradeHistoryParamInstrument)1 DefaultOpenOrdersParamInstrument (org.knowm.xchange.service.trade.params.orders.DefaultOpenOrdersParamInstrument)1 OpenOrdersParamCurrencyPair (org.knowm.xchange.service.trade.params.orders.OpenOrdersParamCurrencyPair)1 OpenOrdersParamInstrument (org.knowm.xchange.service.trade.params.orders.OpenOrdersParamInstrument)1