use of org.knowm.xchange.bibox.dto.account.BiboxFundsCommandBody in project XChange by knowm.
the class BiboxAccountService method getFundingHistory.
@Override
public List<FundingRecord> getFundingHistory(TradeHistoryParams params) {
if (!(params instanceof TradeHistoryParamCurrency)) {
throw new RuntimeException("You must provide the currency for funding history @ Bibox.");
}
Currency c = ((TradeHistoryParamCurrency) params).getCurrency();
if (c == null) {
throw new RuntimeException("You must provide the currency for funding history @ Bibox.");
}
boolean deposits = false;
boolean withdrawals = false;
if (params instanceof HistoryParamsFundingType) {
HistoryParamsFundingType typeParams = (HistoryParamsFundingType) params;
Type type = typeParams.getType();
deposits = type == null || type == Type.DEPOSIT;
withdrawals = type == null || type == Type.WITHDRAWAL;
}
BiboxFundsCommandBody body = new BiboxFundsCommandBody(c.getCurrencyCode());
ArrayList<FundingRecord> result = new ArrayList<>();
if (deposits) {
requestBiboxDeposits(body).getItems().forEach(d -> result.add(BiboxAdapters.adaptDeposit(d)));
}
if (withdrawals) {
requestBiboxWithdrawals(body).getItems().forEach(d -> result.add(BiboxAdapters.adaptDeposit(d)));
}
return result;
}
Aggregations