use of org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarket in project XChange by knowm.
the class BleutradeAdapters method adaptToExchangeMetaData.
public static ExchangeMetaData adaptToExchangeMetaData(List<BleutradeCurrency> bleutradeCurrencies, List<BleutradeMarket> bleutradeMarkets) {
Map<CurrencyPair, CurrencyPairMetaData> marketMetaDataMap = new HashMap<>();
Map<Currency, CurrencyMetaData> currencyMetaDataMap = new HashMap<>();
for (BleutradeCurrency bleutradeCurrency : bleutradeCurrencies) {
// the getTxFee parameter is the withdrawal charge in the currency in question
currencyMetaDataMap.put(Currency.getInstance(bleutradeCurrency.getCurrency()), new CurrencyMetaData(8, null));
}
// https://bleutrade.com/help/fees_and_deadlines 11/25/2015 all == 0.25%
BigDecimal txFee = new BigDecimal("0.0025");
for (BleutradeMarket bleutradeMarket : bleutradeMarkets) {
CurrencyPair currencyPair = CurrencyPairDeserializer.getCurrencyPairFromString(bleutradeMarket.getMarketName());
CurrencyPairMetaData marketMetaData = new CurrencyPairMetaData(txFee, bleutradeMarket.getMinTradeSize(), null, 8, null);
marketMetaDataMap.put(currencyPair, marketMetaData);
}
return new ExchangeMetaData(marketMetaDataMap, currencyMetaDataMap, null, null, null);
}
use of org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarket in project XChange by knowm.
the class BleutradeMarketDataServiceIntegration method shouldGetMarkets.
@Test
public void shouldGetMarkets() throws IOException {
// given
final List<BleutradeMarket> expectedBleutradeMarkets = expectedBleutradeMarkets();
final String[] expectedBleutradeMarketsStr = expectedBleutradeMarketsStr();
BleutradeMarketsReturn marketsReturn = new BleutradeMarketsReturn();
marketsReturn.setSuccess(true);
marketsReturn.setMessage("test message");
marketsReturn.setResult(expectedBleutradeMarkets);
when(bleutrade.getBleutradeMarkets()).thenReturn(marketsReturn);
// when
List<BleutradeMarket> markets = marketDataService.getBleutradeMarkets();
// then
assertThat(markets).hasSize(2);
for (int i = 0; i < markets.size(); i++) {
BleutradeAssert.assertEquals(markets.get(i), expectedBleutradeMarkets.get(i));
assertThat(markets.get(i).toString()).isEqualTo(expectedBleutradeMarketsStr[i]);
}
}
use of org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarket in project XChange by knowm.
the class BleutradeServiceTestSupport method createBleutradeMarket.
protected static BleutradeMarket createBleutradeMarket(String marketCurrency, String baseCurrency, String marketCurrencyLong, String baseCurrencyLong, BigDecimal minTradeSize, String marketName, Boolean isActive) {
BleutradeMarket bleutradeMarket = new BleutradeMarket();
bleutradeMarket.setMarketCurrency(marketCurrency);
bleutradeMarket.setBaseCurrency(baseCurrency);
bleutradeMarket.setMarketCurrencyLong(marketCurrencyLong);
bleutradeMarket.setBaseCurrencyLong(baseCurrencyLong);
bleutradeMarket.setMinTradeSize(minTradeSize);
bleutradeMarket.setMarketName(marketName);
bleutradeMarket.setIsActive(isActive);
return bleutradeMarket;
}
use of org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarket in project XChange by knowm.
the class BleutradeAdapters method adaptBleutradeCurrencyPairs.
public static Set<CurrencyPair> adaptBleutradeCurrencyPairs(BleutradeMarketsReturn response) {
List<BleutradeMarket> markets = response.getResult();
Set<CurrencyPair> currencyPairs = new HashSet<>();
for (BleutradeMarket market : markets) {
currencyPairs.add(BleutradeUtils.toCurrencyPair(market.getMarketName()));
}
return currencyPairs;
}
Aggregations