def expression(self, instrument, field, start_time=None, end_time=None, freq='day'):
    expression = self.get_expression_instance(field)
    start_time = pd.Timestamp(start_time)
    end_time = pd.Timestamp(end_time)
    (_, _, start_index, end_index) = Cal.locate_index(start_time, end_time, freq, future=False)
    (lft_etd, rght_etd) = expression.get_extended_window_size()
    series = expression.load(instrument, max(0, (start_index - lft_etd)), (end_index + rght_etd), freq)
    try:
        series = series.astype(float)
    except ValueError:
        pass
    if (not series.empty):
        series = series.loc[start_index:end_index]
    return series
def expression(self, instrument, field, start_time=None, end_time=None, freq='day'):
    expression = self.get_expression_instance(field)
    start_time = pd.Timestamp(start_time)
    end_time = pd.Timestamp(end_time)
    (_, _, start_index, end_index) = Cal.locate_index(start_time, end_time, freq, future=False)
    (lft_etd, rght_etd) = expression.get_extended_window_size()
    series = expression.load(instrument, max(0, (start_index - lft_etd)), (end_index + rght_etd), freq)
    try:
        series = series.astype(float)
    except ValueError:
        pass
    if (not series.empty):
        series = series.loc[start_index:end_index]
    return series