text: import hummingbot.client.settings as settings
  
  from hummingbot.client.config.config_var import ConfigVar
  from hummingbot.client.config.config_validators import (
      validate_exchange,
      validate_market_trading_pair,
      validate_decimal,
      validate_bool,
      validate_int
  )
  from hummingbot.client.config.config_helpers import parse_cvar_value
  from hummingbot.client.settings import AllConnectorSettings, required_exchanges
  from decimal import Decimal
  from typing import Optional
  
  
  def validate_primary_market_trading_pair(value: str) -> Optional[str]:
      primary_market = arbitrage_config_map.get("primary_market").value
      return validate_market_trading_pair(primary_market, value)
  
  
  def validate_secondary_market_trading_pair(value: str) -> Optional[str]:
      secondary_market = arbitrage_config_map.get("secondary_market").value
      return validate_market_trading_pair(secondary_market, value)
  
  
  def primary_trading_pair_prompt():
      primary_market = arbitrage_config_map.get("primary_market").value
      example = AllConnectorSettings.get_example_pairs().get(primary_market)
      return "Enter the token trading pair you would like to trade on %s%s >>> " \
             % (primary_market, f" (e.g. {example})" if example else "")
  
  
  def secondary_trading_pair_prompt():
      secondary_market = arbitrage_config_map.get("secondary_market").value
      example = AllConnectorSettings.get_example_pairs().get(secondary_market)
      return "Enter the token trading pair you would like to trade on %s%s >>> " \
             % (secondary_market, f" (e.g. {example})" if example else "")
  
  
  def secondary_market_on_validated(value: str):
      required_exchanges.append(value)
  
  
  def update_oracle_settings(value: str):
      c_map = arbitrage_config_map
      if not (c_map["use_oracle_conversion_rate"].value is not None and
              c_map["primary_market_trading_pair"].value is not None and
              c_map["secondary_market_trading_pair"].value is not None):
          return
      use_oracle = parse_cvar_value(c_map["use_oracle_conversion_rate"], c_map["use_oracle_conversion_rate"].value)
      first_base, first_quote = c_map["primary_market_trading_pair"].value.split("-")
      second_base, second_quote = c_map["secondary_market_trading_pair"].value.split("-")
      if use_oracle and (first_base != second_base or first_quote != second_quote):
          settings.required_rate_oracle = True
          settings.rate_oracle_pairs = []
          if first_base != second_base:
              settings.rate_oracle_pairs.append(f"{second_base}-{first_base}")
          if first_quote != second_quote:
              settings.rate_oracle_pairs.append(f"{second_quote}-{first_quote}")
      else:
          settings.required_rate_oracle = False
          settings.rate_oracle_pairs = []
  
  
  arbitrage_config_map = {
      "strategy": ConfigVar(
          key="strategy",
          prompt="",
          default="arbitrage"
      ),
      "primary_market": ConfigVar(
          key="primary_market",
          prompt="Enter your primary spot connector >>> ",
          prompt_on_new=True,
          validator=validate_exchange,
          on_validated=lambda value: required_exchanges.append(value),
      ),
      "secondary_market": ConfigVar(
          key="secondary_market",
          prompt="Enter your secondary spot connector >>> ",
          prompt_on_new=True,
          validator=validate_exchange,
          on_validated=secondary_market_on_validated,
      ),
      "primary_market_trading_pair": ConfigVar(
          key="primary_market_trading_pair",
          prompt=primary_trading_pair_prompt,
          prompt_on_new=True,
          validator=validate_primary_market_trading_pair,
          on_validated=update_oracle_settings,
      ),
      "secondary_market_trading_pair": ConfigVar(
          key="secondary_market_trading_pair",
          prompt=secondary_trading_pair_prompt,
          prompt_on_new=True,
          validator=validate_secondary_market_trading_pair,
          on_validated=update_oracle_settings,
      ),
      "min_profitability": ConfigVar(
          key="min_profitability",
          prompt="What is the minimum profitability for you to make a trade? (Enter 1 to indicate 1%) >>> ",
          prompt_on_new=True,
          default=Decimal("0.3"),
          validator=lambda v: validate_decimal(v, Decimal(-100), Decimal("100"), inclusive=True),
          type_str="decimal",
      ),
      "use_oracle_conversion_rate": ConfigVar(
          key="use_oracle_conversion_rate",
          type_str="bool",
          prompt="Do you want to use rate oracle on unmatched trading pairs? (Yes/No) >>> ",
          prompt_on_new=True,
          validator=lambda v: validate_bool(v),
          on_validated=update_oracle_settings,
      ),
      "secondary_to_primary_base_conversion_rate": ConfigVar(
          key="secondary_to_primary_base_conversion_rate",
          prompt="Enter conversion rate for secondary base asset value to primary base asset value, e.g. "
                 "if primary base asset is USD and the secondary is DAI, 1 DAI is valued at 1.25 USD, "
                 "the conversion rate is 1.25 >>> ",
          default=Decimal("1"),
          validator=lambda v: validate_decimal(v, Decimal(0), inclusive=False),
          type_str="decimal",
      ),
      "secondary_to_primary_quote_conversion_rate": ConfigVar(
          key="secondary_to_primary_quote_conversion_rate",
          prompt="Enter conversion rate for secondary quote asset value to primary quote asset value, e.g. "
                 "if primary quote asset is USD and the secondary is DAI and 1 DAI is valued at 1.25 USD, "
                 "the conversion rate is 1.25 >>> ",
          default=Decimal("1"),
          validator=lambda v: validate_decimal(v, Decimal(0), inclusive=False),
          type_str="decimal",
      ),
      "order_size_constraints_enabled": ConfigVar(
          key="order_size_constraints_enabled",
          type_str="bool",
          prompt="Do you want to limit the sizes of orders to be placed? (Yes/No) >>> ",
          prompt_on_new=True,
          validator=lambda v: validate_bool(v),
      ),
      "min_order_size": ConfigVar(
          key="min_order_size",
          prompt="What is the minimum size of the Base asset to be used while placing orders? >>> ",
          prompt_on_new=True,
          type_str="decimal",
          validator=lambda v: validate_decimal(v, min_value=Decimal("0"), inclusive=True),
          default=Decimal("0"),
      ),
      "max_order_size": ConfigVar(
          key="max_order_size",
          prompt="What is the maximum size of the Base asset to be used while placing orders? >>> ",
          prompt_on_new=True,
          type_str="decimal",
          validator=lambda v: validate_decimal(v, min_value=Decimal("0"), inclusive=True),
      ),
      "allowed_active_orders_per_market": ConfigVar(
          key="allowed_active_orders_per_market",
          prompt="What are the maximum number of active orders you want to allow on either market?(-1 indicates infinite) >>> ",
          type_str="int",
          prompt_on_new=True,
          validator=lambda v: validate_int(v, min_value=-1, inclusive=True),
          default=1,
      ),
      "price_adjust_spread": ConfigVar(
          key="price_adjust_spread",
          prompt="How far away from the arbitrage buy/sell price do you want to place the "
               "orders? (Enter 1 to indicate 1%) >>> ",
          type_str="decimal",
          prompt_on_new=True,
          validator=lambda v: validate_decimal(v, 0, 100, inclusive=True),
          default=Decimal("0"),
      ),
  }
  