use of org.knowm.xchange.hitbtc.v2.dto.HitbtcOwnTrade in project XChange by knowm.
the class HitbtcAdapters method adaptTradeHistory.
public static UserTrades adaptTradeHistory(List<HitbtcOwnTrade> tradeHistoryRaw) {
List<UserTrade> trades = new ArrayList<>(tradeHistoryRaw.size());
for (HitbtcOwnTrade hitbtcOwnTrade : tradeHistoryRaw) {
OrderType type = adaptOrderType(hitbtcOwnTrade.getSide().getValue());
CurrencyPair pair = adaptSymbol(hitbtcOwnTrade.symbol);
BigDecimal originalAmount = hitbtcOwnTrade.getQuantity();
Date timestamp = hitbtcOwnTrade.getTimestamp();
String id = Long.toString(hitbtcOwnTrade.getId());
String orderId = String.valueOf(hitbtcOwnTrade.getOrderId());
String clientOrderId = hitbtcOwnTrade.getClientOrderId();
UserTrade trade = new HitbtcUserTrade(type, originalAmount, pair, hitbtcOwnTrade.getPrice(), timestamp, id, orderId, hitbtcOwnTrade.getFee(), pair.counter, clientOrderId);
trades.add(trade);
}
return new UserTrades(trades, Trades.TradeSortType.SortByTimestamp);
}
use of org.knowm.xchange.hitbtc.v2.dto.HitbtcOwnTrade in project XChange by knowm.
the class HitbtcTradeService method getTradeHistory.
/**
* 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);
}
Aggregations