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 cal_trade_indicators(
      self,
      trade_start_time: Union[str, pd.Timestamp],
      freq: str,
      indicator_config: dict = {},
  ) -> None:
      show_indicator = indicator_config.get("show_indicator", False)
      ffr_config = indicator_config.get("ffr_config", {})
      pa_config = indicator_config.get("pa_config", {})
      fulfill_rate = self._cal_trade_fulfill_rate(
          method=ffr_config.get("weight_method", "mean")
      )
      price_advantage = self._cal_trade_price_advantage(
          method=pa_config.get("weight_method", "mean")
      )
      positive_rate = self._cal_trade_positive_rate()
      deal_amount = self._cal_deal_amount()
      trade_value = self._cal_trade_value()
      order_count = self._cal_trade_order_count()
      self.trade_indicator["ffr"] = fulfill_rate
      self.trade_indicator["pa"] = price_advantage
      self.trade_indicator["pos"] = positive_rate
      self.trade_indicator["deal_amount"] = deal_amount
      self.trade_indicator["value"] = trade_value
      self.trade_indicator["count"] = order_count
      if show_indicator:
          print(
              "[Indicator({}) {}]: FFR: {}, PA: {}, POS: {}".format(
                  freq,
                  trade_start_time
                  if isinstance(trade_start_time, str)
                  else trade_start_time.strftime("%Y-%m-%d %H:%M:%S"),
                  fulfill_rate,
                  price_advantage,
                  positive_rate,
              ),
          )
  
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 19 for calling the Indicator obj's underlying member method code with example usage: obj.cal_trade_indicators(trade_start_time, freq, indicator_config) without return types