code: def close_to_close(self, pxs):
          
          if not isinstance(pxs, pd.Series):
              raise ValueError('pxs expected to be Series')
  
          blotter = TradeBlotter()
          signal = self.signal.dropna()
          diff = signal.diff()
          diff.iloc[0] = 0
          changes = signal[diff != 0]
          lsig = 0
          qtyfct = self._qty_fct(pxs.index)
          for ts, sig in changes.iteritems():
              blotter.ts = ts
              if sig != lsig:
                  px = pxs.get(ts, None)
                  if px is None:
                      raise Exception('insufficient price data: no data found at %s' % ts)
                  if lsig != 0:  # close open trd
                      blotter.close(px=px)
  
                  if sig != 0:
                      size = abs(qtyfct(ts))
                      qty = sig > 0 and size or -size
                      blotter.open(qty, px)
              lsig = sig
          return blotter.trades
docs: :param pxs:
          :return: