intradayModel: Modeling and Forecasting Financial Intraday Signals

Shengjie Xiu, Yifan Yu, Daniel P. PalomarOpenalex Unknown 2023 · DOI · OpenAlex

Abstract

Models, analyzes, and forecasts financial intraday signals. This package currently supports a univariate state-space model for intraday trading volume provided by Chen (2016) <a href="https://doi.org/10.2139%2Fssrn.3101695" target="_top">doi:10.2139/ssrn.3101695</a>.

Introduction

High-frequency financial data, particularly intraday trading volume, presents significant modeling challenges due to the presence of multiple, overlapping temporal patterns. Volume typically follows a well-known "U-shaped" seasonal curve—peaking at the market open and close while dipping during midday—but it is also influenced by daily shifts in overall activity levels and transient "dynamic" shocks from news or market events.

The intradayModel R package addresses these complexities by providing a specialized framework for modeling and forecasting these signals. By implementing a univariate state-space model and leveraging Kalman filtering techniques, the package allows researchers to decompose noisy market data into distinct daily, seasonal, and dynamic components, facilitating more accurate analysis and one-bin-ahead forecasting.

Methodology: The State-Space Framework

The core of the package is based on the methodology proposed by Chen et al. (2016). It utilizes a univariate state-space representation to treat different market influences as hidden states.

Decomposition and Hidden States

The observed signal $y_\tau$ is modeled as the sum of three primary elements:

  1. Fixed Seasonal Component ($\phi_\tau$): Captures the recurring intraday patterns (e.g., the U-shape).
  2. Log-Daily Component: Represents the general volume level for a specific day.
  3. Log-Intraday Dynamic Component: Accounts for short-term fluctuations and shocks.
  4. Observation Noise: Captures residual Gaussian noise.

Estimation and Filtering

Parameter estimation is performed using the Expectation-Maximization (EM) algorithm, which includes an accelerated scheme to ensure rapid convergence. Once parameters are set, the package offers two primary modes of operation:

  • Analysis Mode: Employs Kalman smoothing to estimate components using the entire dataset, ideal for retrospective market analysis.
  • Forecast Mode: Uses Kalman forecasting to predict the next time bin based strictly on historical data.

Package Implementation and Workflow

The intradayModel package is designed to bridge the gap between econometric theory and practical application. It includes built-in datasets for testing, such as volume_aapl (15-minute Apple Inc. volume) and volume_fdx (15-minute FedEx Corp. volume in xts format).

Table 1: Key parameters for the package's core functions, defining the purpose of the model and the burn-in period for forecasting.

As shown in Figure 1, the package allows users to specify the purpose of the model (analysis vs. forecast) and define burn_in_days. The burn-in period is critical for "warming up" the hidden states, ensuring that the initial samples are used to stabilize the model before generating forecasts.

Key Insights and Results

A primary advantage of this approach is the explicit separation of seasonal and daily components. This prevents high-volume days from being misinterpreted as permanent shifts in the intraday seasonal pattern. The state-space framework provides the flexibility needed to handle the "burn-in" period effectively, allowing the model to adapt to the specific characteristics of the data before producing outputs.

The package provides a unified workflow from raw data to visualization. Using the generate_plots function, users can produce high-quality visual decompositions of signals, seeing exactly how the model partitions volume into its constituent parts. Performance is evaluated using standard metrics, including Mean Absolute Error (MAE), Mean Absolute Percent Error (MAPE), and Root Mean Square Error (RMSE).

Limitations and Future Directions

While powerful, version 0.0.1 of intradayModel has specific constraints. It is currently limited to univariate models, meaning it cannot yet capture lead-lag effects between different assets or model multivariate relationships. Additionally, the model assumes linear transitions and Gaussian noise, which may be challenged during extreme market events like flash crashes.

Future development is expected to expand the package's capabilities to include intraday volatility modeling and multivariate signal support, making it a more comprehensive tool for algorithmic trading research.

Summary updated

Abstract

Models, analyzes, and forecasts financial intraday signals. This package currently supports a univariate state-space model for intraday trading volume provided by Chen (2016) &lt;<a href="https://doi.org/10.2139%2Fssrn.3101695" target="_top">doi:10.2139/ssrn.3101695</a>&gt;.
BibTeX
@inproceedings{xiu2023intradaymodel,
  author = {Shengjie Xiu and Yifan Yu and Daniel P. Palomar},
  title = {{intradayModel: Modeling and Forecasting Financial Intraday Signals}},
  booktitle = {Openalex Unknown},
  year = {2023},
  doi = {10.32614/cran.package.intradaymodel},
}
Figure