def init_config(cls):
        try:
            if cls._data_feeds_override is None:
                cls._data_feeds = [
                    CoinCapDataFeed.get_instance(),
                    CoinMetricsDataFeed.get_instance()
                ]
            else:
                cls._data_feeds = cls._data_feeds_override
            # Set default rate and source for token rates globally
            fetcher_global_config: List[List[
                str,
                str]] = global_config_map["exchange_rate_fetcher"].value or []
            # Set rate and source for tokens that needs conversion, overwrites global config
            rate_conversion_config: List[List[
                str, str, str]] = global_config_map[
                    "exchange_rate_conversion"].value or []

            if cls._exchange_rate_config_override is None:
                conversion_required = {
                    e[0]: {
                        "default": e[1],
                        "source": e[2]
                    }
                    for e in rate_conversion_config
                }
                global_config = {
                    e[0]: {
                        "default": NaN,
                        "source": e[1]
                    }
                    for e in fetcher_global_config
                }
            else:
                conversion_required = cls._exchange_rate_config_override.get(
                    "conversion_required", {})
                global_config = cls._exchange_rate_config_override.get(
                    "global_config", {})

            cls._exchange_rate_config = {
                "conversion_required": conversion_required,
                "global_config": {
                    **global_config,
                    **conversion_required
                }
            }
            cls._exchange_rate = {
                k: v["default"]
                for k, v in cls._exchange_rate_config["global_config"].items()
            }
        except Exception:
            cls.logger().error(
                "Error initiating config for exchange rate conversion.",
                exc_info=True)
 def test_get_rates(self):
     price_dict = CoinMetricsDataFeed.get_instance().price_dict
     self.assertTrue(len(price_dict) > 0)
     for asset, price in price_dict.items():
         self.assertTrue(float(price) > 0)
 def tearDownClass(cls):
     async_run(CoinMetricsDataFeed.get_instance()._session.close())
 def setUpClass(cls):
     async_run(CoinMetricsDataFeed.get_instance().fetch_data())