use of network.bisq.api.model.MarketList in project bisq-api by mrosseel.
the class BisqProxy method calculateMarketList.
public static MarketList calculateMarketList() {
MarketList marketList = new MarketList();
// we calculate this twice but only at startup
CurrencyList currencyList = calculateCurrencyList();
// currencyList.getCurrencies().stream().flatMap(currency -> marketList.getMarkets().forEach(currency1 -> cur))
List<Market> btc = CurrencyUtil.getAllSortedCryptoCurrencies().stream().filter(cryptoCurrency -> !(cryptoCurrency.getCode().equals("BTC"))).map(cryptoCurrency -> new Market(cryptoCurrency.getCode(), "BTC")).collect(toList());
marketList.markets.addAll(btc);
btc = CurrencyUtil.getAllSortedFiatCurrencies().stream().map(cryptoCurrency -> new Market("BTC", cryptoCurrency.getCode())).collect(toList());
marketList.markets.addAll(btc);
Collections.sort(currencyList.currencies, Comparator.comparing(p -> p.name));
return marketList;
}
Aggregations