class_docstr: This is the Portfolio Analysis Record class that generates the analysis results such as those of backtest. This class inherits the ``RecordTemp`` class.
  
  The following files will be stored in recorder
  
  - report_normal.pkl & positions_normal.pkl:
  
      - The return report and detailed positions of the backtest, returned by `qlib/contrib/evaluate.py:backtest`
  - port_analysis.pkl : The risk analysis of your portfolio, returned by `qlib/contrib/evaluate.py:risk_analysis`
docstr: config["strategy"] : dict
      define the strategy class as well as the kwargs.
  config["executor"] : dict
      define the executor class as well as the kwargs.
  config["backtest"] : dict
      define the backtest kwargs.
  risk_analysis_freq : str|List[str]
      risk analysis freq of report
  indicator_analysis_freq : str|List[str]
      indicator analysis freq of report
  indicator_analysis_method : str, optional, default by None
      the candidate values include 'mean', 'amount_weighted', 'value_weighted'
docstr_tok: ["config","[","``","strategy","''","]",":","dict","define","the","strategy","class","as","well","as","the","kwargs",".","config","[","``","executor","''","]",":","dict","define","the","executor","class","as","well","as","the","kwargs",".","config","[","``","backtest","''","]",":","dict","define","the","backtest","kwargs",".","risk_analysis_freq",":","str|List","[","str","]","risk","analysis","freq","of","report","indicator_analysis_freq",":","str|List","[","str","]","indicator","analysis","freq","of","report","indicator_analysis_method",":","str",",","optional",",","default","by","None","the","candidate","values","include","'mean","'",",","'amount_weighted","'",",","'value_weighted","'"]
code: def __init__(
      self,
      recorder,
      config=None,
      risk_analysis_freq: Union[List, str] = None,
      indicator_analysis_freq: Union[List, str] = None,
      indicator_analysis_method=None,
      skip_existing=False,
      **kwargs,
  ):
      """
      config["strategy"] : dict
          define the strategy class as well as the kwargs.
      config["executor"] : dict
          define the executor class as well as the kwargs.
      config["backtest"] : dict
          define the backtest kwargs.
      risk_analysis_freq : str|List[str]
          risk analysis freq of report
      indicator_analysis_freq : str|List[str]
          indicator analysis freq of report
      indicator_analysis_method : str, optional, default by None
          the candidate values include 'mean', 'amount_weighted', 'value_weighted'
      """
      super().__init__(
          recorder=recorder, skip_existing=skip_existing, **kwargs
      )
  
      if config is None:
          config = {  # Default config for daily trading
              "strategy": {
                  "class": "TopkDropoutStrategy",
                  "module_path": "qlib.contrib.strategy",
                  "kwargs": {
                      "signal": "<PRED>",
                      "topk": 50,
                      "n_drop": 5,
                  },
              },
              "backtest": {
                  "start_time": None,
                  "end_time": None,
                  "account": 100000000,
                  "benchmark": "SH000300",
                  "exchange_kwargs": {
                      "limit_threshold": 0.095,
                      "deal_price": "close",
                      "open_cost": 0.0005,
                      "close_cost": 0.0015,
                      "min_cost": 5,
                  },
              },
          }
      # We only deepcopy_basic_type because
      # - We don't want to affect the config outside.
      # - We don't want to deepcopy complex object to avoid overhead
      config = deepcopy_basic_type(config)
  
      self.strategy_config = config["strategy"]
      _default_executor_config = {
          "class": "SimulatorExecutor",
          "module_path": "qlib.backtest.executor",
          "kwargs": {
              "time_per_step": "day",
              "generate_portfolio_metrics": True,
          },
      }
      self.executor_config = config.get(
          "executor", _default_executor_config
      )
      self.backtest_config = config["backtest"]
  
      self.all_freq = self._get_report_freq(self.executor_config)
      if risk_analysis_freq is None:
          risk_analysis_freq = [self.all_freq[0]]
      if indicator_analysis_freq is None:
          indicator_analysis_freq = [self.all_freq[0]]
  
      if isinstance(risk_analysis_freq, str):
          risk_analysis_freq = [risk_analysis_freq]
      if isinstance(indicator_analysis_freq, str):
          indicator_analysis_freq = [indicator_analysis_freq]
  
      self.risk_analysis_freq = [
          "{0}{1}".format(*Freq.parse(_analysis_freq))
          for _analysis_freq in risk_analysis_freq
      ]
      self.indicator_analysis_freq = [
          "{0}{1}".format(*Freq.parse(_analysis_freq))
          for _analysis_freq in indicator_analysis_freq
      ]
      self.indicator_analysis_method = indicator_analysis_method
  
imports: import logging
  import warnings
  import pandas
  import numpy
  from tqdm import trange
  from pprint import pprint
  from typing import Union, List, Optional, Dict
  from qlib.utils.exceptions import LoadObjectError
  from ..contrib.evaluate import risk_analysis, indicator_analysis
  from ..data.dataset import DatasetH
  from ..data.dataset.handler import DataHandlerLP
  from ..backtest import backtest
  from ..log import get_module_logger
  from ..utils import fill_placeholder, flatten_dict, class_casting, get_date_by_shift
  from ..utils.time import Freq
  from ..utils.data import deepcopy_basic_type
  from ..utils.exceptions import QlibException
  from ..contrib.eva.alpha import calc_ic, calc_long_short_return, calc_long_short_prec
label_desc: Use image node_id 1 to create a new PortAnaRecord object from inherited base classes: ACRecordTemp with example: obj = PortAnaRecord(recorder, config, risk_analysis_freq, indicator_analysis_freq, indicator_analysis_method, skip_existing)