TQTradingQuery

Gaps · MYM

How long does it typically take for a gap on MYM to fill, when it does

115

gap count

n=592026-03-05 to 2026-09-07

gap count

115

filled count

59

fill rate

51.3%

median minutes to fill

30

mean minutes to fill

61.27

p25 minutes to fill

12

p75 minutes to fill

77.5

min minutes to fill

0

max minutes to fill

350

Methodology

Analysis code was generated by an AI model up to 25 times, run in a sandbox against real MYM 1-minute bars from 2026-03-05 to 2026-09-07, and reviewed automatically. Attempts that computed the same set of measures were grouped, and the figures shown are the median of the largest group. Agreement between attempts lowers the chance of a one-off coding slip; it does not prove the code matches the question, so the exact code is shown below.

Show the code

et = to_et(bars)
rth = rth_session(et)
rth = rth.copy()
rth['tdate'] = trading_date(rth)

days = rth['tdate'].unique()
days = sorted(days)

fill_times = []
gap_count = 0
filled_count = 0

prev_close = None
for i, d in enumerate(days):
    day_bars = rth[rth['tdate'] == d]
    if day_bars.empty:
        continue
    day_open = day_bars['open'].iloc[0]
    if prev_close is not None:
        gap = day_open - prev_close
        # threshold: consider a "gap" if abs gap > 0.1% of prev_close
        if abs(gap) > 0.001 * prev_close:
            gap_count += 1
            # check if/when it fills: price crosses back to prev_close
            if gap > 0:
                # gap up: fill when low <= prev_close
                mask = day_bars['low'] <= prev_close
            else:
                # gap down: fill when high >= prev_close
                mask = day_bars['high'] >= prev_close
            if mask.any():
                filled_count += 1
                fill_time = day_bars.index[mask.values.argmax()]
                open_time = day_bars.index[0]
                minutes_to_fill = (fill_time - open_time).total_seconds() / 60.0
                fill_times.append(minutes_to_fill)
    prev_close = day_bars['close'].iloc[-1]

sample_size = len(fill_times)
if sample_size > 0:
    fill_series = pd.Series(fill_times)
    result = {
        "sample_size": sample_size,
        "gap_count": int(gap_count),
        "filled_count": int(filled_count),
        "fill_rate": float(filled_count / gap_count) if gap_count > 0 else None,
        "median_minutes_to_fill": float(fill_series.median()),
        "mean_minutes_to_fill": float(fill_series.mean()),
        "p25_minutes_to_fill": float(fill_series.quantile(0.25)),
        "p75_minutes_to_fill": float(fill_series.quantile(0.75)),
        "min_minutes_to_fill": float(fill_series.min()),
        "max_minutes_to_fill": float(fill_series.max()),
    }
else:
    result = {
        "sample_size": 0,
        "gap_count": int(gap_count),
        "filled_count": 0,
        "fill_rate": None,
        "median_minutes_to_fill": None,
        "mean_minutes_to_fill": None,
        "p25_minutes_to_fill": None,
        "p75_minutes_to_fill": None,
        "min_minutes_to_fill": None,
        "max_minutes_to_fill": None,
    }
  • Generated by an AI model up to 25 times, run in a sandbox, and reviewed automatically; the figures above are the median of the largest group of attempts that computed the same measures. Agreement between attempts lowers the chance of a one-off coding slip -- it does not prove the code matches the question, so check the definition and code. A one-off calculation, not a permanent fixture.

This is historical statistical information only. It is not investment advice, and past performance does not indicate future results. Trading involves risk of loss.