Daily, Weekly, and Monthly Price Series: Aggregation Differences

This Python-centric guide explains how daily, weekly, and monthly price series are constructed in Indian equity markets. It details aggregation logic, data workflows, algorithms, and storage design, helping traders, analysts, and engineers understand how time-based aggregation shapes price behavior across short-, medium-, and long-term horizons.

Table Of Contents
  1. Daily, Weekly, and Monthly Price Series: Aggregation Differences
  2. Conceptual Foundations of Price Aggregation
  3. Indian Market Structure Constraints
  4. Daily Price Series Aggregation Logic
  5. Weekly Price Series Aggregation Logic
  6. Monthly Price Series Aggregation Logic
  7. Aggregation Edge Cases in Indian Equity Data
  8. Handling Missing Data in Aggregated Series
  9. Aggregation Correctness and Validation
  10. Comparative Behavior of Daily, Weekly, and Monthly Price Series
  11. Statistical Implications of Aggregation
  12. Production-Grade Python Aggregation Design
  13. Aggregation and Trading Horizon Alignment
  14. Risk Measurement Across Aggregation Levels
  15. Why Aggregation Must Remain Non-Interpretive
  16. Advanced Aggregation Algorithms and Validation Utilities
  17. Comprehensive Fetch → Store → Measure Architecture
  18. Impact of Aggregation on Trading Horizons
  19. Python Libraries Applicable to Price Aggregation
  20. Data Sourcing Methodologies
  21. Database Structure and Storage Design
  22. Author’s Note on Aggregation Scope
  23. Conclusion

Daily, Weekly, and Monthly Price Series: Aggregation Differences

In Indian equity markets, historical price series are not raw observations but structured outcomes of well-defined aggregation rules. Daily, weekly, and monthly price series differ not merely in frequency, but in how time, liquidity, session structure, exchange rules, and corporate continuity interact to form price records. For Python-driven trading systems, research pipelines, and analytics platforms, understanding these aggregation differences is foundational.

This article presents a Python-centric, production-grade explanation of price aggregation across time horizons in Indian stock markets. It focuses on aggregation logic rather than interpretation, aligning with the principle that performance attribution and inference belong to separate statistical layers. Each section explains aggregation mechanics, data workflows, algorithms, and the implications for short-, medium-, and long-term trading.

Conceptual Foundations of Price Aggregation

What Aggregation Means in Market Data

Aggregation transforms a sequence of lower-frequency observations into a higher-level representation that preserves specific statistical properties. In equity markets, this involves compressing intraday or daily price data into structured OHLC representations over defined calendar intervals. The aggregation window defines which trades qualify, how extremes are computed, and which timestamp represents the period.

Unlike mathematical resampling, market aggregation must respect trading sessions, holidays, corporate events, and exchange dissemination rules. In India, these constraints are enforced by NSE and BSE trading calendars and corporate action frameworks.

Time Horizons and Market Intent

Each aggregation horizon encodes a different market question. Daily series reflect session-level consensus. Weekly series capture rolling sentiment across multiple sessions. Monthly series emphasize capital reallocation cycles and institutional positioning. These distinctions are mechanical, not interpretive.

Daily Aggregation Horizon

Daily prices summarize a single trading session. They are sensitive to intraday volatility, pre-open auctions, and end-of-day liquidity concentration.

Weekly Aggregation Horizon

Weekly prices compress multiple sessions, dampening noise from single-day anomalies while preserving directional continuity.

Monthly Aggregation Horizon

Monthly prices aggregate across business cycles, reporting periods, and portfolio rebalancing intervals, significantly reducing microstructure effects.

Indian Market Structure Constraints

Trading Sessions and Calendars

Indian equities trade within strictly defined sessions, including pre-open, continuous trading, and closing auctions. Aggregation logic must exclude non-trading days, account for exchange holidays, and respect half-day sessions.

Trading Calendar Construction (Python)
import pandas as pd
import pandas_market_calendars as mcal

nse = mcal.get_calendar('NSE')
schedule = nse.schedule(start_date='2023-01-01', end_date='2023-12-31')
trading_days = schedule.index

