use of org.knowm.xchange.btcmarkets.dto.v3.trade.BTCMarketsTradeHistoryResponse in project XChange by knowm.
the class BTCMarketsAdaptersTest method shouldAdaptTradeHistoryResponse.
@Test
public void shouldAdaptTradeHistoryResponse() throws IOException {
final BTCMarketsTradeHistoryResponse response = parse(BTCMarketsTradeHistoryResponse.class, "v3");
final UserTrade userTrade = BTCMarketsAdapters.adaptTradeHistory(response);
assertThat(userTrade.getId()).isEqualTo("36014819");
assertThat(userTrade.getTimestamp().getTime()).isEqualTo(1561479439000L);
assertThat(userTrade.getPrice()).isEqualTo("0.67");
assertThat(userTrade.getOriginalAmount()).isEqualTo("1.50533262");
assertThat(userTrade.getType()).isEqualTo(Order.OrderType.ASK);
assertThat(userTrade.getFeeAmount()).isEqualTo("0.00857285");
assertThat(userTrade.getFeeCurrency()).isEqualTo(Currency.AUD);
assertThat(userTrade.getCurrencyPair()).isEqualTo(CurrencyPair.BTC_AUD);
}
use of org.knowm.xchange.btcmarkets.dto.v3.trade.BTCMarketsTradeHistoryResponse in project XChange by knowm.
the class BTCMarketsTradeService method getTradeHistory.
@Override
public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException {
Integer limit = 200;
if (params instanceof TradeHistoryParamPaging) {
limit = ((TradeHistoryParamPaging) params).getPageLength();
}
String after = null;
if (params instanceof TradeHistoryParamsIdSpan) {
TradeHistoryParamsIdSpan tradeHistoryParamsIdSpan = (TradeHistoryParamsIdSpan) params;
after = tradeHistoryParamsIdSpan.getStartId();
}
String before = null;
if (params instanceof TradeHistoryParamsIdSpan) {
TradeHistoryParamsIdSpan tradeHistoryParamsIdSpan = (TradeHistoryParamsIdSpan) params;
before = tradeHistoryParamsIdSpan.getEndId();
}
CurrencyPair cp = null;
if (params instanceof TradeHistoryParamCurrencyPair) {
CurrencyPair paramsCp = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair();
if (paramsCp != null) {
cp = paramsCp;
}
}
List<BTCMarketsTradeHistoryResponse> response = getBTCMarketsUserTransactions(cp, before, after, limit);
return BTCMarketsAdapters.adaptTradeHistory(response);
}
Aggregations