use of org.knowm.xchange.independentreserve.IndependentReserveAdapters in project XChange by knowm.
the class IndependentReserveAccountService method getFundingHistory.
@Override
public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException {
if (!(params instanceof IndependentReserveTradeHistoryParams)) {
throw new IllegalArgumentException("Invalid TradeHistoryParams used as argument of getFundingHistory");
}
IndependentReserveTradeHistoryParams historyParams = (IndependentReserveTradeHistoryParams) params;
final IndependentReserveBalance bal = getIndependentReserveBalance();
final Currency currency = historyParams.getCurrency();
return bal.getIndependentReserveAccounts().stream().filter(acc -> currency == null || currency.getCurrencyCode().equalsIgnoreCase(acc.getCurrencyCode())).map(acc -> {
try {
return getTransactions(acc.getAccountGuid(), historyParams.startTime, historyParams.endTime, historyParams.transactionTypes, historyParams.getPageNumber(), historyParams.getPageLength()).getIndependentReserveTranasactions().stream().map(IndependentReserveAdapters::adaptTransaction);
} catch (IndependentReserveHttpStatusException | IOException e) {
throw new ExchangeException(e);
}
}).flatMap(Function.identity()).collect(Collectors.toList());
}
Aggregations