This calendar becomes the authoritative backbone for all aggregation, preventing accidental inclusion of non-trading periods.

Corporate Continuity and Symbol Lifecycle

Price series aggregation must handle listings, suspensions, mergers, and relistings without breaking temporal continuity. Aggregation windows cannot bridge inactive periods. This constraint is especially critical for weekly and monthly series.

Daily Price Series Aggregation Logic

Definition of Daily OHLC Construction

A daily price bar aggregates all valid trades executed during a single trading session. The opening price reflects the first executable trade, often influenced by pre-open auctions. The high and low capture intraday extremes. The close reflects the final traded price in the continuous or closing session.

Daily OHLC Aggregation Algorithm
def aggregate_daily(df):
    return {
        "open": df.iloc[0]["price"],
        "high": df["price"].max(),
        "low": df["price"].min(),
        "close": df.iloc[-1]["price"]
    }

Fetch → Store → Measure Workflow (Daily)

Fetch

Daily aggregation fetches tick-level or intraday bar data for each trading day using exchange-aligned timestamps.

Store

Data is stored in date-partitioned structures, typically one partition per symbol per trading day, enabling replay and recalculation.

Measure

Measurements include daily returns, gaps, ranges, and volatility proxies derived strictly from aggregated OHLC values.

Trading Horizon Impact of Daily Aggregation

Short-Term Trading

Daily bars retain sensitivity to session-specific events, making them suitable for swing strategies and overnight risk analysis.

Medium-Term Trading

Single-day anomalies can distort signals when used alone, necessitating rolling aggregation or smoothing.

Long-Term Trading

Daily series serve as inputs rather than decision layers, feeding higher-horizon aggregation.

Weekly Price Series Aggregation Logic

Definition of Weekly Aggregation Window

Weekly aggregation groups consecutive trading sessions, typically from the first trading day of the week to the last. Partial weeks arise due to holidays or listings.

Weekly Aggregation Using Pandas
weekly = daily_df.resample('W-FRI').agg({
    'open': 'first',
    'high': 'max',
    'low': 'min',
    'close': 'last'
})

Calendar Alignment Considerations

In Indian markets, weeks may contain fewer than five sessions. Aggregation must rely on actual trading days rather than fixed day counts.

Fetch → Store → Measure Workflow (Weekly)

Fetch

Weekly aggregation fetches daily bars aligned to the official trading calendar, not ISO weeks.

Store

Weekly bars are stored as derived datasets with metadata referencing underlying daily partitions.

Measure

Weekly measurements emphasize trend persistence, range expansion, and multi-session momentum.

Trading Horizon Impact of Weekly Aggregation

Short-Term Trading

Weekly bars are unsuitable for intraday decision-making but useful for regime detection.

Medium-Term Trading

They smooth noise and align well with swing and positional strategies.

Long-Term Trading

Weekly series act as structural trend indicators feeding portfolio-level decisions.

Monthly Price Series Aggregation Logic

Definition of Monthly Aggregation Window

Monthly price aggregation compresses all valid trading sessions within a calendar month into a single OHLC structure. Unlike fixed-period aggregation, monthly windows vary in length due to holidays, trading suspensions, and partial listing months. This makes calendar alignment a critical constraint rather than a convenience.

In Indian equity markets, monthly aggregation is strictly calendar-based, not rolling-day based. A month begins with the first eligible trading session and ends with the final trading session before the calendar month closes.

Monthly OHLC Aggregation Algorithm
monthly = daily_df.resample('M').agg({
    'open': 'first',
    'high': 'max',
    'low': 'min',
    'close': 'last'
})

Partial Months and Listing Effects

When a stock lists mid-month, its monthly open corresponds to the first traded price after listing, not an inferred price. Similarly, if a stock is suspended or delisted mid-month, the monthly close reflects the last valid trade before suspension.

Fetch → Store → Measure Workflow (Monthly)

Fetch

Monthly aggregation fetches daily bars only for sessions that occurred within the calendar month and passed validity checks for symbol continuity.

Store

Monthly bars are stored as high-level analytical datasets, often partitioned by year and symbol to optimize long-horizon scans.

Measure

Measurements include long-horizon returns, drawdowns, and volatility compression metrics derived exclusively from monthly OHLC data.

Trading Horizon Impact of Monthly Aggregation

Short-Term Trading

Monthly bars have minimal relevance for short-term trading due to excessive temporal compression.

Medium-Term Trading

They assist in regime classification and confirmation of higher-level trend structures.

Long-Term Trading

Monthly aggregation is foundational for strategic asset allocation, capital rotation, and multi-year performance evaluation.

Aggregation Edge Cases in Indian Equity Data

Holidays, Truncated Weeks, and Irregular Months

Indian exchanges observe numerous holidays, resulting in weeks with fewer trading sessions and months with uneven session counts. Aggregation logic must respect trading calendars rather than assuming uniform temporal spacing.

Calendar-Aware Aggregation Filter
valid_days = daily_df.index.intersection(trading_days)
filtered_df = daily_df.loc[valid_days]

Suspensions and Trading Halts

Suspended securities introduce gaps that cannot be interpolated during aggregation. Weekly or monthly bars must terminate at the last valid session and resume only upon reinstatement.

Corporate Actions and Aggregation Boundaries

While corporate-action adjustments affect price continuity, aggregation windows themselves must not cross corporate discontinuities such as mergers, spin-offs, or symbol changes.

Handling Missing Data in Aggregated Series

Classification of Missing Values

Missing values in aggregated series arise from non-trading days, illiquid sessions, or corporate events. These must be classified rather than blindly filled.

Structural Missing Data

Occurs due to holidays, suspensions, or listing constraints. These are non-recoverable and should remain absent.

Data Quality Missing Data

Occurs due to ingestion failures or vendor outages and must be flagged for remediation.

Missing Data Detection Logic
missing = expected_days.difference(daily_df.index)

Fetch → Store → Measure Workflow (Missing Data)

Fetch

Fetch workflows must include redundancy checks across multiple ingestion passes to detect accidental omissions.

Store

Storage layers must preserve null states explicitly rather than imputing values during ingestion.

Measure

Measurement logic must skip structurally missing periods while alerting on data-quality gaps.

Trading Horizon Impact of Missing Data

Short-Term Trading

Missing daily data can invalidate signal generation and must halt execution.

Medium-Term Trading

Weekly gaps may distort momentum calculations if not handled explicitly.

Long-Term Trading

Monthly gaps usually reflect legitimate inactivity and should be preserved.

Aggregation Correctness and Validation

Reproducibility as a Design Requirement

Aggregation pipelines must be deterministic. Given the same raw inputs and calendar constraints, the output must be identical across environments and reruns.

Aggregation Validation Check
assert weekly['high'] >= weekly['open']
assert weekly['high'] >= weekly['close']
assert weekly['low'] <= weekly['open']
assert weekly['low'] <= weekly['close']

Cross-Frequency Consistency Checks

Weekly and monthly highs must never violate the extrema observed in their underlying daily bars. Violations indicate aggregation or data alignment errors.

Trading Horizon Impact of Aggregation Errors

Short-Term Trading

Errors propagate instantly into execution logic, creating false signals.

Medium-Term Trading

Incorrect weekly bars distort trend confirmation and stop placement.

Long-Term Trading

Long-horizon errors compound silently, corrupting performance attribution.

Comparative Behavior of Daily, Weekly, and Monthly Price Series

Noise Compression Across Aggregation Horizons

Aggregation acts as a deterministic noise filter. As the aggregation horizon expands, microstructure noise, bid–ask bounce, and intraday liquidity shocks are progressively absorbed into higher-level extrema rather than propagated as standalone observations.

Daily series preserve session-level volatility. Weekly series compress idiosyncratic daily shocks. Monthly series suppress most microstructure artifacts, retaining only structural price movement.

Volatility Compression Illustration
daily_vol = daily_df['close'].pct_change().std()
weekly_vol = weekly_df['close'].pct_change().std()
monthly_vol = monthly_df['close'].pct_change().std()

Extrema Formation Differences

Highs and lows behave differently across horizons. A daily high reflects a single trade. A weekly high reflects the maximum of multiple session highs. A monthly high represents the extreme price discovery across an entire calendar cycle.

Return Path Dependency

Aggregated returns are path-dependent. The same monthly open and close can emerge from vastly different daily trajectories, making higher-horizon bars lossy representations of lower-horizon dynamics.

Statistical Implications of Aggregation

Distributional Shape Changes

Return distributions become increasingly symmetric and leptokurtic as aggregation windows expand. Daily returns exhibit fat tails driven by event risk, while monthly returns smooth these effects.

Return Distribution Construction
returns = {
    "daily": daily_df['close'].pct_change(),
    "weekly": weekly_df['close'].pct_change(),
    "monthly": monthly_df['close'].pct_change()
}

Autocorrelation Decay

Short-term autocorrelation observed in daily series weakens in weekly data and often disappears in monthly series. This decay is mechanical, not behavioral, resulting from aggregation overlap.

Range Expansion and Compression

Absolute ranges expand with aggregation length, while relative ranges contract. Weekly ranges are larger than daily ranges, but weekly range-to-close ratios are often smaller.

Range Computation Formula
range_value = high - low
relative_range = (high - low) / close

Production-Grade Python Aggregation Design

Pipeline-Oriented Aggregation Architecture

Professional systems treat aggregation as a deterministic pipeline stage rather than an analytical afterthought. Raw data ingestion, validation, aggregation, and persistence are strictly separated.

Unified Aggregation Function

A single aggregation engine should support multiple horizons while enforcing calendar correctness and continuity constraints.

Multi-Horizon Aggregation Engine
def aggregate_prices(df, freq):
    return df.resample(freq).agg({
        'open': 'first',
        'high': 'max',
        'low': 'min',
        'close': 'last'
    })

Fetch → Store → Measure Workflow (Unified)

Fetch

Fetch layers retrieve the lowest-resolution data required, typically intraday or daily bars, along with authoritative trading calendars.

Store

Raw data is stored immutably. Aggregated datasets are stored separately with lineage metadata linking them to source partitions.

Measure

Measurements are computed only on validated aggregated datasets, ensuring that analytical logic never mutates raw data.

Aggregation and Trading Horizon Alignment

Short-Term Trading Alignment

Short-term strategies rely on daily or intraday aggregation. Weekly and monthly series are unsuitable for execution but useful for regime filters.

Short-Term Signal Gate
if weekly_trend == "up":
    execute_daily_strategy()

Medium-Term Trading Alignment

Medium-term strategies align naturally with weekly aggregation. Daily noise is suppressed while actionable trends remain intact.

Long-Term Trading Alignment

Long-term strategies depend primarily on monthly aggregation. Daily and weekly series serve only as explanatory inputs.

Risk Measurement Across Aggregation Levels

Drawdown Characteristics

Drawdowns measured on daily series capture intraperiod pain, while weekly and monthly drawdowns reflect capital-level risk exposure.

Drawdown Calculation
def drawdown(series):
    cumulative = series.cummax()
    return (series - cumulative) / cumulative

Volatility Regime Detection

Volatility clustering appears strongly in daily data and weakens progressively across weekly and monthly series.

Why Aggregation Must Remain Non-Interpretive

Separation of Concerns

Aggregation defines what happened, not why it happened. Interpretation belongs to statistical modeling, strategy logic, or macroeconomic analysis layers.

Maintaining this separation ensures aggregation remains reproducible, auditable, and reusable across multiple analytical contexts.

Advanced Aggregation Algorithms and Validation Utilities

Cross-Horizon Consistency Enforcement

Aggregated price series must obey strict dominance rules across horizons. Weekly and monthly extrema must be derivable from their underlying daily extrema. Any violation signals calendar misalignment, symbol discontinuity, or data corruption.

Cross-Horizon High–Low Consistency Check
def validate_extrema(lower_df, higher_df, freq):
    grouped = lower_df.resample(freq)
    assert (grouped['high'].max() == higher_df['high']).all()
    assert (grouped['low'].min() == higher_df['low']).all()

Gap-Safe Aggregation Logic

Aggregation windows must never bridge inactive periods. If trading halts or suspensions occur, the aggregation window must close and reopen without interpolation.

