code: def frame(self):
          
          rows = []
          pricer = self.pricer
          pos = open_val = pid = 0
          for txn in self.trades:
              # These values always get copied
              qty = txn.qty
              premium = pricer.get_premium(qty, txn.px, ts=txn.ts)
              if pos == 0:  # Open position
                  side = qty > 0 and Action.Buy or Action.SellShort
                  open_val = premium
                  pid += 1
                  side = side
                  intent = Intent.Open
                  pos = qty
              elif pos + qty == 0:  # close position
                  side = qty > 0 and Action.Cover or Action.Sell
                  open_val = 0
                  side = side
                  intent = Intent.Close
                  pos = 0
              elif is_increase(pos, qty):
                  side = txn.qty > 0 and Action.Buy or Action.SellShort
                  open_val += premium
                  pos += qty
                  intent = Intent.Increase
                  side = side
              else:  # decrease - no worries about split since iterator takes care of it
                  side = txn.qty > 0 and Action.Cover or Action.Sell
                  open_val *= ((pos + qty) / pos)
                  pos += qty
                  intent = Intent.Decrease
                  side = side
  
              # Get rid of anything but the date
              dt = txn.ts.to_period('B').to_timestamp()
              rows.append([dt, txn.ts, pid, txn.tid, txn.qty, txn.px, txn.fees, premium, open_val, pos, intent, side])
  
          df = pd.DataFrame.from_records(rows, columns=[TC.DT, TC.TS, TC.PID, TC.TID, TC.QTY, TC.PX, TC.FEES, TC.PREMIUM,
                                                        TC.OPEN_VAL, TC.POS, TC.INTENT, TC.ACTION])
          df.index.name = 'seq'
          return df
docs: Convert the trades to transaction level details necessary for long/short accouting.
  
          :param trades:
          :param pricer: provides the interface to get premium for a specified quanity, price, and timestamp.
          :return: