SShortSingh.
Back to feed

Session-Aligned pandas OHLC Resampling: Handling Lunch Breaks and Empty Bars

0
·3 views

Applying resample().ohlc() to minute data that follows a trading calendar produces many empty bars, misaligned hourly bars and incorrect daily candles. The article uses a synthetic per-minute heat score for one stock, with sessions running 09:30-11:30 and 13:00-15:00. Of 203 generated bars, 163 are empty because resample fills the lunch break, overnight gap and weekends, and the author recommends dropping them rather than forward-filling. Thirty-minute bars align with the sessions, while 60-minute bars anchored to midnight yield half-length bars unless an offset is applied. The example also shows that a simulated news burst on Wednesday appears clearly in the resampled bars.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingHacker News ·

Chase, Bank of America and Wells Fargo customers report app and website outages

Customers of several major US banks, including Chase, Bank of America and Wells Fargo, reported problems accessing their accounts. The disruptions were noted in a New York Post report dated November 16, 2026. The source material does not specify the cause of the outages or how long they lasted. Further details on the scope and resolution were not included in the available information.

0
ProgrammingDEV Community ·

One QR Code Routes Visitors to Google Play or the App Store

A website owner who offered an "Install with QR" button for apps originally used a Google Play code, but needed a solution once apps launched on iPhone. Rather than presenting users with multiple codes, they chose a single QR code pointing to a short redirect page that detects the visitor's device. The page sends iOS users to the App Store and Android users to Google Play, preserving the referrer parameter so install sources can still be tracked. Visitors who open the page on a computer or without JavaScript see both official store badges instead. The page is marked noindex, and Android-only apps keep a direct Google Play code.

0
ProgrammingDEV Community ·

BeeBuzz: A Student Project Classifying Bee Species by Their Buzz

A developer building BeeBuzz for the ML Zoomcamp 2026 course is creating a classifier that identifies bee species from their buzzing sounds. The project aims to eventually detect when a species disappears from an area, giving beekeepers early warning to move hives before flowers go unpollinated. The current model is trained on 200 lab recordings covering five species and reaches about 80% accuracy on a 40-recording holdout set, with one species performing notably weaker. The author cautions that confidence scores are overconfident and that a perfect score on buzz-type classification stems from a recording artifact rather than biology. Field testing in real-world noisy conditions is planned as the next step.

0
ProgrammingDEV Community ·

Developer Generates App Store Screenshots With Robolectric and Headless Browser, No Phone Needed

A developer building iPhone apps written in Compose needed App Store screenshots at 1206x2622 pixels but had no iPhone and limited cloud build minutes, so they used unit tests instead. Robolectric renders Compose to a bitmap on the desktop JVM, and Roborazzi saves it as a PNG, with a qualifier setting a 402 by 874 dp screen at xxhdpi. To mimic the iPhone safe area, the test adds top padding for the Dynamic Island and bottom padding for the home indicator, and the Coil FakeImageLoaderEngine supplies real images and frozen feed data in place of network content. Because Robolectric does not draw WebViews, the article pages are rendered separately in headless Edge inside a 402-pixel iframe and composited beneath the Compose app bar by a Python script. The approach required a small preview parameter in the app code to avoid a polling loop that would block the test framework from going idle.