Search in sources :

Example 1 with BleutradeMarket

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);
}
Also used : CurrencyPairMetaData(org.knowm.xchange.dto.meta.CurrencyPairMetaData) BleutradeCurrency(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeCurrency) BleutradeMarket(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarket) CurrencyMetaData(org.knowm.xchange.dto.meta.CurrencyMetaData) HashMap(java.util.HashMap) ExchangeMetaData(org.knowm.xchange.dto.meta.ExchangeMetaData) BleutradeCurrency(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeCurrency) Currency(org.knowm.xchange.currency.Currency) BigDecimal(java.math.BigDecimal) CurrencyPair(org.knowm.xchange.currency.CurrencyPair)

Example 2 with BleutradeMarket

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]);
    }
}
Also used : BleutradeMarket(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarket) BleutradeMarketsReturn(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarketsReturn) Test(org.junit.Test)

Example 3 with BleutradeMarket

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;
}
Also used : BleutradeMarket(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarket)

Example 4 with 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;
}
Also used : BleutradeMarket(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarket) CurrencyPair(org.knowm.xchange.currency.CurrencyPair) HashSet(java.util.HashSet)

Aggregations

BleutradeMarket (org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarket)4 CurrencyPair (org.knowm.xchange.currency.CurrencyPair)2 BigDecimal (java.math.BigDecimal)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1 BleutradeCurrency (org.knowm.xchange.bleutrade.dto.marketdata.BleutradeCurrency)1 BleutradeMarketsReturn (org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarketsReturn)1 Currency (org.knowm.xchange.currency.Currency)1 CurrencyMetaData (org.knowm.xchange.dto.meta.CurrencyMetaData)1 CurrencyPairMetaData (org.knowm.xchange.dto.meta.CurrencyPairMetaData)1 ExchangeMetaData (org.knowm.xchange.dto.meta.ExchangeMetaData)1