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

Renaming of some ExchangeCalendar methods #85

Closed
25 tasks done
maread99 opened this issue Sep 15, 2021 · 2 comments
Closed
25 tasks done

Renaming of some ExchangeCalendar methods #85

maread99 opened this issue Sep 15, 2021 · 2 comments

Comments

@maread99
Copy link
Collaborator

maread99 commented Sep 15, 2021

Over recent PRs (culminating with #71) the ExchangeCalendar's more client-facing (as opposed to calendar-definition) properties/methods have been revised to include parsing, annotation and standardised documentation. Concepts of 'session(s)' and 'minute(s)' are now expressed consistently throughout the class:

  • in Session, Minute and Date type annotations (and anticipated TradingMinute type).
  • within method documentation.
  • within error messages of parsing functions.
  • from release 4.0, it's proposed (todo for release 4.0 #61) that parameter names be consolidated from the various names currently employed to session and minute.
  • The README will be revised to clearly express these concepts (Path to release 3.4 #86).

I'd propose going the final step and renaming the following methods to support this consistency and make the names less verbose (the lexicographical grouping of like methods would also aid users searching for methods from auto-complete menus).

Methods to be renamed to drop '_label' part:

  • previous_session_label to previous_session
  • next_session_label to next_session
  • date_to_session_label to date_to_session
  • minute_to_session_label to minute_to_session

Methods that interrogate a session (all to be consistent with the likes of session_open:

  • open_and_close_for_session to session_open_close.
  • break_start_and_end_for_session to session_break_start_end.
  • minutes_for_session to session_minutes.

Methods that interrogate a range of sessions:

  • session_opens_in_range to sessions_opens.
  • session_closes_in_range to sessions_closes.
  • minutes_for_sessions_in_range to or sessions_minutes.
  • minutes_count_for_sessions_in_range to sessions_minutes_count.
  • session_distance to sessions_distance.

Methods that interrogate a range of minutes:

  • minute_index_to_session_labels to minutes_to_sessions.

Calendar properties:

  • all_sessions to sessions
  • all_minutes to minutes
  • all_minutes_nanos to minutes_nanos
  • first_trading_minute to first_minute.
  • last_trading_minute to last_minute.
  • first_trading_session to already existing property first_session.
  • last_trading_session to already existing property last_session.
  • has_breaks to sessions_has_break (and add genuine property has_break that refers to all calendar sessions).

Calendar attributes:

  • market_opens_nanos to opens_nanos.
  • market_closes_nanos to closes_nanos.
  • market_break_starts_nanos to break_starts_nanos.
  • market_break_ends_nanos to break_ends_nanos.

Renaming Process
Intention would be to include newly named methods (with any newly named parameter names - #61) and deprecate the old-named methods in an upcoming release (3.4?). The deprecated methods would be retained (together with existing parameter names) although revised to:

  • dispatch to the corresponding newly named method.
  • raise a FutureWarning advising of renaming and that the deprecated name will be removed in version 4.0.

#71 adds a deprecate decorator to exchange_calendar.py. The decorator's currently only used for deprecating the execution_mintues_* methods although it can accommodate deprecations for renaming - under which it raises a FutureWarning that advises the user:

  • that the method has been renamed.
  • of the new method name.
  • that the method is deprecated from release 3.4.
  • that the method will be removed in release 4.0.

@gerrymanoim, what are you thoughts? Would you be happy for me to get a PR together prior to 3.4 to put the following name changes in motion?

@gerrymanoim
Copy link
Owner

Yeah - this makes perfect sense.

maread99 added a commit that referenced this issue Oct 21, 2021
Renames various `ExchangeCalendar` methods as GH issue #85.
Methods with old names retained to:
- dispatch to newly named methods.
- advise of deprecation of old-named methods.
- warn of removal of old-named methods in 4.0.

Also:
- For some renamed methods also changes parameter names to commnon
names `session`, `minute`, `minutes`, `date`, `start` and `end`.
- Adds `ExchangeCalendar.has_break` property to query if any session
of calendar has a break.
- Adds `test_deprecated` to test deprecated methods are raising
FutureWarning errors.
- Renames `Answers` properties:
  -  `first_trading_minute` to `first_minute`
  -  `last_trading_minute` to `last_minute`
maread99 added a commit that referenced this issue Oct 22, 2021
Renames various `ExchangeCalendar` methods as GH issue #85.
Methods with old names retained to:
- dispatch to newly named methods.
- advise of deprecation of old-named methods.
- warn of removal of old-named methods in 4.0.

Also:
- For some renamed methods also changes parameter names to commnon
names `session`, `minute`, `minutes`, `date`, `start` and `end`.
- Adds `ExchangeCalendar.has_break` property to query if any session
of calendar has a break.
- Adds `test_deprecated` to test deprecated methods are raising
FutureWarning errors.
- Renames `Answers` properties:
  -  `first_trading_minute` to `first_minute`
  -  `last_trading_minute` to `last_minute`
maread99 added a commit that referenced this issue Oct 23, 2021
Renames various `ExchangeCalendar` methods as GH issue #85.
Methods with old names retained to:
- dispatch to newly named methods.
- advise of deprecation of old-named methods.
- warn of removal of old-named methods in 4.0.

Also:
- For some renamed methods also changes parameter names to commnon
names `session`, `minute`, `minutes`, `date`, `start` and `end`.
- Adds `ExchangeCalendar.has_break` property to query if any session
of calendar has a break.
- Adds `test_deprecated` to test deprecated methods are raising
FutureWarning errors.
- Renames `Answers` properties:
  -  `first_trading_minute` to `first_minute`
  -  `last_trading_minute` to `last_minute`
maread99 added a commit that referenced this issue Oct 25, 2021
Renames various `ExchangeCalendar` methods as GH issue #85.
Methods with old names retained to:
- dispatch to newly named methods.
- advise of deprecation of old-named methods.
- warn of removal of old-named methods in 4.0.

Also:
- For some renamed methods also changes parameter names to commnon
names `session`, `minute`, `minutes`, `date`, `start` and `end`.
- Adds `ExchangeCalendar.has_break` property to query if any session
of calendar has a break.
- Adds `test_deprecated` to test deprecated methods are raising
FutureWarning errors.
- Renames `Answers` properties:
  -  `first_trading_minute` to `first_minute`
  -  `last_trading_minute` to `last_minute`
maread99 added a commit that referenced this issue Oct 25, 2021
Renames various `ExchangeCalendar` methods as GH issue #85.
Methods with old names retained to:
- dispatch to newly named methods.
- advise of deprecation of old-named methods.
- warn of removal of old-named methods in 4.0.

Also:
- For some renamed methods also changes parameter names to commnon
names `session`, `minute`, `minutes`, `date`, `start` and `end`.
- Adds `ExchangeCalendar.has_break` property to query if any session
of calendar has a break.
- Adds `test_deprecated` to test deprecated methods are raising
FutureWarning errors.
- Renames `Answers` properties:
  -  `first_trading_minute` to `first_minute`
  -  `last_trading_minute` to `last_minute`
@maread99
Copy link
Collaborator Author

Implemented #105.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants