question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Mouse-hover date is 1 day off (into the past)

See original GitHub issue

Requirements (place an x in each of the [ ])**

  • I realize finplot is not a web lib. (Hint: it’s native!)
  • I’ve read the snippets and not found what I’m looking for.
  • I’ve searched for any related issues and avoided creating a duplicate issue.
  • I’ve updated finplot (pip install -U finplot).
  • I’ve supplied the required data to run my code below.

Code to reproduce (from the repo. ReadMe front-page tutorial, but running with ‘SPY’)

import finplot as fplt
import yfinance

df = yfinance.download('SPY')
fplt.candlestick_ochl(df[['Open', 'Close', 'High', 'Low']])
fplt.show()

Describe the bug

When I run the snp500.py example (in finplot/examples), it shows the all-time-high candle date (when you mouse-hover over it) as 2022-1-3. That is 1 day off. It should read “2022-1-4”.

OS: Windows 11 finplot version: 1.8.1

p.s.

Thank you SO MUCH for creating Finplot!! It’s awesome and I love it!! 😃

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
highfestivacommented, Apr 9, 2022

Thanks for the praise, means a lot for a maintainer who gets a lot of flak for developing stuff. The tip of the iceberg is stuff I needed myself, the remaining stuff is for the community. Glad you like it! 😃

0reactions
ShivaSmithcommented, Apr 10, 2022

Thanks for your thoughts on this. Yeah I think we have this sorted now, so I’ll close it. I should have looked more closely at how yfinance handles (or doesn’t handle time zones). yfinance states: “Note: yahoo finance datetimes are received as UTC.”

Here’s what worked for me to get Eastern time – for daily bars (for SPY), not for intraday, this works:

df.index = df.index.tz_localize('America/New_York')

Only after making that call, then the ATH for SPY is correctly shown on the FinCrossHair as 3/4. Well, that or (effectively) changing the Finplot time setting to UTC with:

fplt.display_timezone = None

For intraday (only tested 1 hour bars), no adjustment at all is needed – dates and times appear to be correct automagically for intraday… 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mouse Pup Appearance by Age
Mouse Pup Appearance by Age ; Day 3. Ear flap starting to come away from head (one or both) ; Day 4. Ears...
Read more >
Option to display absolute dates and times instead of relative ...
All dates in the web interface are displayed relative to today. ... of EACH 6 out of any 7 consecutive DAYS ARE off...
Read more >
Change how dates, times, and more display on Mac
On your Mac, choose Apple menu > System Settings, click General in the sidebar, ... Date format: Choose the date format, such as...
Read more >
Calendar 2022 - Time and Date
1 : N 9: 1Q 16: F 23: 3Q 30: N ... Some holidays and dates are color-coded: ... The year 2022 is...
Read more >
AHPS Precipitation Analysis - National Weather Service
Displaying Current 1-Day Observed Precipitation Valid on: December 22, 2022 12:00 UTC What is UTC time? Map Help. Print this map Permalink Bookmark...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found