Skip to content

Commit

Permalink
Fixing issue with ohlcv plot and sharex
Browse files Browse the repository at this point in the history
  • Loading branch information
slundqui committed Sep 7, 2023
1 parent 7cc2acd commit 03de095
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
4 changes: 1 addition & 3 deletions lib/chainsync/bin/streamlit/Dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@
main_placeholder = st.empty()

main_fig = mpf.figure(style="mike", figsize=(15, 15))
ax_ohlcv = main_fig.add_subplot(3, 1, 1)
ax_fixed_rate = main_fig.add_subplot(3, 1, 2)
ax_positions = main_fig.add_subplot(3, 1, 3)
(ax_ohlcv, ax_fixed_rate, ax_positions) = main_fig.subplots(3, 1, sharex=True)

while True:
# Wallet addr to username mapping
Expand Down
7 changes: 1 addition & 6 deletions lib/chainsync/bin/streamlit/pages/Wallet_Stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@

# Plot pnl over time
main_fig = mpf.figure(style="mike", figsize=(15, 15))
ax_pnl = main_fig.add_subplot(6, 1, 1)
ax_base = main_fig.add_subplot(6, 1, 2, sharex=ax_pnl)
ax_long = main_fig.add_subplot(6, 1, 3, sharex=ax_pnl)
ax_short = main_fig.add_subplot(6, 1, 4, sharex=ax_pnl)
ax_lp = main_fig.add_subplot(6, 1, 5, sharex=ax_pnl)
ax_withdraw = main_fig.add_subplot(6, 1, 6, sharex=ax_pnl)
(ax_pnl, ax_base, ax_long, ax_short, ax_lp, ax_withdraw) = main_fig.subplots(6, 1, sharex=True)

for addr in pnl_over_time["walletAddress"].unique():
format_name = user_lookup.set_index("address").loc[addr]["format_name"]
Expand Down
2 changes: 1 addition & 1 deletion lib/chainsync/chainsync/dashboard/plot_ohlcv.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
def plot_ohlcv(ohlcv, ohlcv_ax):
"""Plots the ohlcv plot"""
if len(ohlcv > 0):
mpf.plot(ohlcv, type="candle", ax=ohlcv_ax)
mpf.plot(ohlcv, type="candle", ax=ohlcv_ax, show_nontrading=True)

ohlcv_ax.yaxis.set_major_formatter(mpl_ticker.FuncFormatter(lambda x, p: format(x, "0.6")))
ohlcv_ax.set_xlabel("block timestamp")
Expand Down

0 comments on commit 03de095

Please sign in to comment.