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 / Rename ExchangeCalendar methods #105

Merged
merged 3 commits into from
Oct 25, 2021
Merged

Add / Rename ExchangeCalendar methods #105

merged 3 commits into from
Oct 25, 2021

Conversation

maread99
Copy link
Collaborator

@maread99 maread99 commented Oct 25, 2021

New methods

Adds following methods to ExchangeCalendar and corresponding tests to ExchangeCalendarTestBase:

  • minute_to_trading_minute
  • minute_to_past_session
  • minute_to_future_session
  • minute_offset
  • minute_offset_by_sessions
  • session offset

See calendar_methods,ipynb. for functionality.

Renaming

Renames following ExchangeCalendar methods and properties as described in #85:

Previous Name New Name
previous_session_label previous_session
next_session_label next_session
date_to_session_label date_to_session
minute_to_session_label minute_to_session
open_and_close_for_session session_open_close
break_start_and_end_for_session session_break_start_end
minutes_for_session session_minutes
minute_index_to_session_labels minutes_to_sessions
all_sessions sessions
all_minutes minutes
all_minutes_nanos minutes_nanos
first_trading_minute first_minute
last_trading_minute last_minute
first_trading_session first_session
last_trading_session last_session
has_breaks sessions_has_break
market_opens_nanos opens_nanos
market_closes_nanos closes_nanos
market_break_starts_nanos break_starts_nanos
market_break_ends_nanos break_ends_nanos

Adds following methods to `ExchangeCalendar`
(and corresponding tests to `ExchangeCalendarTestBase`):
- `minute_to_trading_minute`
- `minute_to_past_session`
- `minute_to_future_session`
- `minute_offset`
- `minute_offset_by_sessions`
- `session offset`

Also:
- Adds various helper methods and properties to Answers to support new
tests.
- Adds `longest_run` utility function to `pandas_utils.py`.
- Adds following to `errors.py` to
handle a requested session/minute falling out-of-bounds:
  - `RequestedSessionOutOfBounds`
  - `RequestedMinuteOutOfBounds`
For each `*_minute_nanos` method:
- changes method to property (loses `side` option).
- renamed `*_minutes_nanos`.

Also:
- renames `all_*_minutes` properties as `*_minutes`.
- removes 'side' option from `minute_index_to_session_labels`.
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 maread99 marked this pull request as ready for review October 25, 2021 09:20
@maread99 maread99 merged commit b749b09 into master Oct 25, 2021
@maread99 maread99 deleted the minute-methods-0 branch October 25, 2021 09:21
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

Successfully merging this pull request may close these issues.

1 participant