Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add drawdown plot #134

Merged
merged 7 commits into from
Sep 20, 2024
Merged

Add drawdown plot #134

merged 7 commits into from
Sep 20, 2024

Conversation

maread99
Copy link
Owner

Adds option of including a drawdown plot to gui glasses. Implements for GuiOHLC, GuiLine and GuiMultLine.

Involved:

  • adding 'get_high_*' functions to new standalone.py module.
  • implementing option for chart classes (of chart.py) to have a secondary plot against a 'right' y-axis.
  • implementing functionality to guis.BasePrice (to include adding drawdown period selection widget).

Also:

  • fixes bug where gui dates slider would behave erratically for intraday data with range > 1 year.

Includes test.

Also addresses doc typos in `analysis.py` and `guis.py`.
Adds standalone functions:

- get_ath()
- get_period_high()
- get_pct_off_high()
Concretised on GUI classes as a Lines mark describing the
drawdown.
Adds option to `BasePrice` for subclasses to include a drawdown
plot and use a `ToggleButtons` widget to select the period over
which to evaluate the high.

Implementation includes defining a new `prices` attribute on
`guis.BasePrice` to hold the prices as currently represented on
the chart (the structure of this data can differ from that actually
passed through to the chart, this can be an issue as evaluating
the drawdown requires knowledge of the 'high' prices whilst
some charts, for example `charts.Line`  requires only the close
price. The `prices` attribure provides for retaining knowledge of
all the price data from which new drawdown evaluations can be
made).

Rearranges order of parameters on some internal 'update'
methods on charts.py and guis.py.

Also refactors base of `IntervalSelector` to a dedicated
`ToggleButtonsHandled` class which the new
`DrawdownSelector` also uses.
Extends `test_plot_ohlc` and `test_plot_mult` to test funcionality
associated with drawdown plot.
Fixes bug where slider operation becomes erratic when data is
intraday and date range is greater than one year. Eratic
behaviour caused by, in this context, slider labels being set to a
format that excludes the year.
@maread99 maread99 added enhancement New feature or request fix Bug fix labels Sep 20, 2024
@maread99 maread99 merged commit 82a03c2 into main Sep 20, 2024
7 checks passed
@maread99 maread99 deleted the dev branch September 20, 2024 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant