def list_instruments(self, instruments, start_time=None, end_time=None, freq='day', as_list=False):
    market = instruments['market']
    if (market in H['i']):
        _instruments = H['i'][market]
    else:
        _instruments = self._load_instruments(market)
        H['i'][market] = _instruments
    cal = Cal.calendar(freq=freq)
    start_time = pd.Timestamp((start_time or cal[0]))
    end_time = pd.Timestamp((end_time or cal[(- 1)]))
    _instruments_filtered = {inst: list(filter((lambda x: (x[0] <= x[1])), [(max(start_time, x[0]), min(end_time, x[1])) for x in spans])) for (inst, spans) in _instruments.items()}
    _instruments_filtered = {key: value for (key, value) in _instruments_filtered.items() if value}
    filter_pipe = instruments['filter_pipe']
    for filter_config in filter_pipe:
        from . import filter as F
        filter_t = getattr(F, filter_config['filter_type']).from_config(filter_config)
        _instruments_filtered = filter_t(_instruments_filtered, start_time, end_time, freq)
    if as_list:
        return list(_instruments_filtered)
    return _instruments_filtered
def list_instruments(self, instruments, start_time=None, end_time=None, freq='day', as_list=False):
    market = instruments['market']
    if (market in H['i']):
        _instruments = H['i'][market]
    else:
        _instruments = self._load_instruments(market)
        H['i'][market] = _instruments
    cal = Cal.calendar(freq=freq)
    start_time = pd.Timestamp((start_time or cal[0]))
    end_time = pd.Timestamp((end_time or cal[(- 1)]))
    _instruments_filtered = {inst: list(filter((lambda x: (x[0] <= x[1])), [(max(start_time, x[0]), min(end_time, x[1])) for x in spans])) for (inst, spans) in _instruments.items()}
    _instruments_filtered = {key: value for (key, value) in _instruments_filtered.items() if value}
    filter_pipe = instruments['filter_pipe']
    for filter_config in filter_pipe:
        from . import filter as F
        filter_t = getattr(F, filter_config['filter_type']).from_config(filter_config)
        _instruments_filtered = filter_t(_instruments_filtered, start_time, end_time, freq)
    if as_list:
        return list(_instruments_filtered)
    return _instruments_filtered