@Override public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException { try { Date start = new Date(0); Date end = new Date(); if (params instanceof TradeHistoryParamsTimeSpan) { TradeHistoryParamsTimeSpan tradeHistoryParamsTimeSpan = (TradeHistoryParamsTimeSpan) params; start = tradeHistoryParamsTimeSpan.getStartTime(); end = tradeHistoryParamsTimeSpan.getEndTime(); } Long offset = 0L; if (params instanceof TradeHistoryParamOffset) { offset = ((TradeHistoryParamOffset) params).getOffset(); } Integer limit = 100; if (params instanceof TradeHistoryParamLimit) { limit = ((TradeHistoryParamLimit) params).getLimit(); } List<Map> fundingRaw = funding(start, end, limit, offset); return fundingRaw .stream() .map(LivecoinAdapters::adaptFundingRecord) .collect(Collectors.toList()); } catch (LivecoinException e) { throw LivecoinErrorAdapter.adapt(e); } }
@Override public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException { Integer limit = 200; Long offset = 0L; if (params instanceof TradeHistoryParamLimit) { limit = ((TradeHistoryParamLimit) params).getLimit(); } if (params instanceof TradeHistoryParamOffset) { offset = ((TradeHistoryParamOffset) params).getOffset(); } BitbayBalancesHistoryQuery query = new BitbayBalancesHistoryQuery(); List<String> types = new ArrayList<>(); types.add("WITHDRAWAL_SUBTRACT_FUNDS"); types.add("ADD_FUNDS"); query.setTypes(types); query.setLimit(String.valueOf(limit)); query.setOffset(String.valueOf(offset)); Map map = balanceHistory(query); List<FundingRecord> fundingRecords = new ArrayList<>(); for (Map item : (List<Map>) map.get("items")) { fundingRecords.add(adaptFundingRecord(item)); } return fundingRecords; }
@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); }
from = ((TradeHistoryParamOffset) params).getOffset();
@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 TradeHistoryParamOffset) { offset = ((TradeHistoryParamOffset) params).getOffset(); } if (params instanceof TradeHistoryParamsSorted) { sort = ((TradeHistoryParamsSorted) params).getOrder(); } BitstampUserTransaction[] txs = getBitstampUserTransactions(limit, offset, sort == null ? null : sort.toString()); return BitstampAdapters.adaptFundingHistory(Arrays.asList(txs)); } }
@Override public UserTrades getTradeHistory(TradeHistoryParams params) { Integer limit = null; Long offset = null; if (params instanceof TradeHistoryParamLimit) { limit = ((TradeHistoryParamLimit) params).getLimit(); } if (params instanceof TradeHistoryParamOffset) { offset = ((TradeHistoryParamOffset) params).getOffset(); } // Integer offset, final Integer limit, Integer orderBy final BityResponse<BityOrder> orders = super.getBityOrders(offset, limit, "timestamp_created"); return BityAdapters.adaptTrades(orders.getObjects()); }
@Override public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException { TradeHistoryParamsSorted.Order order = TradeHistoryParamsSorted.Order.asc; Integer limit = 1000; int offset = 0; if (params instanceof TradeHistoryParamOffset) { offset = Math.toIntExact(((TradeHistoryParamOffset) params).getOffset()); } if (params instanceof TradeHistoryParamLimit) { limit = ((TradeHistoryParamLimit) params).getLimit(); } if (params instanceof TradeHistoryParamsSorted) { order = ((TradeHistoryParamsSorted) params).getOrder(); } CoinmateTransactionHistory coinmateTransactionHistory = getCoinmateTransactionHistory(offset, limit, CoinmateAdapters.adaptSortOrder(order)); return CoinmateAdapters.adaptFundingHistory(coinmateTransactionHistory); }
@Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { TradeHistoryParamsSorted.Order order = TradeHistoryParamsSorted.Order.asc; Integer limit = 1000; int offset = 0; if (params instanceof TradeHistoryParamOffset) { offset = Math.toIntExact(((TradeHistoryParamOffset) params).getOffset()); } if (params instanceof TradeHistoryParamLimit) { limit = ((TradeHistoryParamLimit) params).getLimit(); } if (params instanceof TradeHistoryParamsSorted) { order = ((TradeHistoryParamsSorted) params).getOrder(); } CoinmateTransactionHistory coinmateTradeHistory = getCoinmateTradeHistory(offset, limit, CoinmateAdapters.adaptSortOrder(order)); return CoinmateAdapters.adaptTransactionHistory(coinmateTradeHistory); }
@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); } }
offset = ((TradeHistoryParamOffset) params).getOffset(); } else { offset = null;
@Override public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException { try { Date start = new Date(0); Date end = new Date(); if (params instanceof TradeHistoryParamsTimeSpan) { TradeHistoryParamsTimeSpan tradeHistoryParamsTimeSpan = (TradeHistoryParamsTimeSpan) params; start = tradeHistoryParamsTimeSpan.getStartTime(); end = tradeHistoryParamsTimeSpan.getEndTime(); } Long offset = 0L; if (params instanceof TradeHistoryParamOffset) { offset = ((TradeHistoryParamOffset) params).getOffset(); } Integer limit = 100; if (params instanceof TradeHistoryParamLimit) { limit = ((TradeHistoryParamLimit) params).getLimit(); } return new UserTrades( tradeHistory(start, end, limit, offset), Trades.TradeSortType.SortByTimestamp); } catch (LivecoinException e) { throw LivecoinErrorAdapter.adapt(e); } }
@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)); } }
/** 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 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); }
/** 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); }
offset = ((TradeHistoryParamOffset) params).getOffset();
offset = ((TradeHistoryParamOffset) params).getOffset();
offset = historyParamOffset.getOffset();
public BitMarketHistoryTradesResponse getBitMarketTradeHistory(TradeHistoryParams params) throws IOException, ExchangeException { // default values String currencyPair = "BTCPLN"; int count = 1000; long offset = 0; if (params instanceof TradeHistoryParamCurrencyPair) { currencyPair = BitMarketUtils.currencyPairToBitMarketCurrencyPair( ((TradeHistoryParamCurrencyPair) params).getCurrencyPair()); } if (params instanceof TradeHistoryParamOffset) { offset = ((TradeHistoryParamOffset) params).getOffset(); } if (params instanceof BitMarketHistoryParams) { count = ((BitMarketHistoryParams) params).getCount(); } BitMarketHistoryTradesResponse response = bitMarketAuthenticated.trades( apiKey, sign, exchange.getNonceFactory(), currencyPair, count, offset); if (!response.getSuccess()) { throw new ExchangeException( String.format("%d: %s", response.getError(), response.getErrorMsg())); } return response; }
/** * @param params Can optionally implement {@link TradeHistoryParamOffset} and {@link * TradeHistoryParamsTimeSpan}. All other TradeHistoryParams types will be ignored. */ @Override public UserTrades getTradeHistory(TradeHistoryParams params) throws ExchangeException, IOException { final Long startTime; final Long endTime; if (params instanceof TradeHistoryParamsTimeSpan) { TradeHistoryParamsTimeSpan timeSpan = (TradeHistoryParamsTimeSpan) params; startTime = DateUtils.toUnixTimeNullSafe(timeSpan.getStartTime()); endTime = DateUtils.toUnixTimeNullSafe(timeSpan.getEndTime()); } else { startTime = null; endTime = null; } final Long offset; if (params instanceof TradeHistoryParamOffset) { offset = ((TradeHistoryParamOffset) params).getOffset(); } else { offset = null; } return KrakenAdapters.adaptTradesHistory( getKrakenTradeHistory(null, false, startTime, endTime, offset).getTrades()); }