docstr: parse the capacity limit string and return the actual amount of orders that can be executed.
  NOTE:
      this function will change the order.deal_amount **inplace**
      - This will make the order info more accurate
  Parameters
  ----------
  order : Order
      the order to be executed.
  dealt_order_amount : dict
      :param dealt_order_amount: the dealt order amount dict with the format of {stock_id: float}
docstr_tok: ["parse","the","capacity","limit","string","and","return","the","actual","amount","of","orders","that","can","be","executed",".","NOTE",":","this","function","will","change","the","order.deal_amount","*","*","inplace","*","*","-","This","will","make","the","order","info","more","accurate","Parameters","--","--","--","--","--","order",":","Order","the","order","to","be","executed",".","dealt_order_amount",":","dict",":","param","dealt_order_amount",":","the","dealt","order","amount","dict","with","the","format","of","{","stock_id",":","float","}"]
code: def _clip_amount_by_volume(
      self, order: Order, dealt_order_amount: dict
  ) -> Optional[float]:
      """parse the capacity limit string and return the actual amount of orders that can be executed.
      NOTE:
          this function will change the order.deal_amount **inplace**
          - This will make the order info more accurate
      Parameters
      ----------
      order : Order
          the order to be executed.
      dealt_order_amount : dict
          :param dealt_order_amount: the dealt order amount dict with the format of {stock_id: float}
      """
      vol_limit = (
          self.buy_vol_limit
          if order.direction == Order.BUY
          else self.sell_vol_limit
      )
  
      if vol_limit is None:
          return order.deal_amount
  
      vol_limit_num: List[float] = []
      for limit in vol_limit:
          assert isinstance(limit, tuple)
          if limit[0] == "current":
              limit_value = self.quote.get_data(
                  order.stock_id,
                  order.start_time,
                  order.end_time,
                  field=limit[1],
                  method="sum",
              )
              vol_limit_num.append(cast(float, limit_value))
          elif limit[0] == "cum":
              limit_value = self.quote.get_data(
                  order.stock_id,
                  order.start_time,
                  order.end_time,
                  field=limit[1],
                  method="ts_data_last",
              )
              vol_limit_num.append(
                  limit_value - dealt_order_amount[order.stock_id]
              )
          else:
              raise ValueError(f"{limit[0]} is not supported")
      vol_limit_min = min(vol_limit_num)
      orig_deal_amount = order.deal_amount
      order.deal_amount = max(min(vol_limit_min, orig_deal_amount), 0)
      if vol_limit_min < orig_deal_amount:
          self.logger.debug(
              f"Order clipped due to volume limitation: {order}, {list(zip(vol_limit_num, vol_limit))}"
          )
  
      return None
  
imports: from __future__ import annotations
  from collections import defaultdict
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type, Union, cast
  from ..utils.index_data import IndexData
  import random
  import numpy
  import pandas
  from qlib.backtest.position import BasePosition
  from ..config import C
  from ..constant import REG_CN, REG_TW
  from ..data.data import D
  from ..log import get_module_logger
  from .decision import Order, OrderDir, OrderHelper
  from .high_performance_ds import BaseQuote, NumpyQuote
label_desc: Use image node_id 23 for calling the Exchange obj's underlying member method code with example usage: obj._clip_amount_by_volume(order, dealt_order_amount) and returns: None, order