code: def get_instruments(
      qlib_dir: str,
      index_name: str,
      method: str = "parse_instruments",
      freq: str = "day",
      request_retry: int = 5,
      retry_sleep: int = 3,
      market_index: str = "cn_index",
  ):
      """
  
      Parameters
      ----------
      qlib_dir: str
          qlib data dir, default "Path(__file__).parent/qlib_data"
      index_name: str
          index name, value from ["csi100", "csi300"]
      method: str
          method, value from ["parse_instruments", "save_new_companies"]
      freq: str
          freq, value from ["day", "1min"]
      request_retry: int
          request retry, by default 5
      retry_sleep: int
          request sleep, by default 3
      market_index: str
          Where the files to obtain the index are located,
          for example data_collector.cn_index.collector
  
      Examples
      -------
          # parse instruments
          $ python collector.py --index_name CSI300 --qlib_dir ~/.qlib/qlib_data/cn_data --method parse_instruments
  
          # parse new companies
          $ python collector.py --index_name CSI300 --qlib_dir ~/.qlib/qlib_data/cn_data --method save_new_companies
  
      """
      _cur_module = importlib.import_module(
          "data_collector.{}.collector".format(market_index)
      )
      obj = getattr(_cur_module, f"{index_name.upper()}Index")(
          qlib_dir=qlib_dir,
          index_name=index_name,
          freq=freq,
          request_retry=request_retry,
          retry_sleep=retry_sleep,
      )
      getattr(obj, method)()
  
imports: import re
  import copy
  import importlib
  import time
  import bisect
  import pickle
  import random
  import requests
  import functools
  from pathlib import Path
  from typing import Iterable, Tuple, List
  import numpy
  import pandas
  from lxml import etree
  from loguru import logger
  from yahooquery import Ticker
  from tqdm import tqdm
  from functools import partial
  from concurrent.futures import ProcessPoolExecutor
  from bs4 import BeautifulSoup
label_desc: Use image node_id 14 for calling a global function with example usage: get_instruments(qlib_dir, index_name, method, freq, request_retry, retry_sleep, market_index) without return types