class_docstr: `Indicator` is implemented in a aggregate way.
  All the metrics are calculated aggregately.
  All the metrics are calculated for a separated stock and in a specific step on a specific level.
  
  | indicator    | desc.                                                        |
  |--------------+--------------------------------------------------------------|
  | amount       | the *target* amount given by the outer strategy              |
  | deal_amount  | the real deal amount                                         |
  | inner_amount | the total *target* amount of inner strategy                  |
  | trade_price  | the average deal price                                       |
  | trade_value  | the total trade value                                        |
  | trade_cost   | the total trade cost  (base price need drection)             |
  | trade_dir    | the trading direction                                        |
  | ffr          | full fill rate                                               |
  | pa           | price advantage                                              |
  | pos          | win rate                                                     |
  | base_price   | the price of baseline                                        |
  | base_volume  | the volume of baseline (for weighted aggregating base_price) |
  
  **NOTE**:
  The `base_price` and `base_volume` can't be NaN when there are not trading on that step. Otherwise
  aggregating get wrong results.
  
  So `base_price` will not be calculated in a aggregate way!!
class_docstr_tok: ["`","Indicator","`","is","implemented","in","a","aggregate","way",".","All","the","metrics","are","calculated","aggregately",".","All","the","metrics","are","calculated","for","a","separated","stock","and","in","a","specific","step","on","a","specific","level",".","|","indicator","|","desc",".","|","|","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","|","|","amount","|","the","*","target","*","amount","given","by","the","outer","strategy","|","|","deal_amount","|","the","real","deal","amount","|","|","inner_amount","|","the","total","*","target","*","amount","of","inner","strategy","|","|","trade_price","|","the","average","deal","price","|","|","trade_value","|","the","total","trade","value","|","|","trade_cost","|","the","total","trade","cost","(","base","price","need","drection",")","|","|","trade_dir","|","the","trading","direction","|","|","ffr","|","full","fill","rate","|","|","pa","|","price","advantage","|","|","pos","|","win","rate","|","|","base_price","|","the","price","of","baseline","|","|","base_volume","|","the","volume","of","baseline","(","for","weighted","aggregating","base_price",")","|","*","*","NOTE","*","*",":","The","`","base_price","`","and","`","base_volume","`","ca","n't","be","NaN","when","there","are","not","trading","on","that","step",".","Otherwise","aggregating","get","wrong","results",".","So","`","base_price","`","will","not","be","calculated","in","a","aggregate","way","!","!"]
code: def __init__(
      self,
      order_indicator_cls: Type[
          BaseOrderIndicator
      ] = NumpyOrderIndicator,
  ) -> None:
      self.order_indicator_cls = order_indicator_cls
  
      # order indicator is metrics for a single order for a specific step
      self.order_indicator_his: dict = OrderedDict()
      self.order_indicator: BaseOrderIndicator = (
          self.order_indicator_cls()
      )
  
      # trade indicator is metrics for all orders for a specific step
      self.trade_indicator_his: dict = OrderedDict()
      self.trade_indicator: Dict[
          str, Optional[BaseSingleMetric]
      ] = OrderedDict()
  
      self._trade_calendar = None
  
imports: from __future__ import annotations
  import pathlib
  from collections import OrderedDict
  from typing import Any, Dict, List, Optional, Text, Tuple, Type, Union, cast
  import numpy
  import pandas
  import qlib.utils.index_data
  from qlib.backtest.decision import BaseTradeDecision, Order, OrderDir
  from qlib.backtest.exchange import Exchange
  from ..tests.config import CSI300_BENCH
  from ..utils.resam import get_higher_eq_freq_feature, resam_ts_data
  from .high_performance_ds import BaseOrderIndicator, BaseSingleMetric, NumpyOrderIndicator
label_desc: Use image node_id 1 to create a new Indicator object  with example: obj = Indicator(order_indicator_cls)