class_docstr: Nested Executor with inner strategy and executor
  - At each time `execute` is called, it will call the inner strategy and executor to execute the `trade_decision`
      in a higher frequency env.
docstr: Parameters
  ----------
  inner_executor : BaseExecutor
      trading env in each trading bar.
  inner_strategy : BaseStrategy
      trading strategy in each trading bar
  skip_empty_decision: bool
      Will the executor skip call inner loop when the decision is empty.
      It should be False in following cases
      - The decisions may be updated by steps
      - The inner executor may not follow the decisions from the outer strategy
  align_range_limit: bool
      force to align the trade_range decision
      It is only for nested executor, because range_limit is given by outer strategy
docstr_tok: ["Parameters","--","--","--","--","--","inner_executor",":","BaseExecutor","trading","env","in","each","trading","bar",".","inner_strategy",":","BaseStrategy","trading","strategy","in","each","trading","bar","skip_empty_decision",":","bool","Will","the","executor","skip","call","inner","loop","when","the","decision","is","empty",".","It","should","be","False","in","following","cases","-","The","decisions","may","be","updated","by","steps","-","The","inner","executor","may","not","follow","the","decisions","from","the","outer","strategy","align_range_limit",":","bool","force","to","align","the","trade_range","decision","It","is","only","for","nested","executor",",","because","range_limit","is","given","by","outer","strategy"]
code: def __init__(
      self,
      time_per_step: str,
      inner_executor: Union[BaseExecutor, dict],
      inner_strategy: Union[BaseStrategy, dict],
      start_time: Union[str, pd.Timestamp] = None,
      end_time: Union[str, pd.Timestamp] = None,
      indicator_config: dict = {},
      generate_portfolio_metrics: bool = False,
      verbose: bool = False,
      track_data: bool = False,
      skip_empty_decision: bool = True,
      align_range_limit: bool = True,
      common_infra: CommonInfrastructure | None = None,
      **kwargs: Any,
  ) -> None:
      """
      Parameters
      ----------
      inner_executor : BaseExecutor
          trading env in each trading bar.
      inner_strategy : BaseStrategy
          trading strategy in each trading bar
      skip_empty_decision: bool
          Will the executor skip call inner loop when the decision is empty.
          It should be False in following cases
          - The decisions may be updated by steps
          - The inner executor may not follow the decisions from the outer strategy
      align_range_limit: bool
          force to align the trade_range decision
          It is only for nested executor, because range_limit is given by outer strategy
      """
      self.inner_executor: BaseExecutor = init_instance_by_config(
          inner_executor,
          common_infra=common_infra,
          accept_types=BaseExecutor,
      )
      self.inner_strategy: BaseStrategy = init_instance_by_config(
          inner_strategy,
          common_infra=common_infra,
          accept_types=BaseStrategy,
      )
  
      self._skip_empty_decision = skip_empty_decision
      self._align_range_limit = align_range_limit
  
      super(NestedExecutor, self).__init__(
          time_per_step=time_per_step,
          start_time=start_time,
          end_time=end_time,
          indicator_config=indicator_config,
          generate_portfolio_metrics=generate_portfolio_metrics,
          verbose=verbose,
          track_data=track_data,
          common_infra=common_infra,
          **kwargs,
      )
  
imports: from __future__ import annotations
  import copy
  from abc import abstractmethod
  from collections import defaultdict
  from types import GeneratorType
  from typing import Any, Dict, Generator, List, Tuple, Union, cast
  import pandas
  from qlib.backtest.account import Account
  from qlib.backtest.position import BasePosition
  from qlib.log import get_module_logger
  from ..strategy.base import BaseStrategy
  from ..utils import init_instance_by_config
  from .decision import BaseTradeDecision, Order
  from .exchange import Exchange
  from .utils import CommonInfrastructure, LevelInfrastructure, TradeCalendarManager, get_start_end_idx
label_desc: Use image node_id 1 to create a new NestedExecutor object from inherited base classes: BaseExecutor with example: obj = NestedExecutor(time_per_step, inner_executor, inner_strategy, start_time, end_time, indicator_config, generate_portfolio_metrics, verbose, track_data, skip_empty_decision, align_range_limit, common_infra)