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 trading_index function #89

Closed
wants to merge 1 commit into from
Closed

Add trading_index function #89

wants to merge 1 commit into from

Conversation

maread99
Copy link
Collaborator

@maread99 maread99 commented Sep 28, 2021

WIP. DO NOT MERGE!
To be merged only after all calendars moved to new test suite (as described on #86) and TODO noted further below have been completed.

Adds trading_index function to allow for creating a trading index over a given range of sessions at a given period. Similar to pandas_market_calendars.date_range with additional functionality:

  • index can be created as a pd.DatetimeIndex of indices or pd.IntervalIndex of intervals.
  • provides for independent force_break_close and force_close options
  • takes advantage of exchange_calendars use of nanos for speed improvement (evaluates trading index for XHKG (a calendar with breaks) over a year at 30 minute periods in <2ms).

Credit to @Stryder-Git at pandas_market_calendars for showing the way with a vectorised implementation.

TODO post resolution of #71:

  • Move trading_index function to method of ExchangeCalendar (leave underlying _TradingIndex on calendar_helpers).
  • Tests:
    • include hypothesis fuzz tests - mark so they do not run by default (amend CI test parameters to recognise mark). Add hypothesis to dev requirements.
    • include test with known input / output to default test suite (employ Answers to be provided by side option to define minute bounds / test suite overhaul #71).
  • Add example to calendar_methods.ipynb.

Adds `trading_index` and underlying `_TradingIndex` to
`calendar_helpers.py`.
@maread99
Copy link
Collaborator Author

Superseded by #100.

@maread99 maread99 closed this Oct 15, 2021
@maread99 maread99 deleted the trading-index branch October 15, 2021 23:43
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