Skip to content

Commit

Permalink
Add tests for drawdown gui functionality
Browse files Browse the repository at this point in the history
Extends `test_plot_ohlc` and `test_plot_mult` to test funcionality
associated with drawdown plot.
  • Loading branch information
maread99 committed Sep 20, 2024
1 parent 969aa89 commit 6042625
Show file tree
Hide file tree
Showing 2 changed files with 278 additions and 14 deletions.
8 changes: 7 additions & 1 deletion src/market_analy/guis.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,11 @@ def _drawdown_selector_handler(self, change: dict):
try:
self.set_drawdown_period(window)
except ValueError as err:
self._popup("Drawdown period unavailable", err.args[0])
if window == "365D" and self._interval_selector.value != ONE_DAY:
msg = "52wk drawdown period only available with '1D' tick interval"
else:
msg = err.args[0]
self._popup("Drawdown period unavailable", msg)
change["owner"].set_value_unobserved(old)

def _create_drawdown_slctr(self) -> gui_parts.DrawdownSelector:
Expand Down Expand Up @@ -1433,6 +1437,8 @@ def _reset_chart(self):
self._update_chart(data, data2, prices, visible_x_ticks=vxts, reset_slider=True)
if self._HAS_INTERVAL_SELECTOR:
self._interval_selector.set_value_unobserved(self._tick_interval)
if self._HAS_DRAWDOWN:
self._drawdown_selector.set_value_unobserved("ATH")

def _reset(self):
self.slctr.disable()
Expand Down
Loading

0 comments on commit 6042625

Please sign in to comment.