use of org.knowm.xchange.latoken.dto.trade.LatokenUserTrades in project XChange by knowm.
the class LatokenTradeService method getTradeHistory.
@Override
public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException {
if (params instanceof TradeHistoryParamCurrencyPair == false) {
throw new ExchangeException("CurrencyPair must be provided to get user trades.");
}
TradeHistoryParamCurrencyPair pairParams = (TradeHistoryParamCurrencyPair) params;
CurrencyPair pair = pairParams.getCurrencyPair();
if (pair == null) {
throw new ExchangeException("CurrencyPair must be provided to get user trades.");
}
// Limit is an optional parameter
Integer limit = null;
if (params instanceof TradeHistoryParamLimit) {
TradeHistoryParamLimit limitParams = (TradeHistoryParamLimit) params;
limit = limitParams.getLimit();
}
try {
LatokenUserTrades latokenTrades = getLatokenUserTrades(pair, limit);
return LatokenAdapters.adaptUserTrades(this.exchange, latokenTrades);
} catch (LatokenException e) {
throw LatokenErrorAdapter.adapt(e);
}
}
use of org.knowm.xchange.latoken.dto.trade.LatokenUserTrades in project XChange by knowm.
the class LatokenAdapters method adaptUserTrades.
public static UserTrades adaptUserTrades(Exchange exchange, LatokenUserTrades latokenUserTrades) {
CurrencyPair pair = adaptCurrencyPair(exchange, latokenUserTrades.getSymbol());
List<UserTrade> trades = latokenUserTrades.getTrades().stream().map(latokenUserTrade -> adaptUserTrade(latokenUserTrade, pair)).collect(Collectors.toList());
return new UserTrades(trades, Trades.TradeSortType.SortByTimestamp);
}
Aggregations