use of si.mazi.rescu.HttpStatusIOException in project XChange by knowm.
the class CmcMarketDataServiceRaw method getCmcLatestQuotes.
public Map<String, CmcTicker> getCmcLatestQuotes(Set<Currency> baseCurrencySet, Set<Currency> convertCurrencySet) throws IOException {
List<String> baseSymbols = baseCurrencySet.stream().map(c -> c.getCurrencyCode()).collect(Collectors.toList());
String commaSeparatedBaseSymbols = StringUtils.join(baseSymbols, ",");
List<String> convertSymbols = convertCurrencySet.stream().map(c -> c.getCurrencyCode()).collect(Collectors.toList());
String commaSeparatedConvertCurrencies = StringUtils.join(convertSymbols, ",");
CmcTickerResponse response = null;
try {
response = cmcAuthenticated.getLatestQuotes(apiKey, commaSeparatedBaseSymbols, commaSeparatedConvertCurrencies);
} catch (HttpStatusIOException ex) {
CmcErrorAdapter.adapt(ex);
}
return response.getData();
}
use of si.mazi.rescu.HttpStatusIOException in project XChange by knowm.
the class CmcMarketDataServiceRaw method getCmcMultipleCurrencyInfo.
public Map<String, CmcCurrencyInfo> getCmcMultipleCurrencyInfo(List<Currency> currencyList) throws IOException {
List<String> currencyCodes = currencyList.stream().map(Currency::getCurrencyCode).collect(Collectors.toList());
String commaSeparatedCurrencyCodes = StringUtils.join(currencyCodes, ",");
CmcCurrencyInfoResponse response = null;
try {
response = cmcAuthenticated.getCurrencyInfo(apiKey, commaSeparatedCurrencyCodes);
} catch (HttpStatusIOException ex) {
CmcErrorAdapter.adapt(ex);
}
return response.getData();
}
use of si.mazi.rescu.HttpStatusIOException in project XChange by knowm.
the class CmcMarketDataServiceRaw method getCmcCurrencyInfo.
public CmcCurrencyInfo getCmcCurrencyInfo(Currency currency) throws IOException {
String currencyCode = currency.getCurrencyCode();
CmcCurrencyInfoResponse response = null;
try {
response = cmcAuthenticated.getCurrencyInfo(apiKey, currencyCode);
} catch (HttpStatusIOException ex) {
CmcErrorAdapter.adapt(ex);
}
return response.getData().get(currencyCode);
}
use of si.mazi.rescu.HttpStatusIOException in project XChange by knowm.
the class QuoineTradeServiceRaw method placeMarketOrder.
public QuoineOrderResponse placeMarketOrder(CurrencyPair currencyPair, String type, BigDecimal originalAmount) throws IOException {
int productId = productId(currencyPair);
QuoineNewOrderRequest quoineNewOrderRequest = useMargin ? new QuoineNewMarginOrderRequest("market", productId, type, originalAmount, null, leverageLevel, currencyPair.counter.getCurrencyCode()) : new QuoineNewOrderRequest("market", productId, type, originalAmount, null);
try {
return quoine.placeOrder(QUOINE_API_VERSION, signatureCreator, contentType, new QuoineNewOrderRequestWrapper(quoineNewOrderRequest));
} catch (HttpStatusIOException e) {
throw handleHttpError(e);
}
}
Aggregations