Skip to content
All library documents

Expressing Rolling Turnover and Lagged Price Averages in SQL

Article BigQuant

Summary

This brief discussion asks how to translate legacy rolling-factor expressions into SQL: a five-day sum of turnover, a five-day mean of closing prices shifted three days back, and a ten-day statistic. It also raises a practical data-type issue when calculating a later factor from an earlier one.

The exchange notes that an explicitly integer-typed result may prevent a dataframe column from being read as an object, and asks whether null values in an intermediate factor could cause that type conversion. It does not provide a SQL query, a definitive explanation of the behavior, or a tested resolution. The useful takeaway is the need to check both rolling-window offsets and output types when migrating factor calculations; the specific null-handling and engine behavior remain unresolved.

Key ideas

  • The example concerns a five-day rolling turnover sum and a lagged five-day closing-price average.
  • A ten-day statistic is mentioned, but its exact expression is not shown.
  • The discussion identifies dataframe object types as a possible consequence of factor output typing.
  • It asks whether null values in an intermediate factor can affect the type of a later calculation.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.