defmodule Sanbase.Billing.MetricAccessLevelTest do
  use Sanbase.DataCase, async: true

  # @moduletag skip_suite: true

  setup do
    metric_access_map = Sanbase.Metric.access_map()

    %{metric_access_map: metric_access_map}
  end

  test "incomplete metrics" do
    incomplete_metrics = Sanbase.Metric.incomplete_metrics() |> Enum.sort()

    expected =
      [
        "nft_retail_trade_volume_usd",
        "realized_value_usd_1d",
        "circulation_2y",
        "circulation_1d",
        "dormant_circulation_90d",
        "nft_collection_max_price_usd",
        "holders_distribution_0.01_to_0.1",
        "30d_moving_avg_dev_activity_change_1d",
        "realized_cap_hodl_waves_60d_to_90d",
        "holders_distribution_combined_balance_over_1k",
        "daily_trading_volume_usd",
        "realized_cap_hodl_waves_3y_to_5y",
        "daily_avg_marketcap_usd",
        "velocity",
        "holders_distribution_combined_balance_10_to_100",
        "circulation_30d",
        "holders_distribution_combined_balance_10k_to_100k",
        "holders_labeled_negative_distribution_0.01_to_0.1",
        "percent_of_spent_coins_age_band_5y_to_7y",
        "mvrv_usd_30d",
        "holders_labeled_negative_distribution_combined_balance_0_to_0.001",
        "mean_realized_price_usd_30d",
        "holders_labeled_negative_distribution_10k_to_100k",
        "mean_dollar_invested_age",
        "mean_dollar_invested_age_90d",
        "mean_dollar_invested_age_180d",
        "mean_dollar_invested_age_365d",
        "mean_dollar_invested_age_2y",
        "mean_dollar_invested_age_3y",
        "mean_dollar_invested_age_5y",
        "holders_distribution_10_to_100",
        "holders_distribution_over_1M",
        "mvrv_usd_2y",
        "fees_usd",
        "realized_cap_hodl_waves_2y_to_3y",
        "percent_of_holders_distribution_0.1_to_1",
        "holders_distribution_combined_balance_over_1M",
        "mean_realized_price_usd_365d",
        "percent_of_holders_distribution_combined_balance_10_to_100",
        "mean_realized_price_usd_90d",
        "holders_distribution_combined_balance_0.01_to_0.1",
        "network_circulation_usd_1d",
        "active_withdrawals",
        "daily_low_price_usd",
        "dormant_circulation_365d",
        "holders_distribution_combined_balance_total",
        "mvrv_usd",
        "percent_of_total_supply_on_exchanges",
        "holders_labeled_negative_distribution_combined_balance_0.001_to_0.01",
        "percent_of_spent_coins_age_band_180d_to_365d",
        "spent_coins_age_band_7d_to_30d",
        "holders_labeled_negative_distribution_combined_balance_10M_to_inf",
        "realized_value_usd",
        "mvrv_usd_5y",
        "mvrv_usd_1d",
        "realized_value_usd_30d",
        "circulation_7d",
        "total_supply",
        "realized_value_usd_5y",
        "holders_labeled_negative_distribution_combined_balance_1M_to_10M",
        "mcd_collat_ratio",
        "payments_count",
        "percent_of_holders_distribution_combined_balance_1_to_10",
        "holders_labeled_distribution_combined_balance_10M_to_inf",
        "realized_cap_hodl_waves_1d_to_7d",
        "median_fees_usd",
        "mean_realized_price_usd_180d",
        "holders_distribution_combined_balance_1M_to_10M",
        "percent_of_holders_distribution_0.01_to_0.1",
        "holders_distribution_0_to_0.001",
        "spent_coins_age_band_3y_to_5y",
        "spent_coins_age_band_7y_to_10y",
        "nvt",
        "dev_activity_change_30d",
        "github_activity_change_30d",
        "holders_labeled_distribution_combined_balance_1_to_10",
        "holders_labeled_negative_distribution_0.1_to_1",
        "holders_distribution_100k_to_1M",
        "holders_distribution_combined_balance_100k_to_1M",
        "mvrv_long_short_diff_usd",
        "holders_labeled_negative_distribution_combined_balance_total",
        "holders_distribution_10k_to_100k",
        "miners_total_supply",
        "circulation",
        "sentiment_volume_consumed_total_change_7d",
        "mvrv_usd_3y",
        "holders_labeled_distribution_0_to_0.001",
        "nft_collection_min_price_usd",
        "dev_activity_change_7d",
        "realized_value_usd_180d",
        "holders_labeled_distribution_combined_balance_10_to_100",
        "holders_labeled_negative_distribution_1M_to_10M",
        "holders_labeled_distribution_combined_balance_0.1_to_1",
        "dormant_circulation_usd_180d_change_30d",
        "holders_labeled_distribution_100_to_1k",
        "holders_distribution_0.1_to_1",
        "spent_coins_age_band_1d_to_7d",
        "spent_coins_age_band_30d_to_60d",
        "holders_distribution_over_10k",
        "dormant_circulation_10y",
        "dormant_circulation_9y",
        "dormant_circulation_8y",
        "dormant_circulation_7y",
        "circulation_10y",
        "percent_of_holders_distribution_0_to_0.001",
        "holders_labeled_distribution_combined_balance_10k_to_100k",
        "mvrv_usd_60d",
        "percent_of_holders_distribution_100k_to_1M",
        "holders_labeled_negative_distribution_10_to_100",
        "mvrv_usd_10y",
        "nft_collection_max_price",
        "mean_age",
        "mean_age_90d",
        "mean_age_180d",
        "mean_age_365d",
        "mean_age_2y",
        "mean_age_3y",
        "mean_age_5y",
        "mvrv_usd_7d",
        "percent_of_spent_coins_age_band_30d_to_60d",
        "mean_realized_price_usd_5y",
        "holders_labeled_negative_distribution_10M_to_inf",
        "circulation_365d",
        "deposit_transactions_per_exchange",
        "mvrv_usd_90d",
        "sentiment_volume_consumed_total_change_1d",
        "percent_of_spent_coins_age_band_7y_to_10y",
        "mvrv_usd_180d",
        "trending_words_rank",
        "holders_labeled_distribution_combined_balance_100_to_1k",
        "holders_distribution_1M_to_10M",
        "realized_value_usd_7d",
        "transaction_volume_profit_loss_ratio",
        "percent_of_spent_coins_age_band_1d_to_7d",
        "mcd_locked_token",
        "holders_distribution_over_1k",
        "percent_of_holders_distribution_combined_balance_0.001_to_0.01",
        "percent_of_spent_coins_age_band_365d_to_2y",
        "percent_of_holders_distribution_combined_balance_1M_to_10M",
        "holders_labeled_negative_distribution_1k_to_10k",
        "daily_closing_price_usd",
        "holders_labeled_negative_distribution_100_to_1k",
        "holders_labeled_negative_distribution_combined_balance_100k_to_1M",
        "dormant_circulation_180d",
        "holders_distribution_combined_balance_over_1",
        "percent_of_holders_distribution_10_to_100",
        "percent_of_spent_coins_age_band_60d_to_90d",
        "mcd_collat_ratio_weth",
        "percent_of_holders_distribution_combined_balance_100_to_1k",
        "mean_realized_price_usd_10y",
        "holders_labeled_negative_distribution_0.001_to_0.01",
        "holders_distribution_combined_balance_0.1_to_1",
        "holders_labeled_distribution_combined_balance_0_to_0.001",
        "holders_labeled_distribution_1M_to_10M",
        "percent_of_holders_distribution_10k_to_100k",
        "dormant_circulation_usd_180d_change_1d",
        "daily_avg_price_usd",
        "active_withdrawals_per_exchange",
        "percent_of_spent_coins_age_band_10y_to_20y",
        "dormant_circulation_2y",
        "realized_value_usd_10y",
        "daily_active_addresses",
        "aave_v2_active_addresses",
        "aave_v2_revenue",
        "aave_v2_revenue_usd",
        "aave_v2_total_protocol_revenue_usd",
        "aave_v2_total_protocol_cumulative_revenue_usd",
        "aave_v3_active_addresses",
        "aave_v3_revenue",
        "aave_v3_revenue_usd",
        "aave_v3_total_protocol_revenue_usd",
        "aave_v3_total_protocol_cumulative_revenue_usd",
        "compound_active_addresses",
        "compound_revenue",
        "compound_revenue_usd",
        "compound_total_protocol_revenue_usd",
        "compound_total_protocol_cumulative_revenue_usd",
        "compound_v3_active_addresses",
        "makerdao_active_addresses",
        "fraxlend_active_addresses",
        "spark_active_addresses",
        "fluid_active_addresses",
        "morpho_active_addresses",
        "ethena_staking_deposits",
        "ethena_staking_withdrawals",
        "ethena_staking_apy",
        "sky_savings_deposits",
        "sky_savings_withdrawals",
        "sky_savings_total_supplied",
        "sky_savings_apy",
        "pendle_total_markets_tvl",
        "pendle_underlying_apy",
        "pendle_implied_apy",
        "pendle_yield_spread",
        "holders_distribution_total",
        "holders_distribution_over_100",
        "nft_collection_avg_price_usd",
        "percent_of_holders_distribution_combined_balance_0_to_0.001",
        "daily_closing_marketcap_usd",
        "realized_value_usd_60d",
        "spent_coins_age_band_60d_to_90d",
        "circulation_usd_180d",
        "holders_labeled_negative_distribution_total",
        "dev_activity_1d",
        "dev_activity_contributors_count_7d",
        "github_activity_1d",
        "github_activity_contributors_count_7d",
        "mean_realized_price_usd",
        "withdrawal_transactions_per_exchange",
        "percent_of_holders_distribution_1_to_10",
        "holders_labeled_distribution_combined_balance_0.01_to_0.1",
        "percent_of_holders_distribution_combined_balance_10k_to_100k",
        "realized_cap_hodl_waves_30d_to_60d",
        "network_growth",
        "scd_collat_ratio",
        "defi_total_value_locked_eth",
        "holders_labeled_negative_distribution_100k_to_1M",
        "nft_collection_avg_price",
        "fees_to_network_circulation_usd_1d",
        "percent_of_spent_coins_age_band_0d_to_1d",
        "holders_labeled_distribution_0.001_to_0.01",
        "daily_opening_price_usd",
        "percent_of_spent_coins_age_band_3y_to_5y",
        "deposit_transactions",
        "holders_labeled_distribution_10_to_100",
        "dormant_circulation_usd_180d",
        "holders_labeled_negative_distribution_combined_balance_100_to_1k",
        "holders_distribution_combined_balance_over_10k",
        "holders_distribution_over_100k",
        "realized_value_usd_90d",
        "supply_outside_exchanges",
        "holders_labeled_distribution_total",
        "dormant_circulation_5y",
        "holders_distribution_0.001_to_0.01",
        "transaction_volume_usd",
        "dormant_circulation_usd_180d_change_7d",
        "average_fees_usd",
        "spent_coins_age_band_10y_to_20y",
        "realized_cap_hodl_waves_10y_to_20y",
        "scd_locked_token",
        "transactions_count",
        "realized_cap_hodl_waves_7d_to_30d",
        "percent_of_holders_distribution_1M_to_10M",
        "holders_distribution_10M_to_100M",
        "holders_distribution_100M_to_1B",
        "holders_distribution_1B_to_inf",
        "holders_distribution_combined_balance_10M_to_100M",
        "holders_distribution_combined_balance_100M_to_1B",
        "holders_distribution_combined_balance_1B_to_inf",
        "percent_of_holders_distribution_10M_to_100M",
        "percent_of_holders_distribution_100M_to_1B",
        "percent_of_holders_distribution_1B_to_inf",
        "percent_of_holders_distribution_combined_balance_10M_to_100M",
        "percent_of_holders_distribution_combined_balance_100M_to_1B",
        "percent_of_holders_distribution_combined_balance_1B_to_inf",
        "mean_realized_price_usd_1d",
        "holders_labeled_negative_distribution_combined_balance_10_to_100",
        "spent_coins_age_band_0d_to_1d",
        "holders_labeled_negative_distribution_1_to_10",
        "percent_of_holders_distribution_combined_balance_0.1_to_1",
        "circulation_usd_180d_change_7d",
        "nft_collection_trades_count",
        "percent_of_holders_distribution_combined_balance_0.01_to_0.1",
        "mcd_erc20_supply",
        "nft_retail_trades_count",
        "nft_whale_trades_count",
        "realized_cap_hodl_waves_90d_to_180d",
        "holders_labeled_distribution_0.01_to_0.1",
        "holders_distribution_combined_balance_0.001_to_0.01",
        "realized_value_usd_2y",
        "holders_labeled_distribution_combined_balance_total",
        "mean_realized_price_usd_7d",
        "realized_cap_hodl_waves_180d_to_365d",
        "mvrv_usd_z_score",
        "holders_labeled_negative_distribution_combined_balance_1k_to_10k",
        "active_deposits_per_exchange",
        "holders_labeled_negative_distribution_combined_balance_1_to_10",
        "realized_cap_hodl_waves_5y_to_10y",
        "percent_of_holders_distribution_0.001_to_0.01",
        "holders_labeled_distribution_combined_balance_100k_to_1M",
        "holders_labeled_distribution_1_to_10",
        "holders_distribution_over_10",
        "nft_collection_min_price",
        "transaction_volume_in_profit",
        "transaction_volume_in_loss",
        "percent_of_spent_coins_age_band_90d_to_180d",
        "holders_distribution_combined_balance_1k_to_10k",
        "nft_whale_trade_volume_usd",
        "realized_cap_hodl_waves_365d_to_2y",
        "circulation_90d",
        "spent_coins_age_band_2y_to_3y",
        "circulation_180d",
        "percent_of_holders_distribution_combined_balance_100k_to_1M",
        "fees",
        "holders_distribution_1_to_10",
        "holders_labeled_distribution_0.1_to_1",
        "holders_distribution_combined_balance_100_to_1k",
        "holders_distribution_combined_balance_1_to_10",
        "supply_on_exchanges",
        "holders_labeled_distribution_10k_to_100k",
        "holders_labeled_negative_distribution_0_to_0.001",
        "circulation_3y",
        "nft_trade_volume_usd",
        "holders_labeled_distribution_1k_to_10k",
        "percent_of_holders_distribution_100_to_1k",
        "realized_value_usd_3y",
        "spent_coins_age_band_180d_to_365d",
        "dev_activity_change_1d",
        "holders_labeled_distribution_combined_balance_1k_to_10k",
        "holders_distribution_combined_balance_over_100k",
        "circulation_5y",
        "holders_distribution_1k_to_10k",
        "circulation_usd_180d_change_30d",
        "dormant_circulation_3y",
        "percent_of_holders_distribution_1k_to_10k",
        "holders_distribution_combined_balance_over_10",
        "percent_of_spent_coins_age_band_2y_to_3y",
        "holders_labeled_distribution_combined_balance_0.001_to_0.01",
        "holders_labeled_negative_distribution_combined_balance_0.1_to_1",
        "spent_coins_age_band_365d_to_2y",
        "spent_coins_age_band_5y_to_7y",
        "holders_labeled_negative_distribution_combined_balance_0.01_to_0.1",
        "holders_distribution_100_to_1k",
        "percent_of_spent_coins_age_band_7d_to_30d",
        "mvrv_usd_365d",
        "mean_realized_price_usd_2y",
        "stock_to_flow",
        "active_deposits",
        "holders_labeled_distribution_100k_to_1M",
        "withdrawal_transactions",
        "mcd_collat_ratio_sai",
        "percent_of_holders_distribution_combined_balance_1k_to_10k",
        "holders_distribution_combined_balance_0_to_0.001",
        "holders_labeled_distribution_10M_to_inf",
        "realized_cap_hodl_waves_0d_to_1d",
        "holders_labeled_distribution_combined_balance_1M_to_10M",
        "holders_distribution_over_1",
        "rank",
        "sentiment_volume_consumed_total_change_30d",
        "nft_trades_count",
        "mcd_dsr",
        "defi_total_value_locked_usd",
        "mcd_stability_fee",
        "circulation_usd_180d_change_1d",
        "daily_high_price_usd",
        "circulation_60d",
        "spent_coins_age_band_90d_to_180d",
        "mean_realized_price_usd_3y",
        "mean_realized_price_usd_60d",
        "realized_value_usd_365d",
        "holders_distribution_combined_balance_over_100",
        "holders_labeled_negative_distribution_combined_balance_10k_to_100k",
        "nft_market_volume",
        "nft_market_count",
        "nft_collection_holders_balance",
        "nft_collection_profit_loss",
        "nft_collection_profit_loss_usd",
        "active_holders_distribution_0.001_to_0.01",
        "active_holders_distribution_0.01_to_0.1",
        "active_holders_distribution_0.1_to_1",
        "active_holders_distribution_0_to_0.001",
        "active_holders_distribution_100_to_1k",
        "active_holders_distribution_100k_to_1M",
        "active_holders_distribution_10M_to_inf",
        "active_holders_distribution_10_to_100",
        "active_holders_distribution_10k_to_100k",
        "active_holders_distribution_1M_to_10M",
        "active_holders_distribution_1_to_10",
        "active_holders_distribution_1k_to_10k",
        "active_holders_distribution_combined_balance_0.001_to_0.01",
        "active_holders_distribution_combined_balance_0.01_to_0.1",
        "active_holders_distribution_combined_balance_0.1_to_1",
        "active_holders_distribution_combined_balance_0_to_0.001",
        "active_holders_distribution_combined_balance_100_to_1k",
        "active_holders_distribution_combined_balance_100k_to_1M",
        "active_holders_distribution_combined_balance_10M_to_inf",
        "active_holders_distribution_combined_balance_10_to_100",
        "active_holders_distribution_combined_balance_10k_to_100k",
        "active_holders_distribution_combined_balance_1M_to_10M",
        "active_holders_distribution_combined_balance_1_to_10",
        "active_holders_distribution_combined_balance_1k_to_10k",
        "active_holders_distribution_combined_balance_total",
        "active_holders_distribution_total",
        "active_holders_distribution_over_1",
        "active_holders_distribution_over_10",
        "active_holders_distribution_over_100",
        "active_holders_distribution_over_1k",
        "active_holders_distribution_over_10k",
        "active_holders_distribution_over_100k",
        "active_holders_distribution_over_1M",
        "active_holders_distribution_combined_balance_over_1",
        "active_holders_distribution_combined_balance_over_10",
        "active_holders_distribution_combined_balance_over_100",
        "active_holders_distribution_combined_balance_over_1k",
        "active_holders_distribution_combined_balance_over_10k",
        "active_holders_distribution_combined_balance_over_100k",
        "active_holders_distribution_combined_balance_over_1M",
        "percent_of_active_holders_distribution_combined_balance_0_to_0.001",
        "percent_of_active_holders_distribution_combined_balance_0.001_to_0.01",
        "percent_of_active_holders_distribution_combined_balance_0.01_to_0.1",
        "percent_of_active_holders_distribution_combined_balance_0.1_to_1",
        "percent_of_active_holders_distribution_combined_balance_1_to_10",
        "percent_of_active_holders_distribution_combined_balance_10_to_100",
        "percent_of_active_holders_distribution_combined_balance_100_to_1k",
        "percent_of_active_holders_distribution_combined_balance_1k_to_10k",
        "percent_of_active_holders_distribution_combined_balance_10k_to_100k",
        "percent_of_active_holders_distribution_combined_balance_100k_to_1M",
        "percent_of_active_holders_distribution_combined_balance_1M_to_10M",
        "percent_of_active_holders_distribution_combined_balance_10M_to_inf",
        "percent_of_active_holders_distribution_0_to_0.001",
        "percent_of_active_holders_distribution_0.001_to_0.01",
        "percent_of_active_holders_distribution_0.01_to_0.1",
        "percent_of_active_holders_distribution_0.1_to_1",
        "percent_of_active_holders_distribution_1_to_10",
        "percent_of_active_holders_distribution_10_to_100",
        "percent_of_active_holders_distribution_100_to_1k",
        "percent_of_active_holders_distribution_1k_to_10k",
        "percent_of_active_holders_distribution_10k_to_100k",
        "percent_of_active_holders_distribution_100k_to_1M",
        "percent_of_active_holders_distribution_1M_to_10M",
        "percent_of_active_holders_distribution_10M_to_inf",
        "adjusted_price_daa_divergence",
        "circulation_180d_change_1d",
        "circulation_180d_change_30d",
        "circulation_180d_change_7d",
        "circulation_change_1d",
        "circulation_change_30d",
        "circulation_change_7d",
        "dormant_circulation_365d_change_1d",
        "dormant_circulation_365d_change_30d",
        "dormant_circulation_365d_change_7d",
        "marketcap_usd_change_1d",
        "marketcap_usd_change_30d",
        "marketcap_usd_change_7d",
        "mean_dollar_invested_age_change_1d",
        "mean_dollar_invested_age_change_30d",
        "mean_dollar_invested_age_change_7d",
        "mvrv_usd_180d_change_1d",
        "mvrv_usd_180d_change_30d",
        "mvrv_usd_180d_change_7d",
        "mvrv_usd_30d_change_1d",
        "mvrv_usd_30d_change_30d",
        "mvrv_usd_30d_change_7d",
        "mvrv_usd_365d_change_1d",
        "mvrv_usd_365d_change_30d",
        "mvrv_usd_365d_change_7d",
        "mvrv_usd_60d_change_1d",
        "mvrv_usd_60d_change_30d",
        "mvrv_usd_60d_change_7d",
        "mvrv_usd_7d_change_1d",
        "mvrv_usd_7d_change_30d",
        "mvrv_usd_7d_change_7d",
        "mvrv_usd_90d_change_1d",
        "mvrv_usd_90d_change_30d",
        "mvrv_usd_90d_change_7d",
        "mvrv_usd_change_1d",
        "mvrv_usd_change_30d",
        "mvrv_usd_change_7d",
        "network_growth_change_1d",
        "network_growth_change_30d",
        "network_growth_change_7d",
        "percent_of_total_supply_on_exchanges_change_1d",
        "percent_of_total_supply_on_exchanges_change_30d",
        "percent_of_total_supply_on_exchanges_change_7d",
        "transaction_volume_change_1d",
        "transaction_volume_change_30d",
        "transaction_volume_change_7d",
        "transaction_volume_usd_change_1d",
        "transaction_volume_usd_change_30d",
        "transaction_volume_usd_change_7d",
        "eth2_stakers_realized_value_usd_365d",
        "eth2_stakers_realized_value_usd_2y",
        "eth2_stakers_realized_value_usd_3y",
        "eth2_stakers_realized_value_usd_5y",
        "eth2_stakers_realized_value_usd_10y",
        "eth2_stakers_mvrv_usd_365d",
        "eth2_stakers_mvrv_usd_2y",
        "eth2_stakers_mvrv_usd_3y",
        "eth2_stakers_mvrv_usd_5y",
        "eth2_stakers_mvrv_usd_10y",
        # XRP metrics
        "daily_assets_issued",
        "total_assets_issued",
        "daily_trustlines_count_change",
        "total_trustlines_count",
        "dex_volume_in_xrp_5m",
        "dex_volume_in_usd_5m",
        "rsi_4h",
        "rsi_1d",
        "rsi_7d",
        # ecosystem aggregated metrics
        "ecosystem_dev_activity",
        "ecosystem_github_activity",
        "ecosystem_dev_activity_contributors_count_7d",
        "ecosystem_github_activity_contributors_count_7d",
        "gini_index",
        "annual_inflation_rate",
        # Social metrics
        "unique_social_volume_total_1d",
        # Sentiment V2 metrics
        "sentiment_weighted_4chan_1d_v2",
        "sentiment_weighted_bitcointalk_1d_v2",
        "sentiment_weighted_reddit_1d_v2",
        "sentiment_weighted_telegram_1d_v2",
        "sentiment_weighted_total_1d_v2",
        "sentiment_weighted_twitter_1d_v2",
        "sentiment_weighted_farcaster_1d",
        "sentiment_weighted_4chan_1d",
        "sentiment_weighted_bitcointalk_1d",
        "sentiment_weighted_reddit_1d",
        "sentiment_weighted_telegram_1d",
        "sentiment_weighted_total_1d",
        "sentiment_weighted_twitter_1d",
        "sentiment_weighted_youtube_videos_1d",
        "sentiment_weighted_youtube_videos_1d_v2",
        "unique_social_volume_4chan_1d",
        "unique_social_volume_bitcointalk_1d",
        "unique_social_volume_farcaster_1d",
        "unique_social_volume_reddit_1d",
        "unique_social_volume_telegram_1d",
        "unique_social_volume_twitter_1d",
        # Liquity metrics
        "liquity_active_addresses",
        "liquidity_in_amm_pools_by_asset",
        "liquidity_in_amm_pools_by_pair"
      ]
      |> Enum.sort()

    missing_expected_incomplete = expected -- incomplete_metrics
    unexpected_incomplete_metrics = incomplete_metrics -- expected

    # Asserting on the difference generates much more short and clear
    # error messages
    assert missing_expected_incomplete == []
    assert unexpected_incomplete_metrics == []
  end

  test "free metrics", %{metric_access_map: access_map} do
    free_metrics =
      Sanbase.Billing.ApiInfo.get_with_access_level(access_map, :free)
      |> Enum.sort()

    expected =
      [
        "active_addresses_60d",
        "active_addresses_90d",
        "active_addresses_30d",
        "active_addresses_7d",
        "active_addresses_24h",
        "active_addresses_1h",
        "circulation",
        "daily_active_addresses",
        "daily_avg_marketcap_usd",
        "daily_avg_price_usd",
        "daily_closing_marketcap_usd",
        "daily_closing_price_usd",
        "daily_high_price_usd",
        "daily_low_price_usd",
        "daily_opening_price_usd",
        "daily_trading_volume_usd",
        "dev_activity",
        "dev_activity_1d",
        "github_activity_1d",
        "dev_activity_contributors_count",
        "github_activity_contributors_count",
        "dev_activity_contributors_count_7d",
        "github_activity_contributors_count_7d",
        "30d_moving_avg_dev_activity_change_1d",
        "github_activity",
        "historical_balance",
        "historical_balance_changes",
        "marketcap_usd",
        "price_btc",
        "price_usd",
        "price_usdt",
        "price_eth",
        "price_usd_5m",
        "volume_usd",
        "volume_usd_5m",
        "twitter_followers",
        "total_supply",
        "mcd_erc20_supply",
        "rank",
        "etf_volume_usd_5m",
        "dex_amm_volume_in_xrp_5min",
        "dex_amm_volume_in_usd_5min",
        # change metrics
        "volume_usd_change_1d",
        "volume_usd_change_7d",
        "volume_usd_change_30d",
        "price_usd_change_1d",
        "price_usd_change_7d",
        "price_usd_change_30d",
        "active_addresses_24h_change_1d",
        "active_addresses_24h_change_7d",
        "active_addresses_24h_change_30d",
        "dev_activity_change_1d",
        "dev_activity_change_7d",
        "dev_activity_change_30d",
        "github_activity_change_30d",
        "marketcap_usd_change_1d",
        "marketcap_usd_change_7d",
        "marketcap_usd_change_30d",
        # Uniswap
        "uniswap_total_claims_amount",
        "uniswap_claims_amount",
        "uniswap_claims_count",
        "uniswap_total_claims_count",
        "uniswap_lp_claims_amount",
        "uniswap_lp_claims_count",
        "uniswap_total_claims_percent",
        "uniswap_total_lp_claims_amount",
        "uniswap_total_lp_claims_count",
        "uniswap_total_user_claims_amount",
        "uniswap_total_user_claims_count",
        "uniswap_user_claims_amount",
        "uniswap_user_claims_count",
        # histogram metrics
        "eth2_staked_amount_per_label",
        "eth2_staked_address_count_per_label",
        "eth2_top_stakers",
        "eth2_staking_pools",
        "eth2_staking_pools_usd",
        "eth2_staking_pools_validators_count_over_time",
        "eth2_staking_pools_validators_count_over_time_delta",
        "price_usd_change_1h",
        "price_eth_change_1d",
        "price_eth_change_7d",
        "price_eth_change_30d",
        "price_btc_change_1d",
        "price_btc_change_7d",
        "price_btc_change_30d",
        "price_volatility_1d",
        "price_volatility_1w",
        "price_volatility_2w",
        "price_volatility_4w",
        "ecosystem_dev_activity",
        "ecosystem_github_activity",
        "ecosystem_dev_activity_contributors_count_7d",
        "ecosystem_github_activity_contributors_count_7d",
        "gini_index",
        "annual_inflation_rate",
        "money_supply",
        "fully_diluted_valuation_usd"
      ]
      |> Enum.sort()

    missing_expected_free = expected -- free_metrics
    unexpected_free_metrics = free_metrics -- expected

    # Asserting on the difference generates much more short and clear
    # error messages
    assert missing_expected_free == []
    assert unexpected_free_metrics == []
  end

  test "restricted metrics", %{metric_access_map: access_map} do
    restricted_metrics =
      Sanbase.Billing.ApiInfo.get_with_access_level(access_map, :restricted)
      |> Enum.sort()

    expected_restricted_metrics =
      [
        "mean_realized_price_usd",
        "mean_realized_price_usd_10y",
        "mean_realized_price_usd_5y",
        "mean_realized_price_usd_3y",
        "mean_realized_price_usd_2y",
        "mean_realized_price_usd_365d",
        "mean_realized_price_usd_180d",
        "mean_realized_price_usd_90d",
        "mean_realized_price_usd_60d",
        "mean_realized_price_usd_30d",
        "mean_realized_price_usd_7d",
        "mean_realized_price_usd_1d",
        # mvrv Metrics
        "mvrv_long_short_diff_usd",
        "mvrv_usd",
        "mvrv_usd_10y",
        "mvrv_usd_5y",
        "mvrv_usd_3y",
        "mvrv_usd_2y",
        "mvrv_usd_365d",
        "mvrv_usd_180d",
        "mvrv_usd_90d",
        "mvrv_usd_60d",
        "mvrv_usd_30d",
        "mvrv_usd_7d",
        "mvrv_usd_1d",
        "mvrv_usd_intraday",
        "mvrv_usd_intraday_10y",
        "mvrv_usd_intraday_5y",
        "mvrv_usd_intraday_3y",
        "mvrv_usd_intraday_2y",
        "mvrv_usd_intraday_365d",
        "mvrv_usd_intraday_180d",
        "mvrv_usd_intraday_90d",
        "mvrv_usd_intraday_60d",
        "mvrv_usd_intraday_30d",
        "mvrv_usd_intraday_7d",
        "mvrv_usd_intraday_1d",
        # circulation metrics
        "circulation_10y",
        "circulation_5y",
        "circulation_3y",
        "circulation_2y",
        "circulation_365d",
        "circulation_180d",
        "circulation_90d",
        "circulation_60d",
        "circulation_30d",
        "circulation_7d",
        "circulation_1d",
        "circulation_usd_180d",
        # dormant ciruclation
        "dormant_circulation_10y",
        "dormant_circulation_9y",
        "dormant_circulation_8y",
        "dormant_circulation_7y",
        "dormant_circulation_5y",
        "dormant_circulation_3y",
        "dormant_circulation_2y",
        "dormant_circulation_365d",
        "dormant_circulation_180d",
        "dormant_circulation_90d",
        "dormant_circulation_usd_180d",
        # other
        "mean_age",
        "mean_age_90d",
        "mean_age_180d",
        "mean_age_365d",
        "mean_age_2y",
        "mean_age_3y",
        "mean_age_5y",
        "mean_dollar_invested_age",
        "mean_dollar_invested_age_90d",
        "mean_dollar_invested_age_180d",
        "mean_dollar_invested_age_365d",
        "mean_dollar_invested_age_2y",
        "mean_dollar_invested_age_3y",
        "mean_dollar_invested_age_5y",
        "realized_value_usd",
        "realized_value_usd_10y",
        "realized_value_usd_5y",
        "realized_value_usd_3y",
        "realized_value_usd_2y",
        "realized_value_usd_365d",
        "realized_value_usd_180d",
        "realized_value_usd_90d",
        "realized_value_usd_60d",
        "realized_value_usd_30d",
        "realized_value_usd_7d",
        "realized_value_usd_1d",
        "velocity",
        "transaction_volume",
        "transaction_volume_usd",
        "exchange_inflow",
        "exchange_outflow",
        "exchange_balance",
        "exchange_inflow_usd",
        "exchange_outflow_usd",
        "age_consumed",
        "age_consumed_change_1d",
        "age_consumed_change_30d",
        "age_consumed_change_7d",
        "age_destroyed",
        "nvt",
        "nvt_transaction_volume",
        "nvt_5min",
        "network_growth",
        "active_deposits",
        "deposit_transactions",
        "active_withdrawals",
        "withdrawal_transactions",
        "active_deposits_5m",
        "deposit_transactions_5m",
        "active_withdrawals_5m",
        "withdrawal_transactions_5m",
        "payments_count",
        "transactions_count",
        "fees",
        "fees_usd",
        "fees_intraday",
        "fees_usd_intraday",
        "average_fees_usd",
        "median_fees_usd",
        "average_fees_usd_5m",
        "median_fees_usd_5m",
        "fees_burnt_5m",
        "fees_burnt_usd_5m",
        "network_circulation_usd_1d",
        "fees_to_network_circulation_usd_1d",
        "avg_gas_used",
        "total_gas_used",
        "network_profit_loss",
        "total_supply_in_profit",
        "percent_of_total_supply_in_profit",
        "average_transfer_5m",
        "median_transfer_5m",
        "whale_transaction_count_100k_usd_to_inf",
        "whale_transaction_count_1m_usd_to_inf",
        "whale_transaction_volume_100k_usd_to_inf",
        "whale_transaction_volume_1m_usd_to_inf",
        "mvrv_usd_z_score",
        "stock_to_flow",
        "miners_total_supply",
        "percent_of_whale_stablecoin_total_supply",
        "transaction_volume_in_profit",
        "transaction_volume_in_loss",
        "transaction_volume_profit_loss_ratio",
        "exchange_open_interest",
        "open_interest_per_settlement_currency",
        "total_open_interest",
        "funding_rates_aggregated_by_exchange",
        "funding_rates_aggregated_by_settlement_currency",
        "total_funding_rates_aggregated_per_asset",
        "rsi_4h",
        "rsi_1d",
        "rsi_7d",
        # social metrics
        "community_messages_count_telegram",
        "community_messages_count_reddit",
        "community_messages_count_total",
        "nft_social_volume",
        "social_dominance_4chan",
        "social_dominance_reddit",
        "social_dominance_telegram",
        "social_dominance_bitcointalk",
        "social_dominance_farcaster",
        "social_dominance_twitter",
        "social_dominance_youtube_videos",
        "social_dominance_total",
        "social_dominance_ai_total",
        "social_dominance_total_1h_moving_average",
        "social_dominance_total_24h_moving_average",
        "social_dominance_ai_total_1h_moving_average",
        "social_dominance_ai_total_24h_moving_average",
        "social_dominance_4chan_1h_moving_average",
        "social_dominance_4chan_24h_moving_average",
        "social_dominance_telegram_1h_moving_average",
        "social_dominance_telegram_24h_moving_average",
        "social_dominance_reddit_1h_moving_average",
        "social_dominance_reddit_24h_moving_average",
        "social_dominance_twitter_1h_moving_average",
        "social_dominance_twitter_24h_moving_average",
        "social_dominance_youtube_videos_1h_moving_average",
        "social_dominance_youtube_videos_24h_moving_average",
        "social_dominance_bitcointalk_1h_moving_average",
        "social_dominance_bitcointalk_24h_moving_average",
        "social_volume_4chan",
        "social_volume_reddit",
        "social_volume_twitter",
        "social_volume_youtube_videos",
        "social_volume_bitcointalk",
        "social_volume_farcaster",
        "social_volume_telegram",
        "social_volume_total",
        "social_volume_ai_total",
        "unique_social_volume_total_5m",
        "unique_social_volume_total_1h",
        "unique_social_volume_total_1d",
        "unique_social_volume_telegram_5m",
        "unique_social_volume_telegram_1h",
        "unique_social_volume_telegram_1d",
        "unique_social_volume_reddit_5m",
        "unique_social_volume_reddit_1h",
        "unique_social_volume_reddit_1d",
        "unique_social_volume_twitter_5m",
        "unique_social_volume_twitter_1h",
        "unique_social_volume_twitter_1d",
        "unique_social_volume_bitcointalk_5m",
        "unique_social_volume_bitcointalk_1h",
        "unique_social_volume_bitcointalk_1d",
        "unique_social_volume_4chan_5m",
        "unique_social_volume_4chan_1h",
        "unique_social_volume_4chan_1d",
        "unique_social_volume_farcaster_5m",
        "unique_social_volume_farcaster_1h",
        "unique_social_volume_farcaster_1d",
        "community_social_volume_telegram",
        "community_social_volume_reddit",
        "sentiment_positive_4chan",
        "sentiment_positive_telegram",
        "sentiment_positive_reddit",
        "sentiment_positive_twitter",
        "sentiment_positive_youtube_videos",
        "sentiment_positive_bitcointalk",
        "sentiment_positive_farcaster",
        "sentiment_positive_total",
        "sentiment_negative_4chan",
        "sentiment_negative_telegram",
        "sentiment_negative_reddit",
        "sentiment_negative_twitter",
        "sentiment_negative_youtube_videos",
        "sentiment_negative_bitcointalk",
        "sentiment_negative_farcaster",
        "sentiment_negative_total",
        "sentiment_balance_4chan",
        "sentiment_balance_telegram",
        "sentiment_balance_reddit",
        "sentiment_balance_twitter",
        "sentiment_balance_youtube_videos",
        "sentiment_balance_bitcointalk",
        "sentiment_balance_farcaster",
        "sentiment_balance_total",
        # bullish/bearsih/neutral sentiment metrics
        "sentiment_bearish_4chan",
        "sentiment_bearish_bitcointalk",
        "sentiment_bearish_farcaster",
        "sentiment_bearish_reddit",
        "sentiment_bearish_telegram",
        "sentiment_bearish_total",
        "sentiment_bearish_twitter",
        "sentiment_bearish_youtube_videos",
        "sentiment_bullish_4chan",
        "sentiment_bullish_bitcointalk",
        "sentiment_bullish_farcaster",
        "sentiment_bullish_reddit",
        "sentiment_bullish_telegram",
        "sentiment_bullish_total",
        "sentiment_bullish_twitter",
        "sentiment_bullish_youtube_videos",
        "sentiment_neutral_4chan",
        "sentiment_neutral_bitcointalk",
        "sentiment_neutral_farcaster",
        "sentiment_neutral_reddit",
        "sentiment_neutral_telegram",
        "sentiment_neutral_total",
        "sentiment_neutral_twitter",
        "sentiment_neutral_youtube_videos",
        # old volume_consumed metrics
        "sentiment_volume_consumed_4chan",
        "sentiment_volume_consumed_telegram",
        "sentiment_volume_consumed_reddit",
        "sentiment_volume_consumed_twitter",
        "sentiment_volume_consumed_youtube_videos",
        "sentiment_volume_consumed_bitcointalk",
        "sentiment_volume_consumed_farcaster",
        "sentiment_volume_consumed_total",
        # volume_consumed gets renamed to weighted
        "sentiment_weighted_4chan",
        "sentiment_weighted_telegram",
        "sentiment_weighted_reddit",
        "sentiment_weighted_twitter",
        "sentiment_weighted_youtube_videos",
        "sentiment_weighted_bitcointalk",
        "sentiment_weighted_farcaster",
        "sentiment_weighted_total",
        # Social metrics V2
        "sentiment_balance_4chan_v2",
        "sentiment_balance_bitcointalk_v2",
        "sentiment_balance_reddit_v2",
        "sentiment_balance_telegram_v2",
        "sentiment_balance_total_v2",
        "sentiment_balance_twitter_v2",
        "sentiment_balance_youtube_videos_v2",
        "sentiment_weighted_4chan_1d_v2",
        "sentiment_weighted_4chan_1h_v2",
        "sentiment_weighted_4chan_v2",
        "sentiment_weighted_bitcointalk_1d_v2",
        "sentiment_weighted_bitcointalk_1h_v2",
        "sentiment_weighted_bitcointalk_v2",
        "sentiment_weighted_reddit_1d_v2",
        "sentiment_weighted_reddit_1h_v2",
        "sentiment_weighted_reddit_v2",
        "sentiment_weighted_telegram_1d_v2",
        "sentiment_weighted_telegram_1h_v2",
        "sentiment_weighted_telegram_v2",
        "sentiment_weighted_total_1d_v2",
        "sentiment_weighted_total_1h_v2",
        "sentiment_weighted_total_v2",
        "sentiment_weighted_twitter_1d_v2",
        "sentiment_weighted_twitter_1h_v2",
        "sentiment_weighted_twitter_v2",
        "sentiment_weighted_youtube_videos_1d_v2",
        "sentiment_weighted_youtube_videos_1h_v2",
        "sentiment_weighted_youtube_videos_v2",
        # social v2 metrics
        "unique_social_volume_total_1d",
        "social_active_users",
        "trending_words_rank",
        # histogram metrics
        "mentions_count_total",
        "mentions_percentage_twitter",
        "mentions_percentage_total",
        "mentions_percentage_1h_total",
        "mentions_count_twitter",
        # social metrics for all accounts
        "age_distribution",
        "price_histogram",
        "spent_coins_cost",
        "all_spent_coins_cost",
        "uniswap_top_claimers",
        # exchange supply metrics
        "supply_on_exchanges",
        "supply_outside_exchanges",
        "percent_of_total_supply_on_exchanges",
        # top holders metrics
        "amount_in_top_holders",
        "amount_in_exchange_top_holders",
        "amount_in_non_exchange_top_holders",
        # holders distribution metrics
        "holders_distribution_0.001_to_0.01",
        "holders_distribution_0.01_to_0.1",
        "holders_distribution_0.1_to_1",
        "holders_distribution_0_to_0.001",
        "holders_distribution_100_to_1k",
        "holders_distribution_100k_to_1M",
        "holders_distribution_1B_to_inf",
        "holders_distribution_10_to_100",
        "holders_distribution_10k_to_100k",
        "holders_distribution_1M_to_10M",
        "holders_distribution_1_to_10",
        "holders_distribution_1k_to_10k",
        "holders_distribution_10M_to_100M",
        "holders_distribution_100M_to_1B",
        "holders_distribution_combined_balance_0.001_to_0.01",
        "holders_distribution_combined_balance_0.01_to_0.1",
        "holders_distribution_combined_balance_0.1_to_1",
        "holders_distribution_combined_balance_0_to_0.001",
        "holders_distribution_combined_balance_100_to_1k",
        "holders_distribution_combined_balance_100k_to_1M",
        "holders_distribution_combined_balance_1B_to_inf",
        "holders_distribution_combined_balance_10_to_100",
        "holders_distribution_combined_balance_10k_to_100k",
        "holders_distribution_combined_balance_1M_to_10M",
        "holders_distribution_combined_balance_1_to_10",
        "holders_distribution_combined_balance_1k_to_10k",
        "holders_distribution_combined_balance_10M_to_100M",
        "holders_distribution_combined_balance_100M_to_1B",
        "holders_distribution_combined_balance_total",
        "holders_distribution_total",
        "holders_distribution_over_1",
        "holders_distribution_over_10",
        "holders_distribution_over_100",
        "holders_distribution_over_1k",
        "holders_distribution_over_10k",
        "holders_distribution_over_100k",
        "holders_distribution_over_1M",
        "holders_distribution_combined_balance_over_1",
        "holders_distribution_combined_balance_over_10",
        "holders_distribution_combined_balance_over_100",
        "holders_distribution_combined_balance_over_1k",
        "holders_distribution_combined_balance_over_10k",
        "holders_distribution_combined_balance_over_100k",
        "holders_distribution_combined_balance_over_1M",
        "percent_of_holders_distribution_combined_balance_0_to_0.001",
        "percent_of_holders_distribution_combined_balance_0.001_to_0.01",
        "percent_of_holders_distribution_combined_balance_0.01_to_0.1",
        "percent_of_holders_distribution_combined_balance_0.1_to_1",
        "percent_of_holders_distribution_combined_balance_1_to_10",
        "percent_of_holders_distribution_combined_balance_10_to_100",
        "percent_of_holders_distribution_combined_balance_100_to_1k",
        "percent_of_holders_distribution_combined_balance_1k_to_10k",
        "percent_of_holders_distribution_combined_balance_10k_to_100k",
        "percent_of_holders_distribution_combined_balance_100k_to_1M",
        "percent_of_holders_distribution_combined_balance_1M_to_10M",
        "percent_of_holders_distribution_combined_balance_10M_to_100M",
        "percent_of_holders_distribution_combined_balance_100M_to_1B",
        "percent_of_holders_distribution_combined_balance_1B_to_inf",
        "percent_of_holders_distribution_0_to_0.001",
        "percent_of_holders_distribution_0.001_to_0.01",
        "percent_of_holders_distribution_0.01_to_0.1",
        "percent_of_holders_distribution_0.1_to_1",
        "percent_of_holders_distribution_1_to_10",
        "percent_of_holders_distribution_10_to_100",
        "percent_of_holders_distribution_100_to_1k",
        "percent_of_holders_distribution_1k_to_10k",
        "percent_of_holders_distribution_10k_to_100k",
        "percent_of_holders_distribution_100k_to_1M",
        "percent_of_holders_distribution_1M_to_10M",
        "percent_of_holders_distribution_10M_to_100M",
        "percent_of_holders_distribution_100M_to_1B",
        "percent_of_holders_distribution_1B_to_inf",
        # active holders distribution metrics
        "active_holders_distribution_0.001_to_0.01",
        "active_holders_distribution_0.01_to_0.1",
        "active_holders_distribution_0.1_to_1",
        "active_holders_distribution_0_to_0.001",
        "active_holders_distribution_100_to_1k",
        "active_holders_distribution_100k_to_1M",
        "active_holders_distribution_10M_to_inf",
        "active_holders_distribution_10_to_100",
        "active_holders_distribution_10k_to_100k",
        "active_holders_distribution_1M_to_10M",
        "active_holders_distribution_1_to_10",
        "active_holders_distribution_1k_to_10k",
        "active_holders_distribution_combined_balance_0.001_to_0.01",
        "active_holders_distribution_combined_balance_0.01_to_0.1",
        "active_holders_distribution_combined_balance_0.1_to_1",
        "active_holders_distribution_combined_balance_0_to_0.001",
        "active_holders_distribution_combined_balance_100_to_1k",
        "active_holders_distribution_combined_balance_100k_to_1M",
        "active_holders_distribution_combined_balance_10M_to_inf",
        "active_holders_distribution_combined_balance_10_to_100",
        "active_holders_distribution_combined_balance_10k_to_100k",
        "active_holders_distribution_combined_balance_1M_to_10M",
        "active_holders_distribution_combined_balance_1_to_10",
        "active_holders_distribution_combined_balance_1k_to_10k",
        "active_holders_distribution_combined_balance_total",
        "active_holders_distribution_total",
        "active_holders_distribution_over_1",
        "active_holders_distribution_over_10",
        "active_holders_distribution_over_100",
        "active_holders_distribution_over_1k",
        "active_holders_distribution_over_10k",
        "active_holders_distribution_over_100k",
        "active_holders_distribution_over_1M",
        "active_holders_distribution_combined_balance_over_1",
        "active_holders_distribution_combined_balance_over_10",
        "active_holders_distribution_combined_balance_over_100",
        "active_holders_distribution_combined_balance_over_1k",
        "active_holders_distribution_combined_balance_over_10k",
        "active_holders_distribution_combined_balance_over_100k",
        "active_holders_distribution_combined_balance_over_1M",
        "percent_of_active_holders_distribution_combined_balance_0_to_0.001",
        "percent_of_active_holders_distribution_combined_balance_0.001_to_0.01",
        "percent_of_active_holders_distribution_combined_balance_0.01_to_0.1",
        "percent_of_active_holders_distribution_combined_balance_0.1_to_1",
        "percent_of_active_holders_distribution_combined_balance_1_to_10",
        "percent_of_active_holders_distribution_combined_balance_10_to_100",
        "percent_of_active_holders_distribution_combined_balance_100_to_1k",
        "percent_of_active_holders_distribution_combined_balance_1k_to_10k",
        "percent_of_active_holders_distribution_combined_balance_10k_to_100k",
        "percent_of_active_holders_distribution_combined_balance_100k_to_1M",
        "percent_of_active_holders_distribution_combined_balance_1M_to_10M",
        "percent_of_active_holders_distribution_combined_balance_10M_to_inf",
        "percent_of_active_holders_distribution_0_to_0.001",
        "percent_of_active_holders_distribution_0.001_to_0.01",
        "percent_of_active_holders_distribution_0.01_to_0.1",
        "percent_of_active_holders_distribution_0.1_to_1",
        "percent_of_active_holders_distribution_1_to_10",
        "percent_of_active_holders_distribution_10_to_100",
        "percent_of_active_holders_distribution_100_to_1k",
        "percent_of_active_holders_distribution_1k_to_10k",
        "percent_of_active_holders_distribution_10k_to_100k",
        "percent_of_active_holders_distribution_100k_to_1M",
        "percent_of_active_holders_distribution_1M_to_10M",
        "percent_of_active_holders_distribution_10M_to_inf",
        # makerdao metrics
        "dai_created",
        "dai_repaid",
        "mcd_liquidation",
        "mcd_collat_ratio",
        "mcd_collat_ratio_sai",
        "mcd_collat_ratio_weth",
        "mcd_dsr",
        "mcd_locked_token",
        "mcd_stability_fee",
        "scd_collat_ratio",
        "scd_locked_token",
        "total_dai_created",
        # derivatives
        "bitmex_perpetual_funding_rate",
        "bitmex_perpetual_basis",
        "bitmex_perpetual_open_interest",
        "bitmex_perpetual_open_value",
        "bitmex_perpetual_basis_ratio",
        "bitmex_perpetual_price",
        "bitmex_composite_price_index",
        "usdt_bnb_open_interest",
        "usdt_binance_open_interest",
        "usdt_bnb_open_value",
        "usdt_binance_open_value",
        "busd_bnb_open_interest",
        "busd_binance_open_interest",
        "busd_bnb_open_value",
        "busd_binance_open_value",
        "usdt_bnb_funding_rates",
        "usdt_binance_funding_rate",
        "busd_bnb_funding_rates",
        "busd_binance_funding_rate",
        "ftx_perpetual_funding_rate",
        "bitfinex_perpetual_funding_rate",
        "dydx_perpetual_funding_rate",
        "deribit_perpetual_funding_rate",
        "huobi_perpetual_funding_rate",
        "ftx_perpetual_open_interest",
        # label metrics
        "active_deposits_per_exchange",
        "active_withdrawals_per_exchange",
        "deposit_transactions_per_exchange",
        "exchange_inflow_per_exchange",
        "exchange_outflow_per_exchange",
        "inflow_per_label_and_owner",
        "outflow_per_label_and_owner",
        "exchange_balance_per_exchange",
        "balance_per_label_and_owner_delta",
        "balance_per_owner",
        "exchange_balance_per_exchange",
        "withdrawal_transactions_per_exchange",
        "total_trade_volume_by_dex",
        "eth_based_trade_volume_by_dex",
        "stablecoin_trade_volume_by_dex",
        "other_trade_volume_by_dex",
        "total_trade_amount_by_dex",
        "eth_based_trade_amount_by_dex",
        "stablecoin_trade_amount_by_dex",
        "other_trade_amount_by_dex",
        "eth_trade_volume_by_token",
        "stablecoin_trade_volume_by_token",
        "token_eth_price_by_dex_5m",
        "nft_trades_count",
        "nft_trade_volume_usd",
        "nft_whale_trades_count",
        "nft_whale_trade_volume_usd",
        "nft_retail_trades_count",
        "nft_retail_trade_volume_usd",
        # nft collection metrics
        "nft_collection_min_price",
        "nft_collection_max_price",
        "nft_collection_avg_price",
        "nft_collection_trades_count",
        "nft_collection_min_price_usd",
        "nft_collection_max_price_usd",
        "nft_collection_avg_price_usd",
        "nft_token_id_price",
        "nft_token_id_price_usd",
        "nft_market_volume",
        "nft_market_count",
        "nft_collection_holders_balance",
        "nft_network_profit_loss",
        "nft_network_profit_loss_usd",
        "nft_collection_profit_loss",
        "nft_collection_profit_loss_usd",
        # label balances
        "labelled_historical_balance",
        "labelled_historical_balance_changes",
        # table metrics
        "labelled_exchange_balance_sum",
        # balance and flow labeled metrics
        "miners_balance",
        "genesis_balance",
        "dex_trader_balance",
        "trader_balance",
        "defi_balance",
        "dex_balance",
        "cex_balance",
        "withdrawal_balance",
        "deposit_balance",
        "proxy_balance",
        "whale_balance",
        "makerdao_bite_keeper_balance",
        "makerdao_cdp_owner_balance",
        "proxy_balance",
        # labeled holders metrics
        "holders_labeled_negative_distribution_100_to_1k",
        "holders_labeled_negative_distribution_0.1_to_1",
        "holders_labeled_distribution_combined_balance_total",
        "holders_labeled_distribution_combined_balance_0_to_0.001",
        "holders_labeled_negative_distribution_combined_balance_0.01_to_0.1",
        "holders_labeled_negative_distribution_combined_balance_total",
        "holders_labeled_distribution_combined_balance_100k_to_1M",
        "holders_labeled_negative_distribution_0.001_to_0.01",
        "holders_labeled_distribution_combined_balance_0.01_to_0.1",
        "holders_labeled_negative_distribution_1k_to_10k",
        "holders_labeled_distribution_combined_balance_100_to_1k",
        "holders_labeled_distribution_100_to_1k",
        "holders_labeled_distribution_0.1_to_1",
        "holders_labeled_negative_distribution_combined_balance_1M_to_10M",
        "holders_labeled_negative_distribution_combined_balance_0.001_to_0.01",
        "holders_labeled_negative_distribution_10_to_100",
        "holders_labeled_distribution_combined_balance_10_to_100",
        "holders_labeled_distribution_10_to_100",
        "holders_labeled_distribution_10M_to_inf",
        "holders_labeled_negative_distribution_10k_to_100k",
        "holders_labeled_distribution_10k_to_100k",
        "holders_labeled_distribution_0.001_to_0.01",
        "holders_labeled_distribution_0.01_to_0.1",
        "holders_labeled_negative_distribution_combined_balance_10_to_100",
        "holders_labeled_distribution_combined_balance_10k_to_100k",
        "holders_labeled_distribution_combined_balance_0.1_to_1",
        "holders_labeled_negative_distribution_combined_balance_100k_to_1M",
        "holders_labeled_distribution_combined_balance_1_to_10",
        "holders_labeled_distribution_combined_balance_1k_to_10k",
        "holders_labeled_negative_distribution_1M_to_10M",
        "holders_labeled_negative_distribution_combined_balance_100_to_1k",
        "holders_labeled_negative_distribution_combined_balance_1_to_10",
        "holders_labeled_negative_distribution_combined_balance_0.1_to_1",
        "holders_labeled_distribution_1M_to_10M",
        "holders_labeled_negative_distribution_1_to_10",
        "holders_labeled_negative_distribution_0.01_to_0.1",
        "holders_labeled_distribution_combined_balance_1M_to_10M",
        "holders_labeled_distribution_combined_balance_0.001_to_0.01",
        "holders_labeled_distribution_0_to_0.001",
        "holders_labeled_distribution_1k_to_10k",
        "holders_labeled_distribution_100k_to_1M",
        "holders_labeled_negative_distribution_combined_balance_0_to_0.001",
        "holders_labeled_negative_distribution_combined_balance_10k_to_100k",
        "holders_labeled_negative_distribution_combined_balance_1k_to_10k",
        "holders_labeled_negative_distribution_10M_to_inf",
        "holders_labeled_distribution_total",
        "holders_labeled_distribution_1_to_10",
        "holders_labeled_negative_distribution_total",
        "holders_labeled_negative_distribution_combined_balance_10M_to_inf",
        "holders_labeled_negative_distribution_100k_to_1M",
        "holders_labeled_negative_distribution_0_to_0.001",
        "holders_labeled_distribution_combined_balance_10M_to_inf",
        # age band metrics
        "spent_coins_age_band_0d_to_1d",
        "spent_coins_age_band_1d_to_7d",
        "spent_coins_age_band_7d_to_30d",
        "spent_coins_age_band_30d_to_60d",
        "spent_coins_age_band_60d_to_90d",
        "spent_coins_age_band_90d_to_180d",
        "spent_coins_age_band_180d_to_365d",
        "spent_coins_age_band_365d_to_2y",
        "spent_coins_age_band_2y_to_3y",
        "spent_coins_age_band_3y_to_5y",
        "spent_coins_age_band_5y_to_7y",
        "spent_coins_age_band_7y_to_10y",
        "spent_coins_age_band_10y_to_20y",
        "percent_of_spent_coins_age_band_0d_to_1d",
        "percent_of_spent_coins_age_band_1d_to_7d",
        "percent_of_spent_coins_age_band_7d_to_30d",
        "percent_of_spent_coins_age_band_30d_to_60d",
        "percent_of_spent_coins_age_band_60d_to_90d",
        "percent_of_spent_coins_age_band_90d_to_180d",
        "percent_of_spent_coins_age_band_180d_to_365d",
        "percent_of_spent_coins_age_band_365d_to_2y",
        "percent_of_spent_coins_age_band_2y_to_3y",
        "percent_of_spent_coins_age_band_3y_to_5y",
        "percent_of_spent_coins_age_band_5y_to_7y",
        "percent_of_spent_coins_age_band_7y_to_10y",
        "percent_of_spent_coins_age_band_10y_to_20y",
        # hodl waves metrics
        "realized_cap_hodl_waves_0d_to_1d",
        "realized_cap_hodl_waves_1d_to_7d",
        "realized_cap_hodl_waves_7d_to_30d",
        "realized_cap_hodl_waves_30d_to_60d",
        "realized_cap_hodl_waves_60d_to_90d",
        "realized_cap_hodl_waves_90d_to_180d",
        "realized_cap_hodl_waves_180d_to_365d",
        "realized_cap_hodl_waves_365d_to_2y",
        "realized_cap_hodl_waves_2y_to_3y",
        "realized_cap_hodl_waves_3y_to_5y",
        "realized_cap_hodl_waves_5y_to_10y",
        "realized_cap_hodl_waves_10y_to_20y",
        # ETH2 metrics
        "eth2_stakers_count",
        "eth2_roi",
        "eth_beacon_deposits",
        "eth_beacon_validator_withdrawals",
        "eth_beacon_reward_withdrawals",
        # Defi
        "defi_total_value_locked_eth",
        "defi_total_value_locked_usd",
        # Change metrics
        "age_destroyed_change_1d",
        "age_destroyed_change_30d",
        "age_destroyed_change_7d",
        "network_growth_change_1d",
        "network_growth_change_7d",
        "network_growth_change_30d",
        "exchange_inflow_change_1d",
        "exchange_inflow_change_7d",
        "exchange_inflow_change_30d",
        "exchange_outflow_change_1d",
        "exchange_outflow_change_7d",
        "exchange_outflow_change_30d",
        "exchange_balance_change_1d",
        "exchange_balance_change_7d",
        "exchange_balance_change_30d",
        "transaction_volume_change_1d",
        "transaction_volume_change_7d",
        "transaction_volume_change_30d",
        "transaction_volume_usd_change_1d",
        "transaction_volume_usd_change_7d",
        "transaction_volume_usd_change_30d",
        "dormant_circulation_365d_change_1d",
        "dormant_circulation_365d_change_7d",
        "dormant_circulation_365d_change_30d",
        "circulation_180d_change_1d",
        "circulation_180d_change_7d",
        "circulation_180d_change_30d",
        "circulation_change_1d",
        "circulation_change_7d",
        "circulation_change_30d",
        "bitmex_perpetual_funding_rate_change_1d",
        "bitmex_perpetual_funding_rate_change_7d",
        "bitmex_perpetual_funding_rate_change_30d",
        "mvrv_usd_7d_change_1d",
        "mvrv_usd_7d_change_7d",
        "mvrv_usd_7d_change_30d",
        "mvrv_usd_30d_change_1d",
        "mvrv_usd_30d_change_7d",
        "mvrv_usd_30d_change_30d",
        "mvrv_usd_60d_change_1d",
        "mvrv_usd_60d_change_7d",
        "mvrv_usd_60d_change_30d",
        "mvrv_usd_90d_change_1d",
        "mvrv_usd_90d_change_7d",
        "mvrv_usd_90d_change_30d",
        "mvrv_usd_180d_change_1d",
        "mvrv_usd_180d_change_7d",
        "mvrv_usd_180d_change_30d",
        "mvrv_usd_365d_change_1d",
        "mvrv_usd_365d_change_7d",
        "mvrv_usd_365d_change_30d",
        "mvrv_usd_change_1d",
        "mvrv_usd_change_7d",
        "mvrv_usd_change_30d",
        "mean_dollar_invested_age_change_1d",
        "mean_dollar_invested_age_change_7d",
        "mean_dollar_invested_age_change_30d",
        "percent_of_total_supply_on_exchanges_change_1d",
        "percent_of_total_supply_on_exchanges_change_7d",
        "percent_of_total_supply_on_exchanges_change_30d",
        "circulation_usd_180d_change_1d",
        "circulation_usd_180d_change_7d",
        "circulation_usd_180d_change_30d",
        "dormant_circulation_usd_180d_change_1d",
        "dormant_circulation_usd_180d_change_7d",
        "dormant_circulation_usd_180d_change_30d",
        "exchange_inflow_usd_change_1d",
        "exchange_inflow_usd_change_7d",
        "exchange_inflow_usd_change_30d",
        "exchange_outflow_usd_change_1d",
        "exchange_outflow_usd_change_7d",
        "exchange_outflow_usd_change_30d",
        "price_daa_divergence",
        "adjusted_price_daa_divergence",
        "social_volume_total_change_1d",
        "social_volume_total_change_7d",
        "social_volume_total_change_30d",
        "sentiment_weighted_farcaster_1d",
        "sentiment_weighted_farcaster_1h",
        "social_dominance_farcaster_1h_moving_average",
        "social_dominance_farcaster_24h_moving_average",
        "sentiment_balance_total_change_1d",
        "sentiment_balance_total_change_7d",
        "sentiment_balance_total_change_30d",
        "social_dominance_total_change_1d",
        "social_dominance_total_change_7d",
        "social_dominance_total_change_30d",
        "social_dominance_total_1h_moving_average_change_1d",
        "social_dominance_total_1h_moving_average_change_7d",
        "social_dominance_total_1h_moving_average_change_30d",
        "social_dominance_total_24h_moving_average_change_1d",
        "social_dominance_total_24h_moving_average_change_7d",
        "social_dominance_total_24h_moving_average_change_30d",
        "social_dominance_total_change_1d",
        "social_dominance_total_change_7d",
        "social_dominance_total_change_30d",
        "sentiment_balance_total_change_1d",
        "sentiment_balance_total_change_7d",
        "sentiment_balance_total_change_30d",
        "sentiment_weighted_4chan_1d",
        "sentiment_weighted_4chan_1h",
        "sentiment_weighted_bitcointalk_1d",
        "sentiment_weighted_bitcointalk_1h",
        "sentiment_weighted_reddit_1d",
        "sentiment_weighted_reddit_1h",
        "sentiment_weighted_telegram_1d",
        "sentiment_weighted_telegram_1h",
        "sentiment_weighted_total_1d",
        "sentiment_weighted_total_1h",
        "sentiment_weighted_twitter_1d",
        "sentiment_weighted_twitter_1h",
        "sentiment_weighted_youtube_videos_1d",
        "sentiment_weighted_youtube_videos_1h",
        "network_profit_loss_change_1d",
        "network_profit_loss_change_7d",
        "network_profit_loss_change_30d",
        "whale_transaction_count_100k_usd_to_inf_change_1d",
        "whale_transaction_count_100k_usd_to_inf_change_7d",
        "whale_transaction_count_100k_usd_to_inf_change_30d",
        "whale_transaction_count_1m_usd_to_inf_change_1d",
        "whale_transaction_count_1m_usd_to_inf_change_7d",
        "whale_transaction_count_1m_usd_to_inf_change_30d",
        # bnb funding rates metrics
        # ftx funding rates metric
        # bitfinex funding rates metric
        # dydx funding rates metric
        # deribit funding rates metric
        "sentiment_volume_consumed_total_change_1d",
        "sentiment_volume_consumed_total_change_7d",
        "sentiment_volume_consumed_total_change_30d",
        # contract metrics
        "contract_interacting_addresses_count",
        "contract_transactions_count",
        # Aave v2 metrics
        "aave_v2_action_deposits",
        "aave_v2_action_liquidations",
        "aave_v2_action_new_debt",
        "aave_v2_action_repayments",
        "aave_v2_action_deposits_usd",
        "aave_v2_action_liquidations_usd",
        "aave_v2_action_new_debt_usd",
        "aave_v2_action_repayments_usd",
        "aave_v2_total_deposits_usd",
        "aave_v2_total_liquidations_usd",
        "aave_v2_total_new_debt_usd",
        "aave_v2_total_repayments_usd",
        "aave_v2_total_supplied",
        "aave_v2_total_supplied_usd",
        "aave_v2_total_borrowed",
        "aave_v2_total_borrowed_usd",
        "aave_v2_protocol_total_supplied_usd",
        "aave_v2_protocol_total_borrowed_usd",
        "aave_v2_supply_apy",
        "aave_v2_stable_borrow_apy",
        "aave_v2_variable_borrow_apy",
        "aave_v2_active_addresses",
        "aave_v2_revenue",
        "aave_v2_revenue_usd",
        "aave_v2_total_protocol_revenue_usd",
        "aave_v2_total_protocol_cumulative_revenue_usd",
        # Aave v3 metrics
        "aave_v3_action_deposits",
        "aave_v3_action_liquidations",
        "aave_v3_action_new_debt",
        "aave_v3_action_repayments",
        "aave_v3_action_deposits_usd",
        "aave_v3_action_liquidations_usd",
        "aave_v3_action_new_debt_usd",
        "aave_v3_action_repayments_usd",
        "aave_v3_total_deposits_usd",
        "aave_v3_total_liquidations_usd",
        "aave_v3_total_new_debt_usd",
        "aave_v3_total_repayments_usd",
        "aave_v3_total_supplied",
        "aave_v3_total_supplied_usd",
        "aave_v3_total_borrowed",
        "aave_v3_total_borrowed_usd",
        "aave_v3_protocol_total_supplied_usd",
        "aave_v3_protocol_total_borrowed_usd",
        "aave_v3_supply_apy",
        "aave_v3_variable_borrow_apy",
        "aave_v3_active_addresses",
        "aave_v3_revenue",
        "aave_v3_revenue_usd",
        "aave_v3_total_protocol_revenue_usd",
        "aave_v3_total_protocol_cumulative_revenue_usd",
        # Compound metrics
        "compound_action_deposits",
        "compound_action_liquidations",
        "compound_action_new_debt",
        "compound_action_repayments",
        "compound_action_deposits_usd",
        "compound_action_liquidations_usd",
        "compound_action_new_debt_usd",
        "compound_action_repayments_usd",
        "compound_total_deposits_usd",
        "compound_total_liquidations_usd",
        "compound_total_new_debt_usd",
        "compound_total_repayments_usd",
        "compound_total_supplied",
        "compound_total_supplied_usd",
        "compound_total_borrowed",
        "compound_total_borrowed_usd",
        "compound_protocol_total_supplied_usd",
        "compound_protocol_total_borrowed_usd",
        "compound_supply_apy",
        "compound_borrow_apy",
        "compound_active_addresses",
        "compound_revenue",
        "compound_revenue_usd",
        "compound_total_protocol_revenue_usd",
        "compound_total_protocol_cumulative_revenue_usd",
        # Compound v3 metrics
        "compound_v3_action_deposits",
        "compound_v3_action_liquidations",
        "compound_v3_action_new_debt",
        "compound_v3_action_repayments",
        "compound_v3_action_deposits_usd",
        "compound_v3_action_liquidations_usd",
        "compound_v3_action_new_debt_usd",
        "compound_v3_action_repayments_usd",
        "compound_v3_total_deposits_usd",
        "compound_v3_total_liquidations_usd",
        "compound_v3_total_new_debt_usd",
        "compound_v3_total_repayments_usd",
        "compound_v3_collateral_total_supplied",
        "compound_v3_collateral_total_supplied_usd",
        "compound_v3_total_supplied",
        "compound_v3_total_supplied_usd",
        "compound_v3_total_borrowed",
        "compound_v3_total_borrowed_usd",
        "compound_v3_protocol_total_supplied_usd",
        "compound_v3_protocol_total_borrowed_usd",
        "compound_v3_supply_apy",
        "compound_v3_borrow_apy",
        "compound_v3_active_addresses",
        # Liquity metrics
        "liquity_action_deposits",
        "liquity_action_liquidations",
        "liquity_action_new_debt",
        "liquity_action_repayments",
        "liquity_action_deposits_usd",
        "liquity_action_liquidations_usd",
        "liquity_action_new_debt_usd",
        "liquity_action_repayments_usd",
        "liquity_total_supplied",
        "liquity_total_supplied_usd",
        "liquity_total_borrowed",
        "liquity_total_borrowed_usd",
        "liquity_borrow_fee",
        "liquity_active_addresses",
        "liquidity_in_amm_pools_by_asset",
        "liquidity_in_amm_pools_by_pair",
        # Fraxlend metrics
        "fraxlend_action_deposits",
        "fraxlend_action_liquidations",
        "fraxlend_action_new_debt",
        "fraxlend_action_repayments",
        "fraxlend_action_deposits_usd",
        "fraxlend_action_liquidations_usd",
        "fraxlend_action_new_debt_usd",
        "fraxlend_action_repayments_usd",
        "fraxlend_total_deposits_usd",
        "fraxlend_total_liquidations_usd",
        "fraxlend_total_new_debt_usd",
        "fraxlend_total_repayments_usd",
        "fraxlend_total_supplied",
        "fraxlend_total_supplied_usd",
        "fraxlend_total_borrowed_against_collateral",
        "fraxlend_protocol_total_supplied_usd",
        "fraxlend_protocol_total_borrowed_usd",
        "fraxlend_borrow_apy",
        "fraxlend_active_addresses",
        # Spark metrics
        "spark_action_deposits",
        "spark_action_liquidations",
        "spark_action_new_debt",
        "spark_action_repayments",
        "spark_action_deposits_usd",
        "spark_action_liquidations_usd",
        "spark_action_new_debt_usd",
        "spark_action_repayments_usd",
        "spark_total_deposits_usd",
        "spark_total_liquidations_usd",
        "spark_total_new_debt_usd",
        "spark_total_repayments_usd",
        "spark_total_supplied",
        "spark_total_supplied_usd",
        "spark_total_borrowed",
        "spark_total_borrowed_usd",
        "spark_protocol_total_supplied_usd",
        "spark_protocol_total_borrowed_usd",
        "spark_supply_apy",
        "spark_borrow_apy",
        "spark_active_addresses",
        # Fluid metrics
        "fluid_action_deposits",
        "fluid_action_liquidations",
        "fluid_action_new_debt",
        "fluid_action_repayments",
        "fluid_action_deposits_usd",
        "fluid_action_liquidations_usd",
        "fluid_action_new_debt_usd",
        "fluid_action_repayments_usd",
        "fluid_total_deposits_usd",
        "fluid_total_liquidations_usd",
        "fluid_total_new_debt_usd",
        "fluid_total_repayments_usd",
        "fluid_active_addresses",
        # Morpho metrics
        "morpho_action_deposits",
        "morpho_action_liquidations",
        "morpho_action_new_debt",
        "morpho_action_repayments",
        "morpho_action_deposits_usd",
        "morpho_action_liquidations_usd",
        "morpho_action_new_debt_usd",
        "morpho_action_repayments_usd",
        "morpho_total_deposits_usd",
        "morpho_total_liquidations_usd",
        "morpho_total_new_debt_usd",
        "morpho_total_repayments_usd",
        "morpho_active_addresses",
        "morpho_vaults_total_supplied_usd",
        # Makerdao metrics
        "makerdao_action_deposits",
        "makerdao_action_liquidations",
        "makerdao_action_new_debt",
        "makerdao_action_repayments",
        "makerdao_action_deposits_usd",
        "makerdao_action_liquidations_usd",
        "makerdao_action_new_debt_usd",
        "makerdao_action_repayments_usd",
        "makerdao_total_deposits_usd",
        "makerdao_total_liquidations_usd",
        "makerdao_total_new_debt_usd",
        "makerdao_total_repayments_usd",
        "makerdao_total_supplied",
        "makerdao_total_supplied_usd",
        "makerdao_total_borrowed",
        "makerdao_total_borrowed_usd",
        "makerdao_protocol_total_supplied_usd",
        "makerdao_protocol_total_borrowed_usd",
        "makerdao_active_addresses",
        # Makerdao DSR metrics
        "makerdao_dsr_deposits",
        "makerdao_dsr_withdrawals",
        "makerdao_dsr_total_supplied",
        # Ethena staking metrics
        "ethena_staking_deposits",
        "ethena_staking_withdrawals",
        "ethena_staking_apy",
        "sky_savings_deposits",
        "sky_savings_withdrawals",
        "sky_savings_total_supplied",
        "sky_savings_apy",
        "pendle_total_markets_tvl",
        "pendle_underlying_apy",
        "pendle_implied_apy",
        "pendle_yield_spread",
        # ETH 2.0 stakers MVRV metrics
        "eth2_stakers_realized_value_usd_365d",
        "eth2_stakers_realized_value_usd_2y",
        "eth2_stakers_realized_value_usd_3y",
        "eth2_stakers_realized_value_usd_5y",
        "eth2_stakers_realized_value_usd_10y",
        "eth2_stakers_mvrv_usd_365d",
        "eth2_stakers_mvrv_usd_2y",
        "eth2_stakers_mvrv_usd_3y",
        "eth2_stakers_mvrv_usd_5y",
        "eth2_stakers_mvrv_usd_10y",
        # XRP metrics
        "daily_assets_issued",
        "total_assets_issued",
        "daily_trustlines_count_change",
        "total_trustlines_count",
        "dex_volume_in_xrp_5m",
        "dex_volume_in_usd_5m",
        # Some balance metrics
        "all_known_balance",
        "unlabeled_balance",
        # Labeled historical balance "fake" metrics
        "combined_historical_balance_centralized_exchanges",
        "combined_historical_balance_decentralized_exchanges",
        "combined_historical_balance_funds",
        "historical_balance_centralized_exchanges",
        "historical_balance_decentralized_exchanges",
        "historical_balance_whales_usd"
      ]
      |> Enum.sort()

    # The diff algorithm fails to nicely print that a single metric is
    # missing but instead shows some not-understandable result when comparing
    # the lists directly

    # not present in expected
    assert MapSet.difference(
             MapSet.new(restricted_metrics),
             MapSet.new(expected_restricted_metrics)
           )
           |> Enum.to_list() == []

    # not present in the metrics list
    assert MapSet.difference(
             MapSet.new(expected_restricted_metrics),
             MapSet.new(restricted_metrics)
           )
           |> Enum.to_list() == []
  end

  test "forbidden metrics", %{metric_access_map: access_map} do
    forbidden_metrics =
      Sanbase.Billing.ApiInfo.get_with_access_level(access_map, :forbidden)
      |> Enum.sort()

    expected_forbidden_metrics =
      []
      |> Enum.sort()

    assert forbidden_metrics == expected_forbidden_metrics
  end

  test "metrics with free realtime and restricted historical data", %{
    metric_access_map: access_map
  } do
    result =
      access_map
      |> Enum.filter(&match?({_, %{"historical" => :restricted, "realtime" => :free}}, &1))
      |> Enum.map(&elem(&1, 0))
      |> Enum.sort()

    expected = []

    assert result == expected
  end

  test "metrics with restricted realtime and free historical data", %{
    metric_access_map: access_map
  } do
    result =
      access_map
      |> Enum.filter(&match?({_, %{"historical" => :free, "realtime" => :restricted}}, &1))
      |> Enum.map(&elem(&1, 0))
      |> Enum.sort()

    assert result == []
  end

  test "human readable name suggest min interval" do
    metrics = Sanbase.Metric.available_metrics()

    for m <- metrics do
      {:ok, metadata} = Sanbase.Metric.metadata(m)
      {:ok, human_readable_name} = Sanbase.Metric.human_readable_name(m)
      human_readable_name = String.downcase(human_readable_name)

      if human_readable_name =~ "hourly" do
        assert metadata.min_interval == "1h"
        assert metadata.internal_metric =~ "1h"
      end

      if human_readable_name =~ "daily" do
        assert metadata.min_interval == "1d"
      end
    end
  end
end
