code: def trade(self):
          
  
          return self.history_table.pivot_table(
              index=['datetime',
                     'account_cookie'],
              columns='code',
              values='amount',
              aggfunc=np.sum
          ).fillna(0).sort_index()
docs: 每次交易的pivot表
  
          Returns:
              pd.DataFrame
  
              此处的pivot_table一定要用np.sum