Querying Minute Bars and Creating Rolling and Cross-Sectional Features
Summary
This tutorial demonstrates extracting minute-level stock data for a selected date range with a distributed query platform, then calculating features through SQL-style operators. The examples cover a five-period moving average of closing prices, a cross-sectional percentile rank of close, and a rolling correlation between volume and close over a 60-period window. Results are returned as a dataframe for further analysis.
The examples use a CSI 1000 stock minute-bar table and describe a training-data workflow. The document presents code patterns rather than trading signals, validation results, or a tested strategy. It does not discuss handling missing observations, market-session boundaries, look-ahead bias, or how to evaluate the features, so these calculations require additional checks before research or live use.
Key ideas
- A date filter can restrict minute-bar queries to a chosen research interval.
- Rolling SQL operators can calculate moving averages and correlations directly from bar data.
- A cross-sectional ranking operator can transform prices into percentile ranks.
- The examples illustrate feature construction and data retrieval, not evidence of predictive value.
- Researchers must address data quality and timing assumptions before using the resulting features.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.