use of org.knowm.xchange.cryptopia.dto.CryptopiaException in project XChange by knowm.
the class CryptopiaTradeService method getTradeHistory.
@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);
}
}
use of org.knowm.xchange.cryptopia.dto.CryptopiaException in project XChange by knowm.
the class CryptopiaErrorAdapterTest method adapt_unrecognizedErrorMessage.
@Test
public void adapt_unrecognizedErrorMessage() {
CryptopiaException e = new CryptopiaException();
e.setError("Some other error message");
ExchangeException adapted = CryptopiaErrorAdapter.adapt(e);
assertThat(adapted).isExactlyInstanceOf(ExchangeException.class);
}
use of org.knowm.xchange.cryptopia.dto.CryptopiaException in project XChange by knowm.
the class CryptopiaErrorAdapterTest method adapt_noErrorMessage.
@Test
public void adapt_noErrorMessage() {
ExchangeException adapted = CryptopiaErrorAdapter.adapt(new CryptopiaException());
assertThat(adapted).isExactlyInstanceOf(ExchangeException.class);
}
use of org.knowm.xchange.cryptopia.dto.CryptopiaException in project XChange by knowm.
the class CryptopiaErrorAdapterTest method adapt_wrongMarket.
@Test
public void adapt_wrongMarket() {
CryptopiaException e = new CryptopiaException();
e.setError("Market STRG_BTC not found");
ExchangeException adapted = CryptopiaErrorAdapter.adapt(e);
assertThat(adapted).isExactlyInstanceOf(CurrencyPairNotValidException.class);
}
Aggregations