use of org.knowm.xchange.bitfinex.v2.dto.marketdata.BitfinexPublicTrade in project XChange by knowm.
the class BitfinexAdapters method adaptPublicTrades.
public static Trades adaptPublicTrades(BitfinexPublicTrade[] trades, CurrencyPair currencyPair) {
List<Trade> tradesList = new ArrayList<>(trades.length);
long lastTradeId = 0;
for (BitfinexPublicTrade trade : trades) {
long tradeId = trade.getTradeId();
if (tradeId > lastTradeId) {
lastTradeId = tradeId;
}
tradesList.add(adaptPublicTrade(trade, currencyPair));
}
return new Trades(tradesList, lastTradeId, TradeSortType.SortByID);
}
use of org.knowm.xchange.bitfinex.v2.dto.marketdata.BitfinexPublicTrade in project XChange by knowm.
the class BitfinexAdapters method adaptPublicTrade.
public static Trade adaptPublicTrade(BitfinexPublicTrade trade, CurrencyPair currencyPair) {
OrderType orderType = trade.getType();
BigDecimal amount = trade.getAmount();
BigDecimal price = trade.getPrice();
Date date = DateUtils.fromMillisUtc(trade.getTimestamp());
final String tradeId = String.valueOf(trade.getTradeId());
return new Trade.Builder().type(orderType).originalAmount(amount == null ? null : amount.abs()).currencyPair(currencyPair).price(price).timestamp(date).id(tradeId).build();
}
Aggregations