code: def rtotal(vec):
      r"""Calculate the running total.
  
      Parameters
      ----------
      vec : pandas.Series
          The input array for calculating the running total.
  
      Returns
      -------
      running_total : int
          The final running total.
  
      Example
      -------
  
      >>> vec.rolling(window=20).apply(rtotal)
  
      """
      tcount = np.count_nonzero(vec)
      fcount = len(vec) - tcount
      running_total = tcount - fcount
      return running_total
  
imports: from alphapy.calendrical import biz_day_month
  from alphapy.calendrical import biz_day_week
  from alphapy.globals import NULLTEXT
  from alphapy.globals import BSEP, PSEP, USEP
  from alphapy.variables import vexec
  import itertools
  import logging
  import math
  import numpy
  import pandas
label_desc: Use image node_id 39 for calling a global function with example usage: rtotal(vec) and returns: running_total