code: def construct_request(ticker, fields=None, date=None,
                            date_from=None, date_to=None, freq=None):
          if isinstance(ticker, basestring):
              request = ticker
          elif hasattr(ticker, '__len__'):
              request = ','.join(ticker)
          else:
              raise ValueError('ticker should be either string or list/array of strings')
          if fields is not None:
              if isinstance(fields, basestring):
                  request += '~=' + fields
              elif isinstance(fields, list) and len(fields) > 0:
                  request += '~=' + ','.join(fields)
          if date is not None:
              request += '~@' + pd.to_datetime(date).strftime('%Y-%m-%d')
          else:
              if date_from is not None:
                  request += '~' + pd.to_datetime(date_from).strftime('%Y-%m-%d')
              if date_to is not None:
                  request += '~:' + pd.to_datetime(date_to).strftime('%Y-%m-%d')
          if freq is not None:
              request += '~' + freq
          return request