import { useSelector } from "react-redux";
import { selectMarketByCurrency } from "../entities/marketSelectors";
export const useMarketByCurrencies = (currencies) => {
    return useSelector(state => {
        const marketByCurrencies = {};
        for (const currency of currencies) {
            const currencyMarket = selectMarketByCurrency(state, currency.id);
            if (currencyMarket?.price !== undefined &&
                currencyMarket?.priceChangePercentage24h !== undefined) {
                marketByCurrencies[currency.id] = {
                    ...(currencyMarket.price && { price: currencyMarket.price }),
                    ...(currencyMarket.priceChangePercentage24h && {
                        priceChangePercentage24h: Math.round(currencyMarket.priceChangePercentage24h * 100) / 100,
                    }),
                };
            }
        }
        return marketByCurrencies;
    });
};
//# sourceMappingURL=useMarketByCurrencies.js.map