@Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { final CurrencyPair currencyPair = Optional.ofNullable(params) .filter(p -> p instanceof TradeHistoryParamCurrencyPair) .map(p -> ((TradeHistoryParamCurrencyPair) p).getCurrencyPair()) .orElse(null); try { return BithumbAdapters.adaptUserTrades(bithumbTransactions(currencyPair), currencyPair); } catch (BithumbException e) { throw BithumbErrorAdapter.adapt(e); } }
private static void fundingHistory(AccountService accountService) throws IOException { // Get the funds information TradeHistoryParams params = accountService.createFundingHistoryParams(); if (params instanceof TradeHistoryParamPaging) { TradeHistoryParamPaging pagingParams = (TradeHistoryParamPaging) params; pagingParams.setPageLength(50); pagingParams.setPageNumber(1); } if (params instanceof TradeHistoryParamCurrencyPair) { ((TradeHistoryParamCurrencyPair) params).setCurrencyPair(CurrencyPair.BTC_CNY); } final List<FundingRecord> fundingRecords = accountService.getFundingHistory(params); AccountServiceTestUtil.printFundingHistory(fundingRecords); } }
@Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { CurrencyPair currencyPair = null; if (params instanceof TradeHistoryParamCurrencyPair) { currencyPair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair(); } List<Map> response = getBitbayTransactions(currencyPair); List<UserTrade> trades = BitbayAdapters.adaptTransactions(response); return new UserTrades(trades, Trades.TradeSortType.SortByTimestamp); }
/** Required parameter: {@link TradeHistoryParamCurrencyPair} */ @Override public UserTrades getTradeHistory(TradeHistoryParams params) throws ExchangeException, IOException { CurrencyPair pair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair(); List<GateioTrade> userTrades = getGateioTradeHistory(pair).getTrades(); return GateioAdapters.adaptUserTrades(userTrades); }
@Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { CurrencyPair currencyPair = null; if (params instanceof TradeHistoryParamCurrencyPair) { TradeHistoryParamCurrencyPair tradeHistoryParamCurrencyPair = (TradeHistoryParamCurrencyPair) params; currencyPair = tradeHistoryParamCurrencyPair.getCurrencyPair(); } BankeraUserTrades trades = getUserTrades(currencyPair); return new UserTrades( BankeraAdapters.adaptUserTrades(trades), Trades.TradeSortType.SortByTimestamp); }
@Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { Integer limit = 10000; Long offset = 0L; List<CurrencyPair> currencyPairs = new ArrayList<>(); if (params instanceof ExmoTradeHistoryParams) { ExmoTradeHistoryParams exmoTradeHistoryParams = (ExmoTradeHistoryParams) params; currencyPairs.addAll(exmoTradeHistoryParams.getCurrencyPairs()); } else if (params instanceof TradeHistoryParamCurrencyPair) { TradeHistoryParamCurrencyPair tradeHistoryParamCurrencyPair = (TradeHistoryParamCurrencyPair) params; currencyPairs.add(tradeHistoryParamCurrencyPair.getCurrencyPair()); } if (params instanceof TradeHistoryParamLimit) { limit = ((TradeHistoryParamLimit) params).getLimit(); } if (params instanceof TradeHistoryParamOffset) { offset = ((TradeHistoryParamOffset) params).getOffset(); } List<UserTrade> trades = trades(limit, offset, currencyPairs); return new UserTrades(trades, Trades.TradeSortType.SortByTimestamp); }
@Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { CurrencyPair currencyPair = null; Integer pageNumber = 1; Integer limit = 1000; if (params instanceof TradeHistoryParamCurrencyPair) { currencyPair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair(); } if (params instanceof TradeHistoryParamPaging) { TradeHistoryParamPaging tradeHistoryParamPaging = (TradeHistoryParamPaging) params; pageNumber = tradeHistoryParamPaging.getPageNumber(); limit = tradeHistoryParamPaging.getPageLength(); } List<QuoineExecution> executions = executions(currencyPair, limit, pageNumber); if (currencyPair == null) throw new IllegalStateException("Need to specify TradeHistoryParamCurrencyPair"); return new UserTrades( QuoineAdapters.adapt(executions, currencyPair), Trades.TradeSortType.SortByTimestamp); }
@Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { String symbol = null; if (params instanceof TradeHistoryParamCurrencyPair) { symbol = BitmexAdapters.adaptCurrencyPairToSymbol( ((TradeHistoryParamCurrencyPair) params).getCurrencyPair()); } Long start = null; if (params instanceof TradeHistoryParamOffset) { start = ((TradeHistoryParamOffset) params).getOffset(); } Date startTime = null; Date endTime = null; if (params instanceof TradeHistoryParamsTimeSpan) { TradeHistoryParamsTimeSpan timeSpan = (TradeHistoryParamsTimeSpan) params; startTime = timeSpan.getStartTime(); endTime = timeSpan.getEndTime(); } List<UserTrade> userTrades = getTradeHistory(symbol, null, null, null, start, false, startTime, endTime) .stream() .map(BitmexAdapters::adoptUserTrade) .filter(Objects::nonNull) .collect(Collectors.toList()); return new UserTrades(userTrades, TradeSortType.SortByTimestamp); } }
pair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair(); } else { pair = NO_CURRENCY_PAIR;
@Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { try { CurrencyPair currencyPair = null; if (params instanceof TradeHistoryParamCurrencyPair) { TradeHistoryParamCurrencyPair tradeHistoryParamCurrencyPair = (TradeHistoryParamCurrencyPair) params; currencyPair = tradeHistoryParamCurrencyPair.getCurrencyPair(); } List<BittrexUserTrade> bittrexTradeHistory = getBittrexTradeHistory(currencyPair); return new UserTrades( BittrexAdapters.adaptUserTrades(bittrexTradeHistory), TradeSortType.SortByTimestamp); } catch (BittrexException e) { throw BittrexErrorAdapter.adapt(e); } }
@Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { Integer limit = 200; if (params instanceof TradeHistoryParamPaging) { limit = ((TradeHistoryParamPaging) params).getPageLength(); } Long since = 0L; if (params instanceof TradeHistoryParamsIdSpan) { TradeHistoryParamsIdSpan tradeHistoryParamsIdSpan = (TradeHistoryParamsIdSpan) params; since = Long.valueOf(tradeHistoryParamsIdSpan.getStartId()); } CurrencyPair cp = null; if (params instanceof TradeHistoryParamCurrencyPair) { CurrencyPair paramsCp = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair(); if (paramsCp != null) { cp = paramsCp; } } BTCMarketsTradeHistory response = getBTCMarketsUserTransactions(cp, limit, since); return BTCMarketsAdapters.adaptTradeHistory(response.getTrades(), cp); }
@Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { try { CurrencyPair currencyPair = null; Integer limit = 100; if (params instanceof TradeHistoryParamCurrencyPair) { currencyPair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair(); } if (params instanceof TradeHistoryParamLimit) { limit = ((TradeHistoryParamLimit) params).getLimit(); } return new UserTrades( tradeHistory(currencyPair, limit), Trades.TradeSortType.SortByTimestamp); } catch (CryptopiaException e) { throw CryptopiaErrorAdapter.adapt(e); } }
pair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair();
@Override public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException { Long limit = null; CurrencyPair currencyPair = null; Long offset = null; TradeHistoryParamsSorted.Order sort = null; if (params instanceof TradeHistoryParamPaging) { limit = Long.valueOf(((TradeHistoryParamPaging) params).getPageLength()); } if (params instanceof TradeHistoryParamCurrencyPair) { currencyPair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair(); } if (params instanceof TradeHistoryParamOffset) { offset = ((TradeHistoryParamOffset) params).getOffset(); } if (params instanceof TradeHistoryParamsSorted) { sort = ((TradeHistoryParamsSorted) params).getOrder(); } CryptonitUserTransaction[] txs = getCryptonitUserTransactions(limit, offset, sort == null ? null : sort.toString()); return CryptonitAdapters.adaptFundingHistory(Arrays.asList(txs)); } }
pairParams.getCurrencyPair(), sinceTradeId, after, before, pageLength, page), pairParams.getCurrencyPair());
/** Required parameter types: {@link TradeHistoryParamPaging#getPageLength()} */ @Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { Long limit = null; CurrencyPair currencyPair = null; Long offset = null; TradeHistoryParamsSorted.Order sort = null; if (params instanceof TradeHistoryParamPaging) { limit = Long.valueOf(((TradeHistoryParamPaging) params).getPageLength()); } if (params instanceof TradeHistoryParamCurrencyPair) { currencyPair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair(); } if (params instanceof TradeHistoryParamOffset) { offset = ((TradeHistoryParamOffset) params).getOffset(); } if (params instanceof TradeHistoryParamsSorted) { sort = ((TradeHistoryParamsSorted) params).getOrder(); } CryptonitUserTransaction[] txs = getCryptonitUserTransactions( limit, currencyPair, offset, sort == null ? null : sort.toString()); return CryptonitAdapters.adaptTradeHistory(txs); }
"You need to provide the currency pair to get the user trades."); TradeHistoryParamCurrencyPair pairParams = (TradeHistoryParamCurrencyPair) params; CurrencyPair pair = pairParams.getCurrencyPair(); if (pair == null) { throw new ExchangeException(
currencyPairTmp = ((TradeHistoryParamCurrencyPair) tradeHistoryParams).getCurrencyPair();
/** Required parameter types: {@link TradeHistoryParamPaging#getPageLength()} */ @Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { Long limit = null; CurrencyPair currencyPair = null; Long offset = null; TradeHistoryParamsSorted.Order sort = null; if (params instanceof TradeHistoryParamPaging) { limit = Long.valueOf(((TradeHistoryParamPaging) params).getPageLength()); } if (params instanceof TradeHistoryParamCurrencyPair) { currencyPair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair(); } if (params instanceof TradeHistoryParamOffset) { offset = ((TradeHistoryParamOffset) params).getOffset(); } if (params instanceof TradeHistoryParamsSorted) { sort = ((TradeHistoryParamsSorted) params).getOrder(); } BitstampUserTransaction[] txs = getBitstampUserTransactions( limit, currencyPair, offset, sort == null ? null : sort.toString()); return BitstampAdapters.adaptTradeHistory(txs); }
/** Required parameters: {@link TradeHistoryParamPaging} {@link TradeHistoryParamCurrencyPair} */ @Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { Integer limit = 1000; long offset = 0; if (params instanceof TradeHistoryParamLimit) { limit = ((TradeHistoryParamLimit) params).getLimit(); } if (params instanceof TradeHistoryParamOffset) { TradeHistoryParamOffset tradeHistoryParamOffset = (TradeHistoryParamOffset) params; offset = tradeHistoryParamOffset.getOffset(); } String symbol = null; if (params instanceof TradeHistoryParamCurrencyPair) { CurrencyPair pair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair(); symbol = HitbtcAdapters.adaptCurrencyPair(pair); } List<HitbtcOwnTrade> tradeHistoryRaw = getTradeHistoryRaw(symbol, limit, offset); return HitbtcAdapters.adaptTradeHistory(tradeHistoryRaw); }