code: def QA_data_tick_resample(tick, type_='1min'):
      
      tick = tick.assign(amount=tick.price * tick.vol)
      resx = pd.DataFrame()
      _temp = set(tick.index.date)
  
      for item in _temp:
          _data = tick.loc[str(item)]
          _data1 = _data[time(9,
                              31):time(11,
                                       30)].resample(
                                           type_,
                                           closed='right',
                                           base=30,
                                           loffset=type_
                                       ).apply(
                                           {
                                               'price': 'ohlc',
                                               'vol': 'sum',
                                               'code': 'last',
                                               'amount': 'sum'
                                           }
                                       )
  
          _data2 = _data[time(13,
                              1):time(15,
                                      0)].resample(
                                          type_,
                                          closed='right',
                                          loffset=type_
                                      ).apply(
                                          {
                                              'price': 'ohlc',
                                              'vol': 'sum',
                                              'code': 'last',
                                              'amount': 'sum'
                                          }
                                      )
  
          resx = resx.append(_data1).append(_data2)
      resx.columns = resx.columns.droplevel(0)
      return resx.reset_index().drop_duplicates().set_index(['datetime', 'code'])
docs: tick采样成任意级别分钟线
  
      Arguments:
          tick {[type]} -- transaction
  
      Returns:
          [type] -- [description]