-
-
Notifications
You must be signed in to change notification settings - Fork 208
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Live chart of two plots - OHLC and scatter. If I plot them, everything works great, but if I want to update them later on, chart just gets zoomed in to the shorter plot with just 3 candlesticks visible.
import pandas as pd
import finplot as fplt
from datetime import date
import requests
now = date.today().strftime('%Y-%m-%d')
r = requests.get('https://www.bitstamp.net/api-internal/tradeview/price-history/BTC/USD/?step=86400&start_datetime=2021-05-18T00:00:00.000Z&end_datetime=%sT00:00:00.000Z' % now)
df = pd.DataFrame(r.json()['data']).astype({'timestamp':int, 'open':float, 'close':float, 'high':float, 'low':float}).set_index('timestamp')
df = df['open close high low'.split()]
plt_ohlc, plt_scatter = fplt.live(2)
df_data1 = df.iloc[87:90] * 0.99
df_data2 = df.iloc[87:90] * 1.01
df_scatter = pd.concat([df_data1]) # , df_data2]) causes another exception during update
plt = fplt.plot(df_scatter[['low']], color='#ff00ff', style='o', width=2, legend='scatter')
def update():
plt_ohlc.candlestick_ochl(df[['open', 'close', 'high', 'low']])
plt_scatter.plot(df_scatter[['low']], gfx=True)
update()
fplt.timer_callback(update, 0.5)
fplt.show()
Thanks for your work, finplot is amazing !
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