Gap Detection Algorithm
def detect_gaps(dates, calendar):
    expected = set(calendar)
    observed = set(dates)
    return sorted(expected - observed)

Session Integrity Validation

Each aggregated bar must correspond exclusively to valid trading sessions. No bar may include timestamps outside official market hours.

Session Boundary Filter
def filter_sessions(df, open_time, close_time):
    return df.between_time(open_time, close_time)

Comprehensive Fetch → Store → Measure Architecture

Fetch Layer Design

The fetch layer is responsible for acquiring the lowest available resolution data with authoritative timestamps. In Indian markets, this typically means tick data, 1-minute bars, or official daily OHLC feeds aligned to exchange calendars.

Fetch Abstraction Pattern
class DataFetcher:
    def fetch(self, symbol, start, end):
        raise NotImplementedError

Store Layer Design

Storage layers must preserve raw data immutably and store aggregated datasets separately. Derived series should always reference their source partitions to enable recomputation.

Partitioned Storage Schema
/data/
  /raw/
    /symbol/
      /date.parquet
  /aggregated/
    /daily/
    /weekly/
    /monthly/

Measure Layer Design

Measurement layers consume only validated aggregated datasets. No measurement logic should alter aggregation outputs or perform implicit resampling.

Measurement Isolation Pattern
def measure_returns(df):
    return df['close'].pct_change()

Impact of Aggregation on Trading Horizons

Short-Term Trading Systems

Short-term systems depend on daily aggregation for risk boundaries and execution filters. Weekly and monthly bars are used only for contextual gating.

Short-Term Risk Gate
if daily_volatility < threshold:
    allow_trade = True

Medium-Term Trading Systems

Medium-term systems align primarily with weekly aggregation. Daily noise is suppressed while directional persistence is preserved.

Long-Term Trading Systems

Long-term systems rely almost exclusively on monthly aggregation. Lower horizons serve as explanatory diagnostics rather than signal drivers.

Python Libraries Applicable to Price Aggregation

Pandas

Primary data manipulation library for time-series aggregation.

  • Features: Time-based resampling, calendar alignment
  • Key Functions: resample, agg, pct_change
  • Use Cases: Daily, weekly, monthly OHLC construction

NumPy

Numerical backbone for statistical operations.

  • Features: Vectorized computation
  • Key Functions: max, min, std
  • Use Cases: Volatility, range, drawdown calculations

Pandas Market Calendars

Exchange-specific trading calendar enforcement.

  • Features: Holiday schedules, session boundaries
  • Key Functions: get_calendar, schedule
  • Use Cases: Calendar-aware aggregation

PyArrow / Parquet

Efficient columnar storage for historical price data.

  • Features: Compression, fast reads
  • Use Cases: Partitioned raw and aggregated datasets

Data Sourcing Methodologies

Exchange-Disseminated Data

Official OHLC data disseminated by exchanges ensures correctness of session boundaries and corporate continuity.

Vendor-Aggregated Data

Third-party vendors provide convenience but require validation against exchange calendars and extrema consistency rules.

Internal Aggregation from Intraday Feeds

Institutional systems often aggregate internally from intraday feeds to retain full control over aggregation logic.

Database Structure and Storage Design

Symbol-Centric Partitioning

Partitioning by symbol and date optimizes historical scans and recomputation.

Immutability and Lineage

Raw data must never be overwritten. Aggregated datasets must include metadata referencing source data ranges and aggregation parameters.

Frequency-Separated Storage

Daily, weekly, and monthly series must reside in separate namespaces to prevent accidental cross-use.

Author’s Note on Aggregation Scope

This article deliberately focuses on aggregation mechanics rather than performance interpretation. Long-term performance analysis, factor attribution, and statistical inference belong to historical analytics layers built atop these series.

Conclusion

Daily, weekly, and monthly price series are not interchangeable representations of market data. Each is the product of precise aggregation rules governed by trading calendars, session structures, and continuity constraints. Correct aggregation is the foundation upon which all reliable market analytics are built.

For teams seeking institutional-grade historical data pipelines, aggregation correctness is not optional. Platforms like TheUniBit operationalize these principles by delivering market data engineered with deterministic aggregation, calendar integrity, and production-ready design.

Scroll to Top