use of org.knowm.xchange.dto.meta.RateLimit in project XChange by knowm.
the class IdexExchange method getExchangeMetaData.
@Override
public final ExchangeMetaData getExchangeMetaData() {
ReturnCurrenciesResponse allCurrenciesStatic = null;
try {
allCurrenciesStatic = allCurrenciesStatic();
} catch (IOException e) {
e.printStackTrace();
}
LinkedHashMap<CurrencyPair, CurrencyPairMetaData> currencyPairs = new LinkedHashMap<>();
ReturnTickerRequestedWithNull allTickers = IdexMarketDataService.Companion.allTickers;
allTickers.keySet().forEach(s -> currencyPairs.put(IdexExchange.Companion.getCurrencyPair(s), unavailableCPMeta));
LinkedHashMap<Currency, CurrencyMetaData> linkedHashMap = new LinkedHashMap<>();
allCurrenciesStatic.forEach((key, value) -> linkedHashMap.put(Currency.getInstance(key), new IdexCurrencyMeta(0, ZERO, value.getAddress(), value.getName(), value.getDecimals())));
RateLimit[] publicRateLimits = {};
return new ExchangeMetaData(currencyPairs, linkedHashMap, publicRateLimits, publicRateLimits, Boolean.FALSE);
}
use of org.knowm.xchange.dto.meta.RateLimit in project XChange by knowm.
the class FtxAdapters method adaptExchangeMetaData.
public static ExchangeMetaData adaptExchangeMetaData(FtxMarketsDto marketsDto) {
Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = new HashMap<>();
Map<Currency, CurrencyMetaData> currency = new HashMap<>();
marketsDto.getMarketList().forEach(ftxMarketDto -> {
CurrencyPairMetaData currencyPairMetaData = new CurrencyPairMetaData.Builder().amountStepSize(ftxMarketDto.getPriceIncrement()).minimumAmount(ftxMarketDto.getSizeIncrement()).priceScale(ftxMarketDto.getPriceIncrement().scale()).baseScale(ftxMarketDto.getSizeIncrement().scale()).build();
if ("spot".equals(ftxMarketDto.getType())) {
CurrencyPair currencyPair = new CurrencyPair(ftxMarketDto.getBaseCurrency(), ftxMarketDto.getQuoteCurrency());
currencyPairs.put(currencyPair, currencyPairMetaData);
if (!currency.containsKey(currencyPair.base)) {
currency.put(currencyPair.base, new CurrencyMetaData(ftxMarketDto.getSizeIncrement().scale(), BigDecimal.ZERO));
}
if (!currency.containsKey(currencyPair.counter)) {
currency.put(currencyPair.counter, new CurrencyMetaData(ftxMarketDto.getPriceIncrement().scale(), BigDecimal.ZERO));
}
} else if ("future".equals(ftxMarketDto.getType()) && ftxMarketDto.getName().contains("-")) {
CurrencyPair futuresContract = new CurrencyPair(ftxMarketDto.getName());
currencyPairs.put(futuresContract, currencyPairMetaData);
}
});
RateLimit[] rateLimits = { new RateLimit(30, 1, TimeUnit.SECONDS) };
return new ExchangeMetaData(currencyPairs, currency, rateLimits, rateLimits, true);
}
use of org.knowm.xchange.dto.meta.RateLimit in project XChange by knowm.
the class BitcointoyouExchangeTest method testExchangeMetaData.
@Test
public void testExchangeMetaData() throws Exception {
final SoftAssertions softly = new SoftAssertions();
ExchangeMetaData exchangeMetaData = sut.getExchangeMetaData();
softly.assertThat(exchangeMetaData).isNotNull();
softly.assertThat(exchangeMetaData.isShareRateLimits()).isTrue();
softly.assertThat(exchangeMetaData.getCurrencies()).size().isEqualTo(1);
Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = exchangeMetaData.getCurrencyPairs();
softly.assertThat(currencyPairs).size().isEqualTo(1);
softly.assertThat(currencyPairs).size().isEqualTo(1);
softly.assertThat(exchangeMetaData.isShareRateLimits()).isTrue();
RateLimit rateLimit = exchangeMetaData.getPrivateRateLimits()[0];
softly.assertThat(rateLimit.getPollDelayMillis()).isEqualTo(10000);
softly.assertAll();
}
use of org.knowm.xchange.dto.meta.RateLimit in project XChange by knowm.
the class BitcointoyouExchangeIntegration method testExchangeMetaData.
@Test
public void testExchangeMetaData() throws Exception {
final SoftAssertions softly = new SoftAssertions();
ExchangeMetaData exchangeMetaData = sut.getExchangeMetaData();
softly.assertThat(exchangeMetaData).isNotNull();
softly.assertThat(exchangeMetaData.isShareRateLimits()).isTrue();
softly.assertThat(exchangeMetaData.getCurrencies()).size().isEqualTo(1);
Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = exchangeMetaData.getCurrencyPairs();
softly.assertThat(currencyPairs).size().isEqualTo(1);
softly.assertThat(currencyPairs).size().isEqualTo(1);
softly.assertThat(exchangeMetaData.isShareRateLimits()).isTrue();
RateLimit rateLimit = exchangeMetaData.getPrivateRateLimits()[0];
softly.assertThat(rateLimit.getPollDelayMillis()).isEqualTo(10000);
softly.assertAll();
}
Aggregations