@Override public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException { Currency currency = null; if (params instanceof TradeHistoryParamCurrency) { TradeHistoryParamCurrency tradeHistoryParamCurrency = (TradeHistoryParamCurrency) params; currency = tradeHistoryParamCurrency.getCurrency(); } Integer limit = 1000; if (params instanceof TradeHistoryParamLimit) { limit = ((TradeHistoryParamLimit) params).getLimit(); } return history(currency, limit); }
private static void fundingHistory(AccountService accountService) throws IOException { // Get the funds information TradeHistoryParams params = accountService.createFundingHistoryParams(); if (params instanceof TradeHistoryParamsTimeSpan) { final TradeHistoryParamsTimeSpan timeSpanParam = (TradeHistoryParamsTimeSpan) params; timeSpanParam.setStartTime( new Date(System.currentTimeMillis() - (1 * 12 * 30 * 24 * 60 * 60 * 1000L))); } if (params instanceof TradeHistoryParamCurrency) { ((TradeHistoryParamCurrency) params).setCurrency(Currency.BTC); } List<FundingRecord> fundingRecords = accountService.getFundingHistory(params); AccountServiceTestUtil.printFundingHistory(fundingRecords); } }
@Override public List<FundingRecord> getFundingHistory(TradeHistoryParams params) { Currency currency = null; if (params instanceof TradeHistoryParamCurrency) { currency = ((TradeHistoryParamCurrency) params).getCurrency(); if (currency.getCurrencyCode().equals("BTC") || currency.getCurrencyCode().equals("XBT")) { currency = new Currency("XBt"); } } else { throw new ExchangeException("Currency must be supplied"); } return getBitmexWalletHistory(currency) .stream() .filter( w -> w.getTransactStatus().equals("Completed") && (w.getTransactType().equals("Deposit") || w.getTransactType().equals("Withdrawal"))) .map(w -> BitmexAdapters.adaptFundingRecord(w)) .collect(Collectors.toList()); } }
@Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException, ExchangeException { if ((params instanceof TradeHistoryParamCurrency) && (params instanceof TradeHistoryParamTransactionId)) { String tradeID = ((TradeHistoryParamTransactionId) params).getTransactionId(); String coin = ((TradeHistoryParamCurrency) params).getCurrency().getCurrencyCode().toLowerCase(); return CoinEggAdapters.adaptTradeHistory(getCoinEggTradeView(tradeID, coin)); } throw new ExchangeException("Incorrect TradeHistoryParams!"); }
@Override public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException { Integer page = 1; Integer limit = null; Currency currency = null; if (params instanceof TradeHistoryParamCurrency) { currency = ((TradeHistoryParamCurrency) params).getCurrency(); } if (params instanceof TradeHistoryParamPaging) { TradeHistoryParamPaging tradeHistoryParamPaging = (TradeHistoryParamPaging) params; page = tradeHistoryParamPaging.getPageNumber(); limit = tradeHistoryParamPaging.getPageLength(); } List<FundingRecord> res = new ArrayList<>(); for (QuoineTransaction transaction : depositHistory(currency, limit, page)) { res.add(QuoineAdapters.adaptFunding(currency, transaction, FundingRecord.Type.DEPOSIT)); } for (QuoineTransaction transaction : withdrawalHistory(currency, limit, page)) { res.add(QuoineAdapters.adaptFunding(currency, transaction, FundingRecord.Type.WITHDRAWAL)); } return res; }
@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; }
String symbol = null; if (params instanceof TradeHistoryParamCurrency && ((TradeHistoryParamCurrency) params).getCurrency() != null) { ((TradeHistoryParamCurrency) params).getCurrency());
if (params instanceof TradeHistoryParamCurrency) { TradeHistoryParamCurrency tradeHistoryParamCurrency = (TradeHistoryParamCurrency) params; currency = tradeHistoryParamCurrency.getCurrency();
@Override public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException { try { String currency = null; if (params instanceof TradeHistoryParamCurrency && ((TradeHistoryParamCurrency) params).getCurrency() != null) { currency = ((TradeHistoryParamCurrency) params).getCurrency().getCurrencyCode(); } else { throw new ExchangeException("Currency must be supplied"); } Date startTime = null; Date endTime = null; if (params instanceof TradeHistoryParamsTimeSpan) { startTime = ((TradeHistoryParamsTimeSpan) params).getStartTime(); endTime = ((TradeHistoryParamsTimeSpan) params).getEndTime(); } Integer limit = null; if (params instanceof TradeHistoryParamLimit) { TradeHistoryParamLimit limitParams = (TradeHistoryParamLimit) params; limit = limitParams.getLimit(); } return BitfinexAdapters.adaptFundingHistory( getDepositWithdrawalHistory(currency, null, startTime, endTime, limit)); } catch (BitfinexException e) { throw BitfinexErrorAdapter.adapt(e); } }
@Override public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException { String currency = null; if (params instanceof TradeHistoryParamCurrency && ((TradeHistoryParamCurrency) params).getCurrency() != null) { currency = ((TradeHistoryParamCurrency) params).getCurrency().getCurrencyCode(); } else { // Currency is a required parameter for Huobi funding history query throw new ExchangeException("Currency must be supplied"); } String from = null; if (params instanceof TradeHistoryParamsIdSpan) { from = ((TradeHistoryParamsIdSpan) params).getStartId(); } FundingRecord.Type type = null; if (params instanceof HistoryParamsFundingType && ((HistoryParamsFundingType) params).getType() != null) { type = ((HistoryParamsFundingType) params).getType(); } else { // Funding history type is a required parameter for Huobi funding history query throw new ExchangeException( "Type 'deposit' or 'withdraw' must be supplied using FundingRecord.Type"); } // Adapt type out (replace withdrawal -> withdraw) String fundingRecordType = type == FundingRecord.Type.WITHDRAWAL ? "withdraw" : "deposit"; return HuobiAdapters.adaptFundingHistory( getDepositWithdrawalHistory(currency, fundingRecordType, from)); }
String currencyCode = null; if (params instanceof TradeHistoryParamCurrency) { Currency currency = ((TradeHistoryParamCurrency) params).getCurrency(); currencyCode = currency == null ? null : currency.getCurrencyCode();
Currency c = ((TradeHistoryParamCurrency) params).getCurrency(); currency = c == null ? null : c.getCurrencyCode(); Currency c = ((TradeHistoryParamCurrency) params).getCurrency(); currency = c == null ? null : c.getCurrencyCode();
if (params instanceof TradeHistoryParamCurrency) { TradeHistoryParamCurrency cp = (TradeHistoryParamCurrency) params; if (cp.getCurrency() != null) { asset = cp.getCurrency().getCurrencyCode();
Currency desiredCurrency = ((TradeHistoryParamCurrency) params).getCurrency(); if (!desiredCurrency.equals(currency)) continue;
@Override public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException { if (!(params instanceof TradeHistoryParamPaging) && !(params instanceof TradeHistoryParamCurrency)) { throw new ExchangeException( "You need to provide paging information and currency to get the trade history."); } TradeHistoryParamPaging pagingParams = (TradeHistoryParamPaging) params; TradeHistoryParamCurrency curParams = (TradeHistoryParamCurrency) params; Type type = null; if (params instanceof HistoryParamsFundingType) { HistoryParamsFundingType fundingType = (HistoryParamsFundingType) params; if (fundingType.getType() != null) { type = fundingType.getType(); } } // Paging params are 0-based, Kucoin account balances pages are 1-based KucoinSimpleResponse<KucoinWalletRecords> response = walletRecords( curParams.getCurrency(), type, pagingParams.getPageLength(), pagingParams.getPageNumber() != null ? pagingParams.getPageNumber() + 1 : null); return KucoinAdapters.adaptFundingHistory(response.getData().getRecords()); } }
currency = ((TradeHistoryParamCurrency) params).getCurrency();
@Override public List<FundingRecord> getFundingHistory( TradeHistoryParams params) throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException { String currency = null; if (params instanceof TradeHistoryParamCurrency && ((TradeHistoryParamCurrency) params).getCurrency() != null) { currency = ((TradeHistoryParamCurrency) params).getCurrency().getCurrencyCode(); } else { throw new ExchangeException("Currency must be supplied"); } BTCChinaGetDepositsResponse depositsResponse = getDeposits(currency, false); BTCChinaGetWithdrawalsResponse withdrawalsResponse = getWithdrawals(currency, false); return BTCChinaAdapters.adaptFundingHistory(depositsResponse, withdrawalsResponse); }
@Override public List<FundingRecord> getFundingHistory(TradeHistoryParams params) { Currency currency = null; if (params instanceof TradeHistoryParamCurrency) { currency = ((TradeHistoryParamCurrency) params).getCurrency(); if (currency.getCurrencyCode().equals("BTC") || currency.getCurrencyCode().equals("XBT")) { currency = new Currency("XBt"); } } else { throw new ExchangeException("Currency must be supplied"); } return getBitmexWalletHistory(currency).stream() .filter( w -> w.getTransactStatus().equals("Completed") && (w.getTransactType().equals("Deposit") || w.getTransactType().equals("Withdrawal"))) .map(w -> BitmexAdapters.adaptFundingRecord(w)) .collect(Collectors.toList()); } }
@Override public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException { Integer page = 1; Integer limit = null; Currency currency = null; if (params instanceof TradeHistoryParamCurrency) { currency = ((TradeHistoryParamCurrency) params).getCurrency(); } if (params instanceof TradeHistoryParamPaging) { TradeHistoryParamPaging tradeHistoryParamPaging = (TradeHistoryParamPaging) params; page = tradeHistoryParamPaging.getPageNumber(); limit = tradeHistoryParamPaging.getPageLength(); } List<FundingRecord> res = new ArrayList<>(); for (QuoineTransaction transaction : depositHistory(currency, limit, page)) { res.add(QuoineAdapters.adaptFunding(currency, transaction, FundingRecord.Type.DEPOSIT)); } for (QuoineTransaction transaction : withdrawalHistory(currency, limit, page)) { res.add(QuoineAdapters.adaptFunding(currency, transaction, FundingRecord.Type.WITHDRAWAL)); } return res; }
String symbol = null; if (params instanceof TradeHistoryParamCurrency && ((TradeHistoryParamCurrency) params).getCurrency() != null) { ((TradeHistoryParamCurrency) params).getCurrency());