code: def get_exchange(
      exchange: Union[str, dict, object, Path] = None,
      freq: str = "day",
      start_time: Union[pd.Timestamp, str] = None,
      end_time: Union[pd.Timestamp, str] = None,
      codes: Union[list, str] = "all",
      subscribe_fields: list = [],
      open_cost: float = 0.0015,
      close_cost: float = 0.0025,
      min_cost: float = 5.0,
      limit_threshold: Union[Tuple[str, str], float, None]
      | None = None,
      deal_price: Union[str, Tuple[str, str], List[str]] | None = None,
      **kwargs: Any,
  ) -> Exchange:
      """get_exchange
  
      Parameters
      ----------
  
      # exchange related arguments
      exchange: Exchange
          It could be None or any types that are acceptable by `init_instance_by_config`.
      freq: str
          frequency of data.
      start_time: Union[pd.Timestamp, str]
          closed start time for backtest.
      end_time: Union[pd.Timestamp, str]
          closed end time for backtest.
      codes: Union[list, str]
          list stock_id list or a string of instruments (i.e. all, csi500, sse50)
      subscribe_fields: list
          subscribe fields.
      open_cost : float
          open transaction cost. It is a ratio. The cost is proportional to your order's deal amount.
      close_cost : float
          close transaction cost. It is a ratio. The cost is proportional to your order's deal amount.
      min_cost : float
          min transaction cost.  It is an absolute amount of cost instead of a ratio of your order's deal amount.
          e.g. You must pay at least 5 yuan of commission regardless of your order's deal amount.
      deal_price: Union[str, Tuple[str, str], List[str]]
                  The `deal_price` supports following two types of input
                  - <deal_price> : str
                  - (<buy_price>, <sell_price>): Tuple[str, str] or List[str]
  
                  <deal_price>, <buy_price> or <sell_price> := <price>
                  <price> := str
                  - for example '$close', '$open', '$vwap' ("close" is OK. `Exchange` will help to prepend
                    "$" to the expression)
      limit_threshold : float
          limit move 0.1 (10%) for example, long and short with same limit.
  
      Returns
      -------
      :class: Exchange
      an initialized Exchange object
      """
  
      if limit_threshold is None:
          limit_threshold = C.limit_threshold
      if exchange is None:
          logger.info("Create new exchange")
  
          exchange = Exchange(
              freq=freq,
              start_time=start_time,
              end_time=end_time,
              codes=codes,
              deal_price=deal_price,
              subscribe_fields=subscribe_fields,
              limit_threshold=limit_threshold,
              open_cost=open_cost,
              close_cost=close_cost,
              min_cost=min_cost,
              **kwargs,
          )
          return exchange
      else:
          return init_instance_by_config(
              exchange, accept_types=Exchange
          )
  
file_path: qlib/qlib/backtest/__init__.py
imports: from __future__ import annotations
  import copy
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Generator, List, Optional, Tuple, Union
  import pandas
  from .account import Account
  from ..config import C
  from ..log import get_module_logger
  from ..utils import init_instance_by_config
  from .backtest import INDICATOR_METRIC, PORT_METRIC, backtest_loop, collect_data_loop
  from .decision import Order
  from .exchange import Exchange
  from .utils import CommonInfrastructure
label_desc: Use image node_id 1 for calling a global function with example usage: get_exchange(exchange, freq, start_time, end_time, codes, subscribe_fields, open_cost, close_cost, min_cost, limit_threshold, deal_price) and returns: exchange, init_instance_by_config