Search in sources :

Example 1 with BleutradeCurrency

use of org.knowm.xchange.bleutrade.dto.marketdata.BleutradeCurrency in project XChange by knowm.

the class BleutradeMarketDataServiceIntegration method shouldGetCurrencies.

@Test
public void shouldGetCurrencies() throws IOException {
    // given
    final List<BleutradeCurrency> expectedBleutradeCurrencies = expectedBleutradeCurrencies();
    final String[] expectedBleutradeCurrenciesStr = expectedBleutradeCurrenciesStr();
    BleutradeCurrenciesReturn currenciesReturn = new BleutradeCurrenciesReturn();
    currenciesReturn.setSuccess(true);
    currenciesReturn.setMessage("test message");
    currenciesReturn.setResult(expectedBleutradeCurrencies);
    when(bleutrade.getBleutradeCurrencies()).thenReturn(currenciesReturn);
    // when
    List<BleutradeCurrency> currencies = marketDataService.getBleutradeCurrencies();
    // then
    assertThat(currencies).hasSize(2);
    for (int i = 0; i < currencies.size(); i++) {
        BleutradeAssert.assertEquals(currencies.get(i), expectedBleutradeCurrencies.get(i));
        assertThat(currencies.get(i).toString()).isEqualTo(expectedBleutradeCurrenciesStr[i]);
    }
}
Also used : BleutradeCurrency(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeCurrency) BleutradeCurrenciesReturn(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeCurrenciesReturn) Test(org.junit.Test)

Example 2 with BleutradeCurrency

use of org.knowm.xchange.bleutrade.dto.marketdata.BleutradeCurrency 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 3 with BleutradeCurrency

use of org.knowm.xchange.bleutrade.dto.marketdata.BleutradeCurrency in project XChange by knowm.

the class BleutradeServiceTestSupport method createBleutradeCurrency.

protected static BleutradeCurrency createBleutradeCurrency(String currency, String currencyLong, Integer minConfirmation, BigDecimal txFee, Boolean isActive, String coinType) {
    BleutradeCurrency bleutradeCurrency = new BleutradeCurrency();
    bleutradeCurrency.setCurrency(currency);
    bleutradeCurrency.setCurrencyLong(currencyLong);
    bleutradeCurrency.setMinConfirmation(minConfirmation);
    bleutradeCurrency.setTxFee(txFee);
    bleutradeCurrency.setIsActive(isActive);
    bleutradeCurrency.setCoinType(coinType);
    return bleutradeCurrency;
}
Also used : BleutradeCurrency(org.knowm.xchange.bleutrade.dto.marketdata.BleutradeCurrency)

Aggregations

BleutradeCurrency (org.knowm.xchange.bleutrade.dto.marketdata.BleutradeCurrency)3 BigDecimal (java.math.BigDecimal)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 BleutradeCurrenciesReturn (org.knowm.xchange.bleutrade.dto.marketdata.BleutradeCurrenciesReturn)1 BleutradeMarket (org.knowm.xchange.bleutrade.dto.marketdata.BleutradeMarket)1 Currency (org.knowm.xchange.currency.Currency)1 CurrencyPair (org.knowm.xchange.currency.CurrencyPair)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