-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
Description
Opening a public ticket as this was reported on community slack
Run the following code:
from deephaven import read_csv
from deephaven import agg
crypto_trades = read_csv("https://media.githubusercontent.com/media/deephaven/examples/main/CryptoCurrencyHistory/CSV/CryptoTrades_20210922.csv")
agg_list = [
agg.last(cols=["CloseTime = Timestamp"]),\
agg.first(cols=["OpenTime = Timestamp"]),\
agg.max_(cols=["High = Price"]),\
agg.min_(cols=["Low = Price"]),
]
btc_bin = crypto_trades.where(filters=["Instrument=`BTC/USD`"])\
.update(formulas=["TimestampBin = lowerBin(Timestamp, MINUTE)"])
t_ohlc = btc_bin.agg_by(agg_list, by=["TimestampBin"])\
.join(table=btc_bin, on=["CloseTime = Timestamp"],joins=["Close = Price"])\
.join(table=btc_bin, on=["OpenTime = Timestamp"], joins=["Open = Price"])
import deephaven.plot.express as dx
plotly_ohlc = dx.candlestick(t_ohlc, x="TimestampBin", open="Open", high="High", low="Low", close="Close")
plotly_bar = dx.bar(t_ohlc, x="TimestampBin", y="Open")
subplot = dx.make_subplots(plotly_ohlc, plotly_bar, rows=2)
This results in a chart where the candlestick and bar chart are layered on the same axis
It should look more something like this, but in the opposite order:
It's likely that something is off in make_subplots axis binding for candlestick/ohlc.