How to deal with missing bars in stocks data?

How to deal with missing bars in stocks data?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by jaylin.bartell , 7 months ago

@paolo.leuschke 

Dealing with missing bars in stock data can be challenging, but there are a few strategies you can employ to handle such missing data effectively:

  1. Fill gaps with averages: If the missing bars are within a small range, you can consider filling the gaps with the average of nearby bars. This helps maintain the overall trend and minimize the impact of missing data.
  2. Interpolate missing values: Depending on the nature of the missing bars, you can use interpolation techniques to estimate the missing values. Common interpolation methods include linear interpolation, cubic spline interpolation, or using algorithms like the Kalman filter.
  3. Use surrounding data: If the missing bars occur sporadically, you can utilize the surrounding data points to estimate the value of the missing bars. For example, you can calculate the average of the previous and next bars or apply statistical techniques like regression analysis.
  4. Exclude missing bars: In some cases, if the missing bars are spread across a wide range and cannot be reasonably estimated or interpolated, it might be best to exclude those bars from your analysis. However, consider the impact of data loss and evaluate if it significantly affects the overall analysis or forecast.
  5. Consult data providers: If you obtain the data from a third-party provider or platform, they might have a process in place to handle missing bars. Reach out to them for guidance or inquire if alternatives (such as different data sources or higher-frequency data) are available to address the missing data issue.


Remember that the approach you choose may depend on the specific circumstances and the impact of the missing bars on your analysis or modeling.