class_docstr: Base executor for trading
docstr: Please refer to the doc of collect_data
  The only difference between `_collect_data` and `collect_data` is that some common steps are moved into
  collect_data
  
  Parameters
  ----------
  Please refer to the doc of collect_data
  
  
  Returns
  -------
  Tuple[List[object], dict]:
      (<the executed result for trade decision>, <the extra kwargs for `self.trade_account.update_bar_end`>)
docstr_tok: ["Please","refer","to","the","doc","of","collect_data","The","only","difference","between","`","_collect_data","`","and","`","collect_data","`","is","that","some","common","steps","are","moved","into","collect_data","Parameters","--","--","--","--","--","Please","refer","to","the","doc","of","collect_data","Returns","--","--","--","-","Tuple","[","List","[","object","]",",","dict","]",":","(","<","the","executed","result","for","trade","decision",">",",","<","the","extra","kwargs","for","`","self.trade_account.update_bar_end","`",">",")"]
code: def _collect_data(
      self,
      trade_decision: BaseTradeDecision,
      level: int = 0,
  ) -> Union[
      Generator[Any, Any, Tuple[List[object], dict]],
      Tuple[List[object], dict],
  ]:
      """
      Please refer to the doc of collect_data
      The only difference between `_collect_data` and `collect_data` is that some common steps are moved into
      collect_data
  
      Parameters
      ----------
      Please refer to the doc of collect_data
  
  
      Returns
      -------
      Tuple[List[object], dict]:
          (<the executed result for trade decision>, <the extra kwargs for `self.trade_account.update_bar_end`>)
      """
  
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 9 for calling the BaseExecutor obj's underlying member method code with example usage: obj._collect_data(trade_decision, level) without return types