One Subchart, two times Candlesticks: zoom out, zoom in: daily candlesticks have disappeared
See original GitHub issueHi,
based on example-overlay-correlate.py I multiplied the amount of data in the plot.
If I zoom out and zoom in again, the daily candles are gone.
Please find below the referring GIF and the code.
Thanks also here for looking at the topic! 😃
code
#!/usr/bin/env python3
from datetime import date, timedelta
import finplot as fplt
import pandas as pd
import scipy.optimize
import yfinance as yf
fplt.long_time = 200 * 365 * 24 * 60 * 60 * 1e9
now = date.today()
start_day = now - timedelta(days=58)
df = yf.download('GOOG', start_day.isoformat(), now.isoformat(), interval='90m')
dfms = yf.download('MSFT', start_day.isoformat(), now.isoformat(), interval='90m')
df.reset_index(drop=True,inplace=True)
# amountOfDfDuplication = 6
amountOfDfDuplication = 13
for runner in range(amountOfDfDuplication):
df = df.append(df)
df.reset_index(inplace=True, drop=True)
periods = df.shape[0]
datelist = pd.date_range(pd.to_datetime('1970-01-01'), periods=periods, freq="90min").tolist()
datelist[-1]
df['date']=datelist
df.set_index('date',inplace=True)
dfd = df.Open.resample('D').first().to_frame()
dfd['Close'] = df.Close.resample('D').last()
dfd['High'] = df.High.resample('D').max()
dfd['Low'] = df.Low.resample('D').min()
ax = fplt.create_plot('Alphabet Inc.', rows=1, maximize=True)
# plot down-sampled daily candles first
daily_plot = fplt.candlestick_ochl(dfd.dropna(), candle_width=5)
daily_plot.colors.update(dict(bull_body='#bfb', bull_shadow='#ada', bear_body='#fbc', bear_shadow='#dab'))
daily_plot.x_offset = 3.1 # resample() gets us start of day, offset +1.1 (gap+off center wick)
# plot high resolution on top
fplt.candlestick_ochl(df[['Open', 'Close', 'High', 'Low']])
fplt.autoviewrestore(True)
fplt.show()
Alphabet Inc…ini (after executing the animation)
min_x = 167740200000000000
max_x = 168129000000000000
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
High and Lows disappearing when CandleStick chart ... - GitHub
Zoom out a CandleStick chart. Actual behavior: At a certain point the highs and the lows will just disappear. Expected behavior: Highs and...
Read more >Candlesticks disappear from bid-ask chart at larger zoom
When zoomed out a bit (by reversing the steps above), the numbers disappear and only the histogram bars remain. You can see that...
Read more >The Secrets Of Candlestick Charts That Nobody Tells You
Discover the secret to reading candlestick charts most gurus will never tell you.Once you' ve seen the light, you'll never look at ...
Read more >Candlestick Math - A New Way Of Using Candlesticks - YouTube
When two single candle lines are combined, the meaning on the chart can become much more significant. You'll get an even sharper view...
Read more >Candlestick Chart Secrets (DO NOT TRADE WITHOUT ...
Candlestick Chart Secrets (DO NOT TRADE WITHOUT KNOWING THIS PATTERN). 148K views 2 years ago. The ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Good call, fixed it in https://github.com/highfestiva/finplot/commit/393bd2ada407490c2480a1d3c502e3e75e9ab795. If that’s not enough you could set
fplt.lod_candles
to a high value. It defaults to ~3k.I’ve problems stemming from the same root cause once before. As long as the problem can be circumvented, I’ll postpone rewriting the core internals, as rewriting takes a lot, but gains so little.