Search in sources :

Example 1 with DsxTransaction

use of org.knowm.xchange.dsx.dto.DsxTransaction in project XChange by knowm.

the class DsxAccountService method getFundingHistory.

@Override
public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException {
    List<DsxTransaction> transactions;
    String currencyCode = null;
    Integer limit = 1000;
    int offset = 0;
    if (params instanceof TradeHistoryParamCurrency) {
        Currency currency = ((TradeHistoryParamCurrency) params).getCurrency();
        currencyCode = currency != null ? currency.getCurrencyCode() : null;
    }
    if (params instanceof TradeHistoryParamLimit) {
        limit = ((TradeHistoryParamLimit) params).getLimit();
    }
    if (params instanceof TradeHistoryParamOffset) {
        offset = ((TradeHistoryParamOffset) params).getOffset().intValue();
    }
    transactions = getTransactions(currencyCode, limit, offset);
    List<FundingRecord> records = new ArrayList<>();
    for (DsxTransaction transaction : transactions) {
        records.add(DsxAdapters.adapt(transaction));
    }
    return records;
}
Also used : DsxTransaction(org.knowm.xchange.dsx.dto.DsxTransaction) TradeHistoryParamOffset(org.knowm.xchange.service.trade.params.TradeHistoryParamOffset) TradeHistoryParamCurrency(org.knowm.xchange.service.trade.params.TradeHistoryParamCurrency) Currency(org.knowm.xchange.currency.Currency) FundingRecord(org.knowm.xchange.dto.account.FundingRecord) ArrayList(java.util.ArrayList) TradeHistoryParamCurrency(org.knowm.xchange.service.trade.params.TradeHistoryParamCurrency) TradeHistoryParamLimit(org.knowm.xchange.service.trade.params.TradeHistoryParamLimit)

Aggregations

ArrayList (java.util.ArrayList)1 Currency (org.knowm.xchange.currency.Currency)1 DsxTransaction (org.knowm.xchange.dsx.dto.DsxTransaction)1 FundingRecord (org.knowm.xchange.dto.account.FundingRecord)1 TradeHistoryParamCurrency (org.knowm.xchange.service.trade.params.TradeHistoryParamCurrency)1 TradeHistoryParamLimit (org.knowm.xchange.service.trade.params.TradeHistoryParamLimit)1 TradeHistoryParamOffset (org.knowm.xchange.service.trade.params.TradeHistoryParamOffset)